Error when loading Philips HERMES data

Hi Georg and Helge,

Trying the latest version of Osprey (2.3.0) on some Philips HERMES data.
Using the GUI to create a Job file. (Job file seems fine)
Then using the GUI to work through the data, and can only get as far as load data before it comes unstuck.

The data starts to load, and displays the raw data, and then starts to display the water files, and then hangs with this error:

Error using matlab.graphics.axis.Axes/set
Error occurred while moving node between canvases.

Error in osp_plotModule (line 288)
set( ViewAxes, ‘Parent’, Plot );

Error in osp_plotAllPDF (line 39)
osp_plotModule(MRSCont, ‘OspreyLoad’, kk,[1 1], ‘ref’);

Error in OspreyLoad (line 331)
osp_plotAllPDF(MRSCont, ‘OspreyLoad’)

Error in osp_onLoad (line 34)
MRSCont = OspreyLoad(MRSCont);

Error while evaluating UIControl Callback.

I am on a Macbook pro, running Montery, with Matlab 2021b.
Any ideas or help appreciated.
Paul.

So, managed to solve this error - I had set the save pdf option in the job file, and that seems to be what broke it. creating a new job file, without that option, and it seems to be working.

Well, I managed to proces the fiels at least. On attempting to model (fit) the data I then get these errors:

Index in position 3 exceeds array bounds. Index must not exceed 3.

Error in osp_plotFit (line 179)
basisSet = MRSCont.fit.resBasisSet.([which_spec]).([‘np_sw_’ num2str(round(dataToPlot.sz(1))) ‘_’ num2str(round(dataToPlot.spectralwidth))]){VoxelIndex(3),1,VoxelIndex(2)};

Error in osp_iniFitWindow (line 670)
temp = osp_plotFit(MRSCont, gui.controls.Selected,gui.fit.Style,[gui.controls.act_x gui.controls.act_y gui.controls.act_z],gui.fit.Names{t});

Error in osp_onFit (line 103)
osp_iniFitWindow(gui);

Error while evaluating UIControl Callback.

It seems to be more an error in the display. If I use the arrows to shuffle through the different subspectra fits, a popup window appears for each one, and the fits look reasonable. However, while the GUI allows me to then do the coregistration and segmentation steps, it won’t allow me to quantify - probably because somehting went wrong with the modeling of the data? A Bug? Or user error?

The job file is below:

{

“seqType”: “HERMES”,

“editTarget”: [“GABA”,“GSH”],

“dataScenario”: “invivo”,

“MM3coModel”: “3to2MM”,

“FWHMMM3co”: “”,

“SpecReg”: “RobSpecReg”,

“SubSpecAlignment”: “L2Norm”,

“UnstableWater”: “0”,

“saveLCM”: “1”,

“savejMRUI”: “1”,

“saveVendor”: “0”,

“saveNII”: “0”,

“savePDF”: “0”,

“method”: “Osprey”,

“ECCmetab”: “0”,

“ECCmm”: “0”,

“includeMetabs”: [“default”],

“style”: “Separate”,

“lolim_range”: “0.2”,

“uplim_range”: “4.0”,

“lolim_rangew”: “2.0”,

“uplim_rangew”: “7.4”,

“bLineKnotSpace”: “0.4”,

“fitMM”: “1”,

“files”: ["/Users/pss628/Scratch/SS0101/OneDrive_3_30-06-2022/sub-SS0101-01/ses-01/SS0101_01_WIP_HERMES_ACC_3_2_raw_act.SDAT"],

“files_ref”: ["/Users/pss628/Scratch/SS0101/OneDrive_3_30-06-2022/sub-SS0101-01/ses-01/SS0101_01_WIP_HERMES_ACC_3_2_raw_ref.SDAT"],

“files_nii”: ["/Users/pss628/Scratch/SS0101/OneDrive_3_30-06-2022/sub-SS0101-01/ses-01/sub-SS0101-01_ses-01_acq-T1W.nii.gz"],

“file_stat”: [""],

“outputFolder”: ["/Users/pss628/Scratch/SS0101/OneDrive_3_30-06-2022/sub-SS0101-01/ses-01"]

}

Hi @PGMM,

Thanks for reaching out. I’ll take a look at this ASAP.

Have you tried to run all the commands through the command window or the OSpreyRunJob function and call the GUI afterwards like this:

MRSCOnt = RunOspreyJob(‘jobFile.json’)
OspreyGUI(MRSCont)

I’ll try to solve the (I assume) bug in the meantime. It looks to me as if this is purely visual

Helge

Hi @Helge ,
command line worked, and loading the container showed all the results. I am a bit concerned that the GABA conc seem high in this one scan (3.89 alpha corrected) so will try running a few others to see what we are getting.

Paul.

Hi @Helge,
I have been working with some students to run several HERMES data sets through Osprey, and we have found a few interesting wrinkles/bugs.

First one - when using the GUI to create a job file on my Mac (Macbook pro 2019, Quad-Core Intel Core i5, running Monterey. Using Matlab 2021b, and Osprey 2.3) for more than 1 file the job file created has extra spaces after tseveral of the file paths in the Job file list before closing the quotation marks. So for example:

“files”: ["/Path/To/Files/sub-01/ses-01/sub-01_ses-01_ROI-01_act.SDAT "
"/Path/To/Files/Sub-01/Ses-01/sub-01_ses-01_ROI-02_act.SDAT "
…],
This also happens for the water reference files, but interestingly, not for the T1 anatomical image files.

I got around this by editing the jobfiles in Matlab, but thought you guys might want to be aware of it, incase others get the same problem.

Then my students had a different problem. One is running Osprey 2.3 in Matlab on a windows machine (I don’t know the specifics sorry, but it’s likely Matlab 2022a or 2022b as they just installed Matlab). When this student used the GUI to crete a job file, the file paths were created using “” instead of “/” for the file paths. So:

“files”: [‘D:\Path\To\Files\sub-01\ses-01\sub-01_ses-01_ROI-01_act.SDAT’
‘D:\Path\To\Files\Sub-01\Ses-01\sub-01_ses-01_ROI-02_act.SDAT’
…],

Instead of

“files”: [‘D:/Path/To/Files/Sub-01/Ses-01/sub-01_ses-01_ROI-01_act.SDAT’
‘D:/Path/To/Files/Sub-01/Ses-01/sub-01_ses-01_ROI-02_act.SDAT’
…],

Editing the job file to the above (‘D/Path/To/…’) fixed the issue and the student could then use the job file to run the data using:

MRSCont = RunOspreyJob('OspreyJob.m)

Which ran all the way through fitting the data, segmenting etc (as seen by the results turing up in the output folder) but it gave an error

Error using mkdir
The filename, directory name, or volume label syntax is incorrect.

Error in OspreyHTMLReport (line 49)
mkdir(outputFigures);

Error in RunOspreyJob (line 58)
[MRSCont] = OspreyHTMLReport(MRSCont,kk);

and no MRSCont was made in the workspace. I’ll try to have a dig into the actual job file that was created to see if there is some hint there, but any advice or ideas appreciated.

Cheers
Paul.

Hi @PGMM,

thanks for the detailed info.

I’ll take a look at the GUI generated jobfiles to figure out what is going on. Quite possible, that we have missed something because the debug and testing are based on the automated jobfiles.m in the exampledata folder. I’d highly recommend using those instead of the IMO painful GUI drag-and-drop click marathon. Especially, as you are using BIDS conform data structure you should be able to save a lot of time by setting up a similar job.m file for your project which will then automatically loop through the data structure.

About the second issues your student reported. I don’t think that this is related to MATLAB (I’m using R2022a). This is most likely linked to the different file separator in windows compared to UNIX filesystems. I’ll look into that with my windows laptop.

Best,
Helge

p.s. cheers for pointing out the “automatic” job files in the example data - very useful as I was just thinking how best to automate listing the data files for the job files. I will have to modify these a bit, but looks pretty straight forward.

Yes - this is indeed way more convenient.

Quick interim update:
I’ve just uploaded a fix and the opts.savePDF = 1 option should work fine now.

I’ll look into the issue with the HTML report for windows machines ASAP.

Hi @Helge, more robust “idiot proof” testing going on here.

I have set up a multi-dataset job file ala the example in exampledata as suggested, and am running it now.
First error experienced seemed to be related to having the save pdf file option to 1

Error using matlab.graphics.axis.Axes/set
Error occurred while moving node between canvases.

Error in osp_plotModule (line 288)
set( ViewAxes, ‘Parent’, Plot );

Error in osp_plotAllPDF (line 39)
osp_plotModule(MRSCont, ‘OspreyLoad’, kk,[1 1], ‘ref’);

Error in OspreyLoad (line 331)
osp_plotAllPDF(MRSCont, ‘OspreyLoad’)

Error in RunOspreyJob (line 30)
MRSCont = OspreyLoad(MRSCont);

I think its related to the pdf option as once set to 0, that error went away, but I got another error

Error using /
Matrix dimensions must agree.

Error in io_writesdatspar (line 174)
fprintf(fid,‘spec_col_upper_val : %4.6f\n’, -in.spectralwidth/2 + in.sz(1)/in.spectralwidth);

Error in osp_saveVendor>@(in,outfile)io_writesdatspar(in,outfile) (line 49)
outputFunction = @(in,outfile) io_writesdatspar(in,outfile);

Error in osp_saveVendor (line 101)
RF = outputFunction(op_takesubspec(MRSCont.processed.metab{kk},1),outfileA);

Error in OspreyProcess (line 775)
[MRSCont] = osp_saveVendor(MRSCont);

Error in RunOspreyJob (line 32)
MRSCont = OspreyProcess(MRSCont);

which I assume is related to the save vendor option, so I have turned that to 0 as well and will see what happens. Just reporting these errors so you have a log of when they get out into the wild. I’m using opsrey 2.3.0 (I’ll check that it is the latest latest verison using github once the current job either runs or crashes!).

Paul.

So, crashed again - this time looks to be because of the save nifti option. Trying again with that switched off.

Error using io_writeniimrs (line 47)
Need InNames for additional dimensions

Error in osp_saveNII (line 83)
RF = outputFunction(op_takesubspec(MRSCont.processed.metab{kk},1),outfileA);

Error in OspreyProcess (line 780)
[MRSCont] = osp_saveNII(MRSCont);

Error in RunOspreyJob (line 32)
MRSCont = OspreyProcess(MRSCont);

Paul.

P.S. happy to attach my job file if it might be of help.

Hi @PGMM,

Thanks for helping make Osprey “idiot proof” :wink:

About your issues:

  1. I was pretty sure that the savePDF options should work fine now. Did you download from the recent develop-branch?
    2./3. Could you attach your jobfile and maybe the script/order of comments you ran.

Helge

Will do,

a few more idiot errors

turning off most save options at least got me past processing data, but fitting then fell over:

… done.
Elapsed time 864.805077 seconds
Timestamp July 12, 2022 16:39:10 Osprey 2.3.0 OspreyFit
Fitting metabolite spectra from dataset 1 out of 9 total datasets…
Index in position 2 exceeds array bounds. Index must not exceed
7.

Error in op_takesubspec (line 44)
fids=in.fids(:,index,:,:,:);

Error in osp_fitHERMES (line 52)
dataToFit = op_takesubspec(MRSCont.processed.metab{kk},‘sum’);

Error in OspreyFit (line 60)
[MRSCont] = osp_fitHERMES(MRSCont);

Error in RunOspreyJob (line 34)
MRSCont = OspreyFit(MRSCont);

Job file attached (saved as a .txt file to allow upload).

jobSDAT_hermes_Multidataset.txt (17.5 KB)

command run as

RunOspreyJob(‘jobSDAT_hermes_Multidataset.m’)

If I need to be doing something a bit more subtle, let me know.
Paul.

P.S. as a wise man once said - “a common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools”

2 Likes