Running a GSH-edited MEGA-PRESS dataset through Gannet 3.0

We have improved the data processing and quantification routines for GSH-edited MEGA-PRESS data in Gannet 3.0. Here is a quick "getting started" tutorial on running a GSH-edited MEGA-PRESS dataset:

  1. Download Gannet 3.0, placing the master folder at the top of your MATLAB's search path.
  2. Open GannetPreInitialise.m.
  3. Set to 'GSH' (MRS_struct.p.target2 can be ignored).
  4. Set MRS_struct.p.ONOFForder to 'offfirst' or 'onfirst' depending on the order of the ON/OFF editing pulses in your MEGA-PRESS acquisition (typically this should be 'offfirst' for Philips data and 'onfirst' for GE/Siemens data).
  5. Set MRS_struct.p.water_removal to 1 (this is the default) to remove residual water in the difference spectrum.
  6. Set MRS_struct.p.AlignTo to 'SpecRegHERMES'. (We recently published a novel frequency-and-phase correction algorithm for multiplexed edited MRS data [1]; this method also works well with GSH-edited data and is recommended.)
  7. Set MRS_struct.p.GSH_model to 'SixGauss' (recommended for long-TE MEGA-PRESS data).
  8. Save your changes.
  9. Change your working directory to where your GSH dataset is saved.
  10. To run GannetLoad on:
    1. GE data, run: MRS = GannetLoad({'GSH_MEGA_1.7'});
    2. Philips SDAT data (no water reference), run: MRS = GannetLoad({'GSH_MEGA_1_act.sdat'});
    3. Philips SDAT data (with water reference), run: MRS = GannetLoad({'GSH_MEGA_1_act.sdat'}, {'GSH_MEGA_1_ref.sdat'});
    4. Philips .data files (no water reference), run: MRS = GannetLoad({''});
    5. Philips .data files (with water reference), run: MRS = GannetLoad({''}, {''});
    6. Siemens .rda data (no water reference), run: MRS = GannetLoad({'GSH_MEGA_1_ON.rda', 'GSH_MEGA_1_OFF.rda'});
    7. Siemens .rda data (with water reference), run: MRS = GannetLoad({'GSH_MEGA_1_ON.rda', 'GSH_MEGA_1_OFF.rda'},{'GSH_MEGA_1_water.rda'});
    8. Siemens TWIX data (no water reference), run: MRS = GannetLoad({'GSH_MEGA_1_metab.dat'});
    9. Siemens TWIX data (with water reference), run: MRS = GannetLoad({'GSH_MEGA_1_metab.dat'}, {'GSH_MEGA_1_water.dat'});
  11. Then run GannetFit: MRS = GannetFit(MRS);


1. Mikkelsen M, Saleh MG, Near J, et al. Frequency and phase correction for multiplexed edited MRS of GABA and glutathione. Magn. Reson. Med. 2017;0:1–8. doi: 10.1002/mrm.27027.

Running a HERMES dataset through Gannet 3.0

One of the new features of Gannet 3.0 is the ability to process and quantify edited MRS data acquired by HERMES (1–3). Here is a quick "getting started" tutorial on running a GABA-/GSH-edited HERMES dataset:

  1. Download Gannet 3.0, placing the master folder at the top of your MATLAB's search path.
  2. Open GannetPreInitialise.m.
  3. Set to 'GABAGlx' and MRS_struct.p.target2 to 'GSH' (these are the defaults).
  4. Set MRS_struct.p.ONOFForder to 'offfirst' if running a Philips HERMES dataset, or 'onfirst' if running a GE HERMES dataset.
  5. Set MRS_struct.p.water_removal to 1 (this is the default).
  6. Set MRS_struct.p.AlignTo to 'SpecRegHERMES'.
  7. Set MRS_struct.p.HERMES to 1.
  8. Save your changes.
  9. Change your working directory to where your HERMES dataset is saved.
  10. To run GannetLoad on:
    1. GE data, run: MRS = GannetLoad({'HERMES_1.7'});
    2. Philips data (with a water reference), run MRS = GannetLoad({'HERMES_1_act.sdat'},{'HERMES_1_ref.sdat'});
  11. Then run GannetFit: MRS = GannetFit(MRS);


1. Chan KL, Puts NAJ, Schär M, Barker PB, Edden RAE. HERMES: Hadamard encoding and reconstruction of MEGA-edited spectroscopy. Magn. Reson. Med. 2016;76:11–19. doi: 10.1002/mrm.26233.

2. Saleh MG, Oeltzschner G, Chan KL, Puts NAJ, Mikkelsen M, Schär M, Harris AD, Edden RAE. Simultaneous edited MRS of GABA and glutathione. NeuroImage 2016;142:576–582. doi: 10.1016/j.neuroimage.2016.07.056.

3. Chan KL, Saleh MG, Oeltzschner G, Barker PB, Edden RAE. Simultaneous measurement of Aspartate, NAA, and NAAG using HERMES spectral editing at 3 Tesla. NeuroImage 2017;155:587–593. doi: 10.1016/j.neuroimage.2017.04.043.

Gannet 3.0 released

Introducing Gannet 3.0! This new version includes a number of new data processing features (incl. handling of HERMES data), a revamped output MATLAB structure, slight improvements in speed and efficiency and many other changes and bug fixes.

Gannet 3.0 is available for immediate download at the following link:

Release notes:


+ Added new puffin logo
+ Changes to output structure to accommodate multi-metabolite and multi-voxel datasets
+ Removed unused/redundant lines of code throughout Gannet
+ Removed historical/unused .m files in Gannet folder
+ Optimized code where possible, e.g.:
    - Removing loops and vectorizing instead
    - Simplifying code, e.g., using one-line logical indexing for frequency ranges
    - Pre-allocating memory by setting up variables with zeros
    - Removed ‘convergence’ loop in metabolite signal fitting (should be enough to first run lsqcurvefit followed by nlinfit with high enough max iterations/low enough tolerances)
+ A number of updates to ‘PhilipsRead.m’, ‘GERead.m’ and ‘SiemensTwixRead.m’, e.g.:
    - Almost all acquisition parameters now parsed from the header
    - For P-files and TWIX data, coil combination/pre-phasing is performed by signal-weighting method using unsuppressed water data (when available)
    - Complete revamping of ’SiemensTwixRead.m’; automatic determination of MEGA-PRESS sequence type and scanner software version; removed this parameter from ‘GannetPreInitialise.m’
    - For Philips HERMES data, only the averages where editing pulses do not affect residual water are used for pre-phasing (currently geared towards GABA-/GSH-edited data)
+ Added support for DICOM MRS data files
+ Added functions to de-identify GE P-files, Philips SDAT/SPAR files and Siemens TWIX files
+ SPM segmentation now called by either ‘CallSPM8segmentation.m’ or ‘CallSPM12segmentation.m’ depending on which version of SPM is installed

+ Data are now zero-filled to obtain a nominal spectral resolution of 0.061 Hz/point by default (to handle acquisitions with number of data points/spectral width other than 2048/2000 Hz); removed this parameter from ‘GannetPreInitialise.m’
+ HSVD water filter is applied to both GABA-/GSH-edited HERMES data, and to both pre- and post-aligned DIFF spectra
+ For filtered HERMES data, baseline correction performed by demeaning (real) signal between 9 and 10 ppm

+ Now only first n points of FIDs used for registration, where n is the last point where SNR > 3
+ By default, median across data points of all transients is used as the reference ‘FID’
+ Frequency/phase offset estimates now saved for each processed dataset
+ Transients are now rejected if their respective standardized mean square error (from the nonlinear regression routine) exceeds +/-3 stds.
+ Added ‘Spectral_Registration_HERMES.m’ for frequency/phase correction of HERMES data

+ GABA+Glx model fitting now performed by weighted nonlinear regression, where observation weights are supplied in nlinfit to down-weight any Cho subtraction artifact and (for HERMES data only) co-edited(?) signals downfield of 3.7 ppm Glx signal (thanks to Alex Craven of University of Bergen for this idea)
+ Added fitting of residual water in MEGA-PRESS data to calculate water suppression factor
+ Added fitting of NAA signal in OFF spectrum


+ Lots of minor bug fixes
+ Renamed module output folders to ‘Gannet*_output’ (e.g., ‘GannetLoad_output’)
+ Renamed module output PDFs to ‘<filename>_*.pdf’ (e.g., ‘S01_GABA_load.pdf*)
+ Text in output figures aligned more cleanly
+ Addressed MATLAB warnings
+ Made code easier to read/understand by indenting lines and adding a header comment here and there at beginning of processing steps
+ Optimization options for lsqcurvefit and nlinfit now set consistently throughout Gannet
+ Renamed some variables for the sake of consistency
+ Output figures now open in center of screen regardless of screen resolution (figure pixel dimensions are fixed, however)
+ When batch-processing, each output figure is cleared rather than closed all together
+ Some useful acquisition parameters (e.g., edit pulse frequencies) are parsed from the data file headers (and saved in vendor-specific fields) where available

+ Fixed ON/OFF indices for GABA-/GSH-edited HERMES data (for ‘offfirst’ only); assumes ‘C B A D’ as per NeuroImage paper
+ Color of pre-/post-alignment spectra now fixed to red/blue regardless of user’s MATLAB version
+ Post-alignment spectra always plotted second so that they are displayed in the foreground (this is helpful for HERMES data)
+ Renamed ‘SiemensRead_RE.m’ to ‘SiemensRead.m’
+ Renamed ‘Gannetplotprepostalign.m’ to ‘GannetPlotPrePostAlign.m’

+ Water-scaled ON and OFF spectra now saved along with water-scaled DIFF spectrum
+ Models always plotted second so that they are displayed in the foreground
+ Renamed ‘GaussModel_area’, ‘GABAGlxModel_area’, etc. to ‘GaussModel’, GABAGlxModel’, etc.
+ Renamed ‘MRSGABAinstunits’ to ‘CalcInstUnits’
+ Improved quantification of lactate

Thoughts on the GABA MRS symposium from James Prisciandaro, Ph.D., Assistant Professor at MUSC

"The Bi-Annual International GABA MRS Symposium has quickly become my favorite meeting. Though a rapidly growing field, proton MRS remains largely underrepresented at professional conferences. The GABA MRS Symposium has allowed me to keep up on the latest methods, present my findings to leaders in the field, and form and maintain collaborative relationships that otherwise would not have been possible. I look forward to the next meeting!"

Editing Glutathione

Over the last year, we have been expanding our horizons to editing things that aren't GABA.  Probably the next most popular editing target is glutathione (GSH), so I thought I'd post some thoughts about how to take a GABA scan and modify it to edit GSH.

Editing Frequencies

To address the most obvious change first, the editing-on frequency changes from 1.9 ppm for GABA to 4.56 ppm for GSH (based on shifts from Govindaraju et al.).  The editing-off frequency is less critical, but putting it at 8 ppm seems safe.

Echo time

The least obvious issue to resolve is echo time, which we recently wrote a paper about (Chan et al. 2017, the subject of a recent MRM piece). To cut a long story short, it doesn't make a lot of difference whether you stick with medium-TE (~70 ms) or go longer (~120 ms), although the longer TE is slightly better (and certainly expected to be better).  Longer TE also has secondary advantages, like accommodating longer more selective editing pulses or longer, higher-bandwidth refocusing pulses.  But beware, some editing implementations e.g. the Siemens WIP, don't move the editing pulses when you increase TE, so it is impossible to edit well at longer TEs.  


Another important consideration, if you are planning a GSH editing study, is that it is now possible to edit GABA and GSH in the same scan without substantially impacting SNR (Saleh et al. 2016).  So if you're planning to edit GSH, why not edit GABA too?


Gannet performs post-processing frequency-and-phase correction of data to minimize subtraction artefacts due to motion and scanner drift.  For simple GSH editing, the 'NAA' alignment works pretty well. ('SpecReg' fails due to editing pulses impacting water). For HERMES, we have a new Gannet version in progress.

Hackathon Live Update Stream

Non-Live webcam feed!

Non-Live webcam feed!

455PM: A quick summary: We haven't come up with a method that makes things better. BUT, we have learned several important things:

1. NAA-based correction can do a lot to clean up the GSH-diff spectrum. 

2. Metrics matter.  By taken a mean 'quality score', we shot ourselves in the foot. We will reassess all data based on median, and maybe normalized by the group average SD subtraction artifacts, not within-subject... 

255PM: Bumped out of the large conference room.

1239PM: In terms of actual progress. We have tested 6 methods. None of them do very well. Onwards and upwards!

1200PM: Pizza arrives as ably planned by Mark (picking up from the organizational travesty that was Nick's lunch arrangement).  

933AM: Donutgate: the number of declared donuts doesn't match the number of eats donuts.

930AM: Donut scores: Georg 2 Nick 2 Richard 2 Ashley 1 Muhammad 0 Tao 1 Kim 1 Mark 1

922AM: Nick just left the room. Minus 70 Edden points.

920: Pretend to set up a live webcam feed.

905AM: Preliminary chat over.  Repositories forked and coding has begun. 

840AM: Skype to Jamie Near in Canada.

755AM: Room setup. Do we have enough extension leads? 

730AM: Dunkin' Donuts stop for fuel.

559AM: I remembered to grab my charged-overnight laptop on the way out of the house. A good start.

Frequency Correction Hackathon February 23 2015

The alignment of editing-ON and editing-OFF scans is an issue for all J-difference-edited MRS, but especially for HERMES editing, where at least four sub-experiments (with different signal characteristics) must be aligned.  

We are going to be taking a shotgun approach to improving frequency-and-phase correction for HERMES.  Tomorrow, we will focus on HERMES of GABA and GSH, trialling a (hopefully large) number of methods on 4x10 subjects in vivo data (collected at three sites) and simulated data.  We will implement the best method(s) in Gannet and hope to publish the results soon after.