Pipelines in 3D Slicer

A new extension, Pipelines, is being developed that will allow for GUI create-able pipelines in 3DSlicer. This extension will have at least two new modules: PipelineCreator and PipelineCaseIterator.

What is a pipeline? A pipeline for this extension is a module that takes an input (could be a mesh, segmentation, etc), some parameters, and creates an output (possibly the same type as the input, possibly a different type). Pipelines can be built up with other modules (including previously built pipelines!) to create well defined workflows that can be shared with others.

What is the need trying to be filled? In general, the Pipelines extension is meant to help improve efficiency of dealing with simple workflows. If you find yourself constantly running an input through the same list of modules over and over (e.g. import mesh, convert mesh to labelmap, run algorithm, save labelmap to file), then pipelines is for you. It is also meant to be useful to people that do not have a strong programming background.

What pipelines are not. Pipelines are not meant to replace the need to code custom modules for more complicated situations. They do not allow generic “coding via GUI”. If you have a complicated workflow that takes multiple meshes as inputs and requires user input for each case (e.g. painting in the segment editor), then Pipelines are not for you.

What modules can I put in a pipeline? Good question! In general the answer should be any module that takes a single input (a MRML node), some parameters (or not), and gives a single output (also a MRML node). In reality however, there are going to be modules that fit that description, but are not setup to work with the Pipeline infrastructure. The first modules likely to be put into the Pipelines infrastructure as part of the initial development are the Surface Toolbox, Mesh To Label Map, and SegPostProcess. The design as outline below allows for existing modules to be updated or wrapped to fit the interface the PipelineCreator will be used. This will likely happen to other existing modules over time.

Module Descriptions:

  1. PipelineCreator

The Pipeline Creator is a module of 3DSlicer that will offer the ability to create pipelines via a GUI interface with no coding knowledge needed.

PipelineCreatorDesign

Above is the architectural design of the PipelineCreator. The Pipeline Creator Module will work with any module that implements the PipelineSelectableModule interface. Modules may choose to implement this directly, or wrapper classes may be used (such as when changing original source is not possible or undesired). For convenience, a JSON based wrapper generator will likely be implemented to allow for easier wrapper creation for existing simple modules (such as many of the VTK filters). Wrappers for VTK filters or other modules may be written manually if desired. Note: the diagram is at a high level and some of the function signatures/names may change during implementation.

This is the general UI for creating pipelines. A list of modules is created where one module feeds into the next. Each module in the pipeline knows what its input and output types are, and these are told to the PipelineCreator module via the PipelineSelectableModule interface methods. For convenience for the user, during the creation of the pipeline, it will allow modules to be added, deleted, and moved up and down. Doing this may at times cause the output of one module to not match the input of the next module. If this happens, the mismatched output and input boxes will be colored red to indicate that there is a problem, and if the finalize button is clicked, an error will occur. If the type of all outputs and inputs are matched, the finalize button will initiate the creation of the new module. At any time the user may press the clear button to start from scratch. A popup confirmation window will appear to ensure the user didn’t accidentally press clear when trying to finalize. Pressing the prepend/insert/append buttons will cause the Select Module window to pop up.

SelectModule

This is UI for selecting a module to insert into the pipeline. The input type is selectable and will default to the output type of the directly above the button pressed (if any). When a user selects a module in the module selection widget, the output type read only text box will be populated with the output type of the selected module. Clicking OK will close the pop up and insert the selected module into the Pipeline Creator module. Clicking Cancel will close the pop up window and return to the Pipeline Creator module without making any changes.

  1. PipelineCaseIterator

The second module that will be added the PipelineCaseIterator, which will allow for running pipelines over a set of files (aka cases) in a directory. This module’s main purpose is to allow easy batch processing when you need to run a pipeline over many independent inputs.

PipelineCaseIteratorModuleMockup

PipelineCaseIteratorModuleRunningMockup

Thanks for reading! I know this was a little bit longer post. Please feel free to provide any feedback on the design or reach out with questions.

5 Likes

What is the situation of this extension? The documentation/instructions and the interface in the latest stable doesn’t seem to match.

We just (yesterday) merged an update into the git repository, i don’t know when the registry will be updated, it’s a python module that you could install from the repository