Projects:MATLABSlicerExampleModule

From NAMIC Wiki
Revision as of 20:42, 8 September 2008 by Melonakos (talk | contribs)
Jump to: navigation, search
Home < Projects:MATLABSlicerExampleModule
Back to Georgia Tech Algorithms, Isomics Engineering

MATLAB Slicer Example Module

The aim of this project to provide a simple command-line module which enables MATLAB code to run within Slicer3. In other words, Slicer3 is used for data I/O, parameter setting, and visualizations. Then, behind-the-scenes, MATLAB code is called to perform image analysis computations.

TEEM is used to pass data back-and-forth between MATLAB and Slicer3, using TEEM-based nrrdLoadWithMetadata() and nrrdSaveWithMetadata() functions.

Description

Download the latest (last updated: 07 Sep 2008): MATLABSlicerExampleModule.zip

Files included in the Download:

  • CLI-shell.sh - The command-line interface TCL shell script. This currently works only in Windows. Two lines towards the bottom must be edited to point to the proper places, see the comments at the end of the file.
  • MATLAB/
    • compilethis.m - this MATLAB script contains all of the information to be able to compile the nrrdLoadWithMetadata() and nrrdSaveWithMetadata() functions using Slicer3's TEEM libraries. Open it up and follow the instructions.
    • nrrdLoadWithMetadata.c - this c function is used to load nrrd data into MATLAB with the header metadata information (currently supports all NRRD files that do not use key/value information and also has limited support for DWMRI key/value information).
    • nrrdLoadWithMetadata.m - a MATLAB help file, which can be used within MATLAB by typing "help nrrdLoadWithMetadata"
    • nrrdLoadWithMetadata.mexglx/.mexw32 - precompiled 32-bit functions (may not work for you until you recompile with the compilethis.m script).
    • nrrdSaveWithMetadata.c - this c function is used to save nrrd data from MATLAB with the header metadata information (currently supports all NRRD files that do not use key/value information but does not support any key/value information).
    • nrrdSaveWithMetadata.m - a MATLAB help file, which can be used within MATLAB by typing "help nrrdSaveWithMetadata"
    • nrrdSaveWithMetadata.mexglx/.mexw32 - precompiled 32-bit functions (may not work for you until you recompile with the compilethis.m script).
    • MATLABSlicerExampleModule.m - This is the MATLAB script which actually processes the data. This is the part that can be replaced with your MATLAB script.

To try this out, DO THE FOLLOWING (Linux only):

  • Make sure you have tclsh installed
  • Download the zip file above
  • Edit compilethis.m (follow the instructions inside the file)
  • Edit CLI-shell.sh (follow the instructions inside the file)
  • Add the path in Slicer3 to point to this module: View->Application Settings->Module Settings->Add a preset
  • Close Slicer3 and Reopen Slicer3
  • Slicer3 will autodetect the example MATLAB module
  • Load in some data
  • Select the example module, set the two inputs and the two outputs, and press "Apply"
  • If there are errors, it is likely due to messed up paths in your CLI-shell.sh script.

Key Investigators

  • Georgia Tech: John Melonakos, Yi Gao, Allen Tannenbaum
  • Isomics: Steve Pieper
  • BWH: C-F Westin, Gordon Kindlmann