Batchmake slicer

From KitwarePublic
Revision as of 15:21, 27 March 2009 by Finetjul (talk | contribs)
Jump to navigationJump to search
  • BatchMake in Slicer

BatchMake has been integrated in Slicer since version 3. A "BatchProcessing" subsection can be found in the list of Slicer modules. There are BatchMake into that section: "Gaussian Blur BatchMake", "Registration BatchMake" and "EMSegment BatchMake". All three modules are internally calling the Slicer modules, respectively "Gaussian Blur", "Register Images" and "EMSegment Simple".

The ultimate strength of BatchProcessing is to run multiple modules multiples times with multiple parameters on multiple inputs without any human interaction. This is done by writing a script and executing it locally on your machine or externally using grid computing (Condor). In this tutorial we will introduce you with BatchMake in Slicer and guide you step by step to do batch processing. We will also explain how you can create your own BatchMake module in Slicer.

    • How to run a BatchMake module locally?
GaussianBlurBatchMake.png

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 "BatchProcessing"
      • Choose the different values you want sigma to vary. Generated files will have in their name a sigma suffix.
      • Select a directory with images to process for "Data directory"
      • Create a mask that matches the filenames of the images to process in the previous directory for "Data file mask"
      • 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
      • Press apply to launch the processing

Note: The GaussianBlur BatchMake module does not deal with Slicer objects but it deals with files directly. 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 you had 3 files in your input directory that match the "Data file mask", ie imageX.mha, imageY.mha and imageZ.mha 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.

    • How to run Register Images on a Condor grid

In this section, we will see how to register multiple moving images to a single fixed image. We will assume that Condor has been already installed on your machine(s) and works properly. The first thing you have to do is to run Slicer with Condor privileges aka run Slicer as a Condor user. If you already are a Condor user, you can launch Slicer normally.

$ ./Slicer3-build/Slicer3 

If you are a regular user with no condor privileges but you created a Condor user (called condor) on your machine, you should launch Slicer using your environment variables but as a Condor user:

$ su condor -m -c ./Slicer3-build/Slicer3

Note: you should probably change the read/write access permissions of the Slicer temporary directories. Once Slicer is open, go in the BatchProcessing subsection and select "Registration BatchMake".

RegistrationBatchMake-Selection.png


    • How to vary the module parameters ?
    • How to write your own Batch Processing module ?