Tuesday 1 July 2014

GannetMask for Philips:beta version on github

We've been working on GannetMask and GannetCoRegister, tools for locating the MRS voxel within a structural image. In the first instance, we are releasing the code for Philips data, but
we are working on getting this code straight for GE and Siemens data as well.  Over the last eight years, I've tried to put code like this together at least two other times, investing weeks without success, so I am excited to have finally cracked it.  A big thanks to Paul Mullins for letting us look over his code - the big change that has made us successful this time around is to follow Paul's roadmap of letting SPM tools figure out the spatial location of each image pixel, and defining the MRS voxel by the coordinates of its corners.  You end up with far fewer painful coordinate-frame-changes to get wrong!
The github repository https://github.com/cjohnevans/Gannet2.0 has our current working versions of this code, although it is still evolving daily, as we run further tests.

Overview
We have developed two approaches for co-registering an MRS voxel to a T1 structural image: GannetMask and GannetCoRegister.  They allow a binary mask of the MRS voxel location to be created with the same geometry as the T1 image.  GannetMask is a stand-alone tool that will output a voxel mask image for a given pair of MRS and image files.  It can be used manually.  GannetCoRegister incorporates GannetMask into the Gannet workflow, generating a series of voxel masks for each of a batch of MRS files that have been processed with GannetLoad.

Requirements
1.     MRS .spar files
These tools rely upon MRS data output as .spar files.  Since MRS data processing performs better with .data filetype (which does not store location information), we strongly recommend exporting .sdat AND .data files.
2.      T1 .nii images
T1 (or other contrast) images must be exported from the scanner in .nii format, using the nii option, not the FSL nii option.
3.      SPM8  installation
GannetMask makes use of SPM to interpret the .nii header and calculate the 3D spatial coordinates of each image pixel. SPM is also useful for segmentation of T1 images to determine voxel fractions of gray and white matter, and CSF.  SPM 8 can be downloded from http://www.fil.ion.ucl.ac.uk/spm/software/spm8/.

GannetMask
GannetMask can be run from the matlab command line using:
GannetMask('MRS_file.spar','imagefile.nii');
From a directory which contains the MRS_file.spar and image_file.nii.  GannetMask will save a file MRS_file_mask.nii in the same directory.

GannetCoRegister
GannetCoRegister is run from the command line after GannetLoad. 
MRS_struct = GannetLoad({'MRS_file1.sdat' });
MRS_struct = GannetCoRegister(MRS_struct, {'image1.nii’});
If a batch is being run, .nii image files are input to GannetCoRegister in the same way as the original files are input to GannetLoad (i.e. as a cell array of filenames).
MRS_struct = GannetLoad({'MRS_file1.sdat' 'MRS_file2.sdat'});
MRS_struct = GannetCoRegister(MRS_struct, {'image1.nii’ 'image2.nii'});
GannetCoRegister outputs one MRS_file1_mask.nii for each MRS dataset.  It also saves a pdf image of the voxel overlaid on a 3-plane view of the image at planes that transect the voxel.

1 comment:

  1. Fine method of telling, and enjoyable article to acquire factual statements. Dino Gomez

    ReplyDelete