Wednesday, 9 July 2014

GannetCoRegister Outputs

GannetCoRegister is up-and-running for GE and Philips datasets.  Voxel placements seem to agree with screenshots of the prescription, and further comment from testing elsewhere is welcomed.  The new workflow runs: GannetLoad; GannetCoRegister; GannetFit.  Each of the three modules saves a pdf output - GannetCoRegister's reports the voxel location and geometrical parameters.

One frame of the 3-plane output is now also incorporated into the GannetFit output.

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 has our current working versions of this code, although it is still evolving daily, as we run further tests.

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.

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

GannetMask can be run from the matlab command line using:
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 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.