Loading Siemens Twix with multiple measurements and averages


I have twix MRS .dat data with Measurements and Averages that cause an error when loading data in Osprey.

MRSCont.raw{1,1}.fids has 3 dimension, Npts, Navg, Nmeas
I temporary solved this by reshaping MRSCont.raw.fids/.specs to the expected 2 dimensional array with the 2nd dimension = Navg*Nmeas
plus re-setting MRSCont.raw{1, 1}.averages and MRSCont.raw{1, 1}.rawAverages
before resaving MRSCont.

In this way I can Load data ok,
but then it still fails on Preprocessing as raw.dims.extras is greater than 0 (3 in my case) (see error below)

Would you be able to fix the loading of the data and combine measurements and averages, so all flags (such as ‘extras’) are set correctly?

Happy to share a sample dataset,


Error using op_phaseCrCho (line 37)
ERROR: Can not operate on data with extras dimension! ABORTING!!

Error in op_measureDrift (line 46)
[in,~] = op_phaseCrCho(in, 1);

Error in op_robustSpecReg (line 63)
driftPre = op_measureDrift(in);

Error in osp_processUnEdited (line 104)
[raw, fs, phs, weights, driftPre, driftPost] = op_robustSpecReg(raw,
‘unedited’, 0,refShift_ind_ini); % Align and average

Error in OspreyProcess (line 42)
[MRSCont] = osp_processUnEdited(MRSCont);

Error in osp_onProc (line 35)
MRSCont = OspreyProcess(MRSCont);

Error while evaluating UIControl Callback.

Hi Enrico,

What kind of sequence is this? I’m sure we can make this work, we already internally have a lot of differentiating statements in the Twix loader, but it’s likely there’s a flavor it hasn’t encountered yet. Happy to help if you send us an example dataset (please deidentify beforehand).


Hi Enrico,

I’ve fixed the issue and can load your data now, but I’ve stumbled over a first-order phase shift, likely because our TWIX loader doesn’t know which field to look into for the number of points that are sampled before the echo. Have you previously loaded and processed these data yourself? I’m digging through the header as we speak, but it would be good if you had further information.


Found it - this seems to work now:

I’ve just pushed the necessary changes to the develop branch of the Osprey repository - we’ll include these changes in the next release, but feel free to work from that branch.



I have been looking for a solution to loading Siemens Twix data of a combined sLASER-fMRI sequence and this question from @edv came closest, so I am continuing this thread.

I downloaded the newest Osprey release after the solve of the issue mentioned here and I am running into a next one… it is just pilot-data to test the sequence and does not contain very sensible information as of yet, but I cannot load it.
Somehow, Osprey considers my data to have 4 Subspectra of 16 averages instead of 1 with 64 averages and I tried to circumvent it by adapting OspreyLoad.m line 168
for pp = 1:raw.sz(raw.dims.extra) into subSpecs

It then loads (but shows nothing in the GUI) but crashes at Process for exceeding the number of elements.

Any ideas?
Happy to share an example of course!


Hi Jill,

I’ve previously uploaded a fix for Enrico’s problem to the develop branch of the Osprey repository, but we haven’t made a new official release since. Can you just manually clone/download the develop version to see whether it does the trick for you?


Hi Georg,

Sorry, my mistake in wording… I did indeed use the develop version.


We’ll need to figure out the structure/dimensionality of that sequence then. Can you share an example file with us? We’re both tied up in grant submissions and progress reports, so I reckon we might get to it by mid-February.