Batchmake slicer

From KitwarePublic
Revision as of 19:19, 7 April 2009 by Finetjul (talk | contribs)
Jump to navigationJump to search

BatchMake in Slicer

BatchMake has been integrated in Slicer since version 3 and highly improved in version 3.4. A "Batch Processing" category can be found in the list of Slicer modules.
There are 4 modules into the Batch Processing subsection: Gaussian Blur BatchMake, Register Images BatchMake, EMSegment BatchMake and Resample Scalar Volume BatchMake. All the Batch modules are internally calling Slicer modules, respectively Gaussian Blur, Register Images, EMSegment Simple and Resample Scalar Volume.

The ultimate strenght of batch processing is to run automatically multiple modules multiples times with multiple parameters on multiple inputs on multiple machines.
Since Slicer 3.4, you can easily transform any Slicer modules to support batch processing. Only minor changes in the module XML file are needed, no code rewriting.
In this tutorial we will introduce you with BatchMake in Slicer and guide you step by step to batch process your data. We will also explain how you can create your own BatchMake module in Slicer.

How to run a BatchMake module locally?

Gaussian Blur BatchMake GUI

In this section, we will see how to run locally (on your machine) a Gaussian Blur filter on a single image with different sigma values.

  • Launch Slicer
  • Open the "Gaussian Blur BatchMake" module located in "Batch Processing"
  • By setting Sigma minimum, Sigman maximum and Sigma step, you change the number of times the Gaussian Blur module will be called with a different sigma. If Sigma minimum, maximum and step are respectively set to 1, 10 and 1; Gaussian Blur will be run 10 times, with a sigma varying from 1 to 10.
  • Then fill "Data directory", a directory containing images to blur
  • Change the mask (wildcards) to select the images to blur based on their filenames.
  • Check "Recursive" if you want to recursively apply the "Data file" mask in the "Data directory".
  • Choose an output directory where all the result images will be saved in for "Output directory"
  • Make sure the "Run using Grid/Condor" checkbox is unchecked to run the module locally
  • Press apply to launch the processing

Note: The inputs of the Gaussian Blur filter are the files found in the input directory. If Sigma minimum, Sigma maximum and Sigma step are respectively set to 1, 10 and 1, then 10 files will be created for each input file. For example, if 3 files in the input directory

imageX.mha, imageY.mha and imageZ.mha 

match the "Data file mask", (i.e. all three matching *.mha); after the module is executed the output directory will contain:

imageX-1.mha, imageX-2.mha ... imageX-10.mha,
imageY-1.mha, imageY-2.mha ... imageY-10.mha,
imageZ-1.mha, imageZ-2.mha ... imageZ-10.mha
Input images
Output images

How to run Register Images on a Condor grid

In this section, we will see how to register - on different machines - multiple moving images to a single fixed image . We will assume that Condor has been already installed on your machine(s) and works properly. You must have created and configured a condor user account on your machine, the condor scripts generated by BatchMake will be executed by the condor user ( +Owner = condor ).

  • Start Slicer as a regular user, there is no need to be a condor user.
  • Open the "Register Images BatchMake" module located in "Batch Processing"
Selection of the Register Images Batch module
Register Images Batch GUI

How to vary the module parameters ?

How to write your own Batch Processing module ?

The BatchMake modules running on Condor don't support the <image> tags in the module XML files. Slicer pass <image> arguments to the modules the memory address where the image is loaded and not the filename of the image. as <im they must be changed into <file> or <directory>+<string>. Share