2010 Winter Project Week SPECTRE 3DSlicer Integration

From NAMIC Wiki
Jump to: navigation, search
Home < 2010 Winter Project Week SPECTRE 3DSlicer Integration


Key Investigators

  • BWH: Nicole Aucoin
  • JHU: Aaron Carass, Min Chen
  • GE: Jim Miller

Objective

Integration of SPECTRE Skull Stripping software into the NAMIC Toolkit via the Slicer3 CLI framework.





Approach, Plan

Our approach: integration of software which will segment and provide coordinate reference frames for the Cerebrum (akin to the Talairach space), the Cerebellum (see reference below for K. Rehm), and for the Brainstem.

This will be achieved through integration of the Java Imaging Software Toolkit (JIST) into the Slicer3 framework and then testing and evaluation of JIST components for completing the necessary components to provide this system.

The main challenge is supporting Java command line executables in 3D Slicer.

Our plan is first to facilitate Java command line module discovery and execution, by adding support for the --xml argument to SPECTRE, and adding support for tcl wrapping scripts in 3DSlicer. Then integrate SPECTRE into the NAMIC toolkit by crafing a CMakeLists.txt file to allow it to be built easily. Create a NITRC project and a 3D Slicer extension that can be either downloaded or built on any platform.

Progress

A proof of concept sample Java HelloWorld application has been added to 3D Slicer.

Changes to the Command Line Module logic and Module Factory were made to support launching the tcl script with tclsh, for cross platform compatibility.

Changes made to the Java classes to support the --xml argument, Slicer recognises SPECTRE as a command line module.

Reading in the output images from SPECTRE back into Slicer works, to do: volume origin and win/level, stderr issue, marking some as label maps.

Updating instructions on how to run SPECTRE in Slicer to reflect current methods.

Presentations

Powerpoint presentation given by Jerry L. Prince on the status of the integration of SPECTRE as a module within Slicer, given at the 2010 Winter AHM in Utah.

How to run SPECTRE with Slicer

October 2010

SPECTRE has been modified to work as an extension. This is still an intermediate stage in the integration process, the eventual end goal is to use the Extensions Wizard to download SPECTRE automatically.

The atlas can be found SPECTRE_ATLASES.zip

Currently the installation process is as follows (for linux and windows using cygwin):

  • build Slicer3 from the source code in the SVN trunk
  • Install MIPAV 5.0.0 or later
    • set the install directory on linux to be Slicer3-build/mipav. The default c:/Program Files/ location on windows should be fine.
    • if the SPECTRE building step fails, add the path to mipav to your PATH environment variable
    • you'll have to run MIPAV once to set up some defaults, from Min:
1.)Close out of everything
2.)Load up Mipav
3.)Go to the "Plugins" menu
4)If there is a "JIST" option then skip to 5.) otherwise do 4a-b.)

4a.)Select "Install Plugin" and install "Slicer3-ext/SPECTRE-install/lib/Slicer3/SPECTRE_Slicer.jar"
(It might throw an error saying it can't be installed, that's okay)  
4b.)Restart mipav

5.)Select Click "JIST"->"JISTLayoutTool"
6.)If it asks you to pick a library directory, just pick an empty folder anywhere
7.)Close everything
8.)Try running it in Slicer again
  • Download SPECTRE.s3ext.gz
    • use gunzip to expand it
    • put it in Slicer3/Extensions
  • cd Slicer3/Scripts
  • ./extend.tcl SPECTRE
    • this will build the extension
    • it checks for the required version of MIPAV and points to the .jar files there
    • requires a Java compiler at least version 1.6 (to verify, you won't go wrong with the latest one)
    • if you get a compiler error related to not finding a class, there's a possibility that the latest source code that you just checked out isn't quite in sync with the version of MIPAV or the CMake system, email nicole@bwh.harvard.edu to let her know.
    • it will upload the extension to the extensions server, look for the message at the end that looks like:
 message goes here
  • Start up Slicer3-build/Slicer3, and run the Extension Manager (click on the gear, or View->Extension Manager)
    • The Where to search box should contain a URL that matches the message you saw when you compiled the extension. If not, adjust the text then click Next
    • Select SPECTRE, then click on Download & Install (icon should turn from an hourglass to a check once it's done)
  • Restart Slicer3
  • Look for the new moudle under Modules, Developer Tools, SPECTRE2009
    • If the SPECTRE module hasn't loaded, exit and restart it with the --verbose-module-discovery command line option and look in the error log to see what was reported about the module discovery process for SPECTRE.tcl (the wrapper script for the .jar file)

To run it:

January 2010

Linux

Updated instructions, based on the Windows process, to run SPECTRE with Slicer on a linux workstation (Jan 29/10):

  • build Slicer3 from the source code in the SVN trunk
  • install the SPECTRE classes and supporting classes in Slicer3/Applications/CLI/JAVA/SPECTRE/, so a plugins directory appears there that has all the supporting classes (ie the org tree) and the edu tree.
  • Install MIPAV
    • download installMIPAV.bin
    • chmod u+x installMIPAV.bin
    • sh ./installMIPAV.bin
    • In the installer, Choose Install folder: Slicer3/Applications/CLI/Java/SPECTRE/mipav
    • In the installer, Create links: none
    • MIPAV comes with a JRE, to use that version of java: add Slicer3/Applications/CLI/Java/SPECTRE/mipav/jre/bin to the start of your path (Slicer will use it for the SPECTRE jars if you have the more recent version of SPECTRE.tcl)
  • go to the Slicer3 source directory Slicer3\Applications\CLI and edit the file CMakeLists.txt
    • remove the hash mark at the start of the line with Java on it (in the SET cli_modules command)
  • in the Slicer3\Applications\CLI\Java directory, edit the file SPECTRE.tcl, and edit the following lines to point to your installation:
    • pathToMipav to the full path to Slicer3/Applications/CLI/Java/SPECTRE/mipav
    • pathToSPECTREPlugins to the full path to Slicer3/Applications/CLI/Java/SPECTRE/plugins
  • Rebuild Slicer using Slicer3/Scripts/getbuildtest.tcl in order to install the helper script SPECTRE.tcl
  • Start up Slicer
    • check under the Modules menu, Developer Tools, and run the Java Example first. If the status message says "Completed with errors", you can restart Slicer with the --clear-module-cache argument and try it again.
    • once it does run, SPECTRE 2009 is also categorised under Developer Tools, click on it to open it's GUI
  • Load an input volume
  • Select that input volume in the SPECTRE GUI under the Volume drop down menu (Slicer3/Application/CLI/Java/SPECTRE/mipav/plugins/atlases/spectre_atlas/OAS1_0001_MR1_original.hdr)
  • Click on the Atlas list folder and browse to your atlas file list (Slicer3/Application/CLI/Java/SPECTRE//mipav/plugins/atlases/spectre_atlas/oasis-3_20081124.txt)
  • Scroll down to the Output pane in the SPECTRE GUI and click on the drop down menus for the output volumes that you wish to reload into Slicer, for example, Stripped Volume, and select the Create New Volume option.
  • Click the Apply button
  • Wait, the stripped brain is eventually loaded back into Slicer.

Windows

At the project week, the integration was done on Nicole's Win32 laptop using these steps:

  • build Slicer3 from the source code in the SVN trunk
  • install the SPECTRE classes in c:\Documents and Settings\nicole\mipav\plugins, there should be a directory called edu there that holds the SPECTRE classes, as well as support libraries
  • download and install MIPAV to C:\Program Files\mipav
  • run MIPAV and under the Plugins menu, select Install Plugin.
  • browse to "c:\Documents and Settings\nicole\mipav\plugins" and click on the arrow to move it the Selected class files window, then click Install Plugin(s)
  • go to the Slicer3 source directory Slicer3\Applications\CLI and edit the file CMakeLists.txt
    • remove the hash mark at the start of the line with Java on it (in the SET cli_modules command)
  • in the Slicer3\Applications\CLI\Java directory, edit the file SPECTRE.tcl, and edit the following lines to point to your installation:
    • set pathToMipavPlugins "c:/Program Files/mipav"
    • lappend jarList {c:/Program Files/mipav}
    • lappend jarList {c:/Documents and Settings/nicole/mipav/plugins}
  • Rebuild Slicer using Slicer3/Scripts/getbuildtest.tcl in order to install the helper script SPECTRE.tcl
  • Start up Slicer
    • check under the Modules menu, Developer Tools, and run the Java Example first. If the status message says "Completed with errors", you can restart Slicer with the --clear-module-cache argument and try it again.
    • once it does run, SPECTRE 2009 is also categorised under Developer Tools, click on it to open it's GUI
  • Load an input volume
  • Select that input volume in the SPECTRE GUI under the Volume drop down menu (c:/program files/mipav/plugins/atlases/spectre_atlas/OAS1_0001_MR1_original.hdr)
  • Click on the Atlas list folder and browse to your atlas file list (c:/program files/mipav/plugins/atlases/spectre_atlas/oasis-3_20081124.txt)
  • Scroll down to the Output pane in the SPECTRE GUI and click on the drop down menus for the output volumes that you wish to reload into Slicer, for example, Stripped Volume, and select the Create New Volume option.
  • Click the Apply button
  • Wait, the stripped brain is eventually loaded back into Slicer.

References

  • K. Rehm's 2000 HBM abstract, 'Use of Cerebellar Landmarks To Define a Coordinate System and an Isolation Strategy'