Use of "AverageAllDatasetsAlongExtra" to average unedited STEAM data

I’m trying to average two runs of spectra from the same session, acquired back-to-back, using STEAM unedited sequence. I think the built-in function “osp_AverageAllDatasetsAlongExtra” should do this, but I somehow can’t get it to work the way I was expecting.

First, I’ve created job file using GUI, with the first file to start with. Then, I’m attempting to use:
MRSCont = OspreyJob(‘OspreyJob_Merge_1-2.json’);
% add second file to the MRSCont
MRSCont.files={{‘1.rda’},{‘2.rda’}};
MRSCont = OspreyLoad(MRSCont);
% → Loading raw data from dataset 2 out of 2 total datasets…
MRSCont = OspreyProcess(MRSCont);
% → Processing data from dataset 2 out of 2 total datasets…
MRSCont = osp_AverageAllDatasetsAlongExtra(MRSCont);
MRSCont = OspreyFit(MRSCont);
% → Fitting metabolite spectra from dataset 2 out of 2 total datasets…

In the fitting step, I was expecting to only have one dataset, but it still has 2, and it the GUI, there two spectra shown, not an average of the 2. Any idea what am I missing?

Hi @peter,

I haven’t actually tried to generate a multiple files per subject scenario for the GUI job generator. I’ll take a look at this when I have time.

In the mean time, you could try setting the jobfile up as .m file. There is an example in the .../osprey/exampledata/sdat/MEGA/jobSDAT_MEGA_Multidataset.m file and also some more discussion here (4 MRS acquisitions per session in IMA format - #3 by Remy).

Let me know if this works for you.

Best,
Helge

Thanks Helge,
I actually have found that topic and that’s where I got the inspiration from. I only used the GUI to get me started, but perhaps I just need to create the MRSCont from scratch “manually” (as per the example data job, which I have looked at as well). I thought my change of input files via MRSCont.files={{‘1.rda’},{‘2.rda’}}; would do the trick…