Kitware is excited to introduce a new extension, SlicerPipelines, that allows the creation and use of simple modules in 3D Slicer without coding. This extension was developed as part of SlicerSALT and has been added to the Slicer Extensions Index for the open source community to use. 

What is a Pipeline?

We define a pipeline as a piece of logic that takes a single Medical Reality Modeling Language  (MRML) node as input (a model, a volume, etc) and returns a single MRML node as output. Some examples are converting a model to a segmentation, the segment editor’s hollow, margin, and thresholding effects, and items like decimation and smoothing out of the Surface Toolbox.

Because they currently can only take a single node as input and return a single node as output, they are best for simple, repetitive workflows (e.g. threshold an image, apply smoothing, convert to a model, repeat for the next image). For more complicated workflows that depend on multiple MRML inputs or user interaction, manually coding a new module is still the way to go.

Using the PipelineCreator

The PipelineCreator module will greatly help reproduce repetitive image processing workflows by bundling many steps in a single pipeline. All you need is a workflow and a folder to put the created module in.

To add steps to your pipeline, press the “Insert Module” button. This will show a window where you can select the item you want to add. Pick the item you want, fill in its parameters, and then select the next item in the pipeline. You will need to repeat this process until the pipeline has all the steps in your workflow.

Inserting a module into the pipeline

To make sure everything will work as intended, there is a “Test” drop-down that will let you test the pipeline at any point in the process. Just select your input, press run, and it will give you your output.

Testing a pipeline with multiple modules. Segmentation was manually moved to the right.

Once all the steps have been appropriately captured in your pipeline interface, you can fill in the remaining fields, like name and output directory, press “Finalize,” and you will have your brand new module. If there are any errors during the creation of the pipeline, a pop-up window will tell you what went wrong. If you had the “Load module on creation” checkbox checked, you should be able to find your new pipeline in the modules dropdown under a “Pipeline Modules” folder. You should also be able to find your new pipeline in the “Insert Module” pop-up of the pipeline creator so that you can use it in a future pipeline.

The UI of the newly created pipeline

If you prefer to run the pipeline from the command line, there is a python script under <output-folder>/CommandLineScripts/ (actual name of script will depend on your pipeline name).

./Slicer --python-script CommandLineScripts/RunMyPipeline.py <input-file> <output-file>

Note: The created module is not published to the extension index, but since it is all Python you can share with others by putting the folder in a zip file and sending it to them. Then they will need to add the unzipped folder to Edit -> Application Settings -> Modules -> Additional module paths.

Pipeline Case Iterator

Also included in the SlicerPipelines extension is the Pipeline Case Iterator, which will allow you to run a pipeline sequentially over a directory of files. For each file in the directory, the Pipeline Case Iterator will load the file, run it through the given pipeline, and save the result. This allows you to easily run your pipelines over large amounts of data.

Pipeline Case Iterator running a pipeline

How to access the extension

License

The PipelineCreator is distributed under the Apache license, while Slicer itself is distributed under the BSD-style Slicer License. Both are permissive licenses that support unrestricted commercial use, with attributions.

Kitware’s Medical Computing Capabilities

The SlicerSALT suite was developed by Kitware’s Medical Computing Team, which is composed of computer scientists, software engineers, and imaging experts. Specializing in the medical and biomedical industries, they provide collaborative research, development, and technology integration services for research centers, universities, and commercial companies. While the suite of tools is open source, you can partner with Kitware to ensure that you are effectively leveraging the technology. We can tailor the applications to meet your specific needs, including developing custom workflows, user interfaces, and more. For more information about partnering with Kitware, send us a message at kitware@kitware.com. You can also visit our commercial projects page. 

Acknowledgments

Research reported in this publication was supported by the National Institute Of Biomedical Imaging And Bioengineering of the National Institutes of Health under Award Number R56EB021391. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.

Leave a Reply

X