Difference between revisions of "EMSegmenter-CreateTask"

From Slicer Wiki
Jump to: navigation, search
(Created page with '=Task creation process - for developer= The goal is to create a task with the name 'Hello World' After following the instructions below the new task will consist of following fi…')
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[EMSegmenter-Tasks|Return to EMSegmenter Task Overview Page]]
 +
 +
 
=Task creation process - for developer=
 
=Task creation process - for developer=
The goal is to create a task with the name 'Hello World'
+
The goal is to create a task with the name 'Hello World' in Slicer 3 and Slicer 4. Before doing so, we define
 +
<DIR> = for Slicer 3 as Slicer3/Modules/EMSegment/Tasks/ (source directory) and
 +
        for Slicer 4 as Slicer-build/share/Slicer-4.*/qt-loadable-modules/EMSegment/Tasks (build directory)
  
 
After following the instructions below the new task will consist of following files:
 
After following the instructions below the new task will consist of following files:
  ./Slicer3/Modules/EMSegment/Tasks/Hello-World.mrml
+
  <DIR>/Hello-World.mrml
  ./Slicer3/Modules/EMSegment/Tasks/Hello-World.tcl
+
  <DIR>/Hello-World.tcl
  ./Slicer3/Modules/EMSegment/Tasks/Hello-World/<atlas_file_1>
+
  <DIR>/Hello-World/<atlas_file_1>
./Slicer3/Modules/EMSegment/Tasks/Hello-World/<atlas_file_2>
 
[...]
 
./Slicer3/Modules/EMSegment/Tasks/Hello-World/<atlas_file_i>
 
 
  [...]
 
  [...]
  ./Slicer3/Modules/EMSegment/Tasks/Hello-World/<atlas_file_N>
+
  <DIR>/Hello-World/<atlas_file_N>
  
 +
== Step 1: Create Template without Preprocessing ==
 +
* Create a new directory <DIR>/Hello-World
  
* Create a new directory ./Slicer3/Modules/EMSegment/Tasks/Hello-World
+
* Copy the atlas files for air, CSF, greymatter, whitematter, and T1 from <DIR>/MRI-Human-Brain into this directory.
  
* Copy the atlas files for air, GM, T1 into this directory.
+
* Start Slicer
 +
* Set Scene of Slicer to <DIR> by saving scene in <DIR>. Afterwards remove resulting mrml file from <DIR> as it is not needed anymore
  
* Start Slicer
 
 
* Switch to the EMSegmenter module
 
* Switch to the EMSegmenter module
 
* Create new task
 
* Create new task
 
**  Name:          Hello World
 
**  Name:          Hello World
 
**  Pre-processing: None
 
**  Pre-processing: None
* Basically follow our EMSegmenter advanced tutorial, but create a simple tree
+
* Now follow up the [[Media:EMSegmenterTutorialAdvancedMode-Slicer-3.6.3-1.pdf | EMSegmenter advanced tutorial ]] up to Step 9 with the following modifcations:
** load ./Slicer3/Modules/EMSegment/Testing/TestData/MiscVolumeData/MRIHumanBrain_T1_aligned.nrrd
+
** load <DIR>/../Testing/TestData/MiscVolumeData/MRIHumanBrain_T1_aligned.nrrd
 
** Add a channel, call it T1, assign MRIHumanBrain_T1_aligned
 
** Add a channel, call it T1, assign MRIHumanBrain_T1_aligned
**  Create a simple anatomical tree (air and GM)
+
**  Load atlas files only from <DIR>/Hello-World/  
**  Load atlas files only from ./Slicer3/Modules/EMSegment/Tasks/Hello-World/
+
**  for Slicer 3 only: generate mean and covariance values  
**  generate mean and covariance values
+
* At step 9/9. click on 'Create Template File' and save the file under <DIR>/Hello-World.mrml. Hello-World.mrml now only consists of nodes needed to parameterize the EMSegmenter.  
**  specify node weights
 
* At step 9/9. click on 'Create Template File'
 
**  Save the file under ./Slicer3/Modules/EMSegment/Tasks/Hello-World.mrml
 
**  The target node and some other unneeded nodes will be removed from the mrml scene and written to disk.
 
 
* Close Slicer
 
* Close Slicer
* Copy our standard tcl file ./Slicer3/Modules/EMSegment/Tasks/Template.tcl to ./Slicer3/Modules/EMSegment/Tasks/Hello-World.tcl
 
* Adjust this tcl file to include your pre-processing pipeline.
 
* edit ./Slicer3/Modules/EMSegment/Tasks/Hello-World.tcl to specify your own pre-processing
 
* edit ./Slicer3/Modules/EMSegment/Tasks/Hello-World.mrml to use your own pre-processing
 
** - <EMS TclTaskFilename="GenericTask.tcl" ></EMS>
 
** + <EMS TclTaskFilename="Hello-World.tcl" ></EMS>
 
* touch ../Slicer3/Modules/EMSegment/CMakeLists.txt and do a 'make' to copy the new files into the binary directory
 
  
 +
== Step 2: Include Preprocessing (Optional) ==
 +
For templates that do not include atlas files the following instructions are optional
 +
* Copy our standard tcl file <DIR>/Template.tcl to <DIR>/Hello-World.tcl
 +
* Edit <DIR>/Hello-World.tcl to customize/modify the pre-processing pipeline
 +
* Edit <DIR>/Hello-World.mrml to use your own pre-processing by replacing  <EMSGlobalParameters ... TclTaskFilename="GenericTask.tcl" ... > with  <EMSGlobalParameters ... TclTaskFilename="Hello-World.tcl" ...>
 +
 +
== Step 3: Update Slicer Build (only for Slicer 3) ==
 +
touch <DIR>/../CMakeLists.txt and do a 'make' to copy the new files into the binary directory
 +
 +
When you start Slicer again 'Hello World' should appear in the task list of the EMSegmenter.
  
The result of the process above can also be downloaded here:
+
=EMSegmenter-Task Template=
After Installing both files this 'Hello World' task will appear in the task list under the name 'Hello World'.
+
Please use this [[EMSegmenter-Tasks:Template| wiki page]] as a template for you task specific Wiki page.

Latest revision as of 21:46, 2 August 2012

Home < EMSegmenter-CreateTask

Return to EMSegmenter Task Overview Page


Task creation process - for developer

The goal is to create a task with the name 'Hello World' in Slicer 3 and Slicer 4. Before doing so, we define

<DIR> = for Slicer 3 as Slicer3/Modules/EMSegment/Tasks/ (source directory) and 
        for Slicer 4 as Slicer-build/share/Slicer-4.*/qt-loadable-modules/EMSegment/Tasks (build directory)

After following the instructions below the new task will consist of following files:

<DIR>/Hello-World.mrml
<DIR>/Hello-World.tcl
<DIR>/Hello-World/<atlas_file_1>
[...]
<DIR>/Hello-World/<atlas_file_N>

Step 1: Create Template without Preprocessing

  • Create a new directory <DIR>/Hello-World
  • Copy the atlas files for air, CSF, greymatter, whitematter, and T1 from <DIR>/MRI-Human-Brain into this directory.
  • Start Slicer
  • Set Scene of Slicer to <DIR> by saving scene in <DIR>. Afterwards remove resulting mrml file from <DIR> as it is not needed anymore
  • Switch to the EMSegmenter module
  • Create new task
    • Name: Hello World
    • Pre-processing: None
  • Now follow up the EMSegmenter advanced tutorial up to Step 9 with the following modifcations:
    • load <DIR>/../Testing/TestData/MiscVolumeData/MRIHumanBrain_T1_aligned.nrrd
    • Add a channel, call it T1, assign MRIHumanBrain_T1_aligned
    • Load atlas files only from <DIR>/Hello-World/
    • for Slicer 3 only: generate mean and covariance values
  • At step 9/9. click on 'Create Template File' and save the file under <DIR>/Hello-World.mrml. Hello-World.mrml now only consists of nodes needed to parameterize the EMSegmenter.
  • Close Slicer

Step 2: Include Preprocessing (Optional)

For templates that do not include atlas files the following instructions are optional

  • Copy our standard tcl file <DIR>/Template.tcl to <DIR>/Hello-World.tcl
  • Edit <DIR>/Hello-World.tcl to customize/modify the pre-processing pipeline
  • Edit <DIR>/Hello-World.mrml to use your own pre-processing by replacing <EMSGlobalParameters ... TclTaskFilename="GenericTask.tcl" ... > with <EMSGlobalParameters ... TclTaskFilename="Hello-World.tcl" ...>

Step 3: Update Slicer Build (only for Slicer 3)

touch <DIR>/../CMakeLists.txt and do a 'make' to copy the new files into the binary directory

When you start Slicer again 'Hello World' should appear in the task list of the EMSegmenter.

EMSegmenter-Task Template

Please use this wiki page as a template for you task specific Wiki page.