Gannet & SIemens TWIX -> MatLab freeze

I’ve tried processing a Siemens TWIX file collected with HERMES. After running GannetLoad, MatLab 2023a usually freezes several times after the message "Averaging subspectra using weighted averaging and peforming subtraction…’ (the graphs are displayed). Once, it ran to completion. The time GannetLoad and produce a pdf, i tried GannetFit, which then led to MatLab freezing after the first message.

Any suggestions? I’m using a MacBook Pro M2 2021 with 64GB RAM.

Hi @johnbrks,

This is quite peculiar. I develop Gannet on a MacBook Pro M1 2020 in MATLAB 2023a and have not encountered this problem before (even with previous MATLAB versions).

Could you copy-paste your GannetPreInitialise.m settings?

Also, does any other script/code you use in MATLAB lead to it freezing?


Also, which version of Gannet are you using?

i’m running gannet 3.3.1. i’ve not had anything else freeze matlab. here’s the preinitialise. I’m new to gannet so I may have made an error…
i’ve tried it with water removal on and off. it did run once.

function MRS_struct = GannetPreInitialise(MRS_struct)

% Acquisition parameters = {‘GABAGlx’,‘GSH’}; % Edited metabolite(s) of interest; permitted options are:
% {‘GABA’}, {‘GABAGlx’}, {‘GSH’}, {‘Lac’}, or {‘EtOH’}
% {‘GABAGlx’,‘GSH’}, {‘Lac’,‘GSH’}, or {‘EtOH’,‘GABA’,‘GSH’}
% {‘GABAGlx’,‘GSH’}
% If phantom data:
% and MEGA-PRESS: {‘GABA’}, {‘Glx’}, {‘GSH’}, {‘Lac’}, or {‘EtOH’}
% and HERMES: {‘GABA’,‘GSH’}, {‘Glx’,‘GSH’}, {‘Lac’,‘GSH’}, or {‘EtOH’,‘GABA’,‘GSH’}
MRS_struct.p.seqorig = ‘JHU’; % Origin of Philips MEGA-PRESS or GE HERMES sequences;
% options are ‘JHU’ or ‘Philips’ if Philips, or ‘Lythgoe’ if GE (for HERMES only)

% Analysis parameters
MRS_struct.p.LB = 3; % Exponential line-broadening (in Hz)
MRS_struct.p.water_ECC = 1; % 1 = YES, perform eddy current correction on water data
MRS_struct.p.metab_ECC = 0; % 1 = YES, perform eddy current correction on metabolite data (requires a water reference)
MRS_struct.p.water_removal = 0; % 1 = YES, remove residual water signal in DIFF spectrum using HSVD
MRS_struct.p.alignment = ‘SpecRegHERMES’; % Alignment method; options are ‘RobustSpecReg’ (recommended), ‘SpecReg’, ‘SpecRegHERMES’,
% ‘Cr’, ‘Cho’, ‘NAA’, ‘H2O’, ‘CrOFF’, or ‘none’ (recommended for phantom data)
MRS_struct.p.use_prealign_ref = 0; % 1 = YES; in some cases, using RobustSpecReg to align HERMES/HERCULES data can result in
% worse alignment compared to the pre-aligned data; setting this parameter to 1 will
% make RobustSpecReg use the averaged pre-aligned subspectra as references to align the
% averaged post-aligned subspectra, which may improve the final alignment
MRS_struct.p.vox = {‘vox1’}; % For naming voxels in PRIAM data, e.g. {‘anterior’,‘posterior’}, {‘right’,‘left’}, etc.
MRS_struct.p.fit_resid_water = 0; % 1 = YES, fit the residual water signal in the OFF spectrum to calculate a water suppression factor
MRS_struct.p.weighted_averaging = 1; % 1 = YES, average subspectra using weighted averaging

% Flags(0 = NO; 1 = YES)
MRS_struct.p.HERMES = 1; % Data acquired using HERMES
MRS_struct.p.HERCULES = 0; % Data acquired using HERCULES; if 1, MRS_struct.p.HERMES must be set to 1 as well
MRS_struct.p.PRIAM = 0; % Data acquired using PRIAM
MRS_struct.p.phantom = 0; % Data are from a phantom (assumes phantom was scanned at room temperature)
MRS_struct.p.join = 0; % Join multiple files (this can be batched across subjects)
MRS_struct.p.mat = 0; % Save MRS_struct as a .mat file
MRS_struct.p.csv = 0; % Extract useful data from MRS_struct and export them to a .csv file (applies to GannetFit,
% GannetSegment and GannetQuantify)
MRS_struct.p.append = 0; % Append PDF outputs into one PDF (separately for each module) (requires export_fig in the Gannet
% directory to be added to the search path and Ghostscript to be installed)
MRS_struct.p.hide = 0; % Do not display output figures


What kind of data are you trying to process? What is the file size?

It’s a Siemen’s TWIX file of an anterior cingulate voxel (30x40x20) with 384 avgs. The file is 439MB.

The one time Load ran to completion, the output looked fine and the pdf was saved. The displayed output from Fit looked fine, but Fit froze.

Are you able to share your data? My email is

You can de-identify the file using the TWIXDeIdentify function in Gannet.

Hi Mark,
just checking to see if you got the link to the file I sent. I can re-send if necessary.

Hi John,

I emailed you a reply on April 1st. Please let me know if you didn’t receive it.


Hi Mark
I don’t seem to have gotten it. I checked my spam folder as well…
Would you mind re-sending?