Some questions and possible bugs

Dear Dr. Oeltzschner and al.,

I am fairly new to MRS, but your software has been of great help for me lately as I started processing data for one of my graduate projects. So far I have worked with Siemens TWIX, DICOM and RDA file formats. Everything has worked very nicely (especially for TWIX data) and I look forward to continue using your software. Below is a list of questions I have, and possible bugs that I have encountered - I’m not sure if this is the best forum for this, so if I need to post somewhere else please do let me know.

  1. I noticed that after the latest update, the ‘Processed’ tab in the GUI is grayed out when loading a MRSCont.mat file of data that has already been processed. This happens after I have gone through all of the processing steps and I want to review the data again or save different pdfs. I can navigate through all the other tabs except for the ‘Processed’ tab (see screenshot below).

  2. When saving pdfs of the ‘Cor/Seg’ tab, the voxel and voxel fraction information does not show up in the pdf. Will this information show if this specific module is plotted independently? Does it need to be saved as a png or jpeg instead?

  3. I used the generated RDA files for fitting and quantification with LCModel and noticed that a lot of the header information is missing, i.e., patient id, sequence description, etc… This doesn’t interfere with the fitting or quantification, but some of title information has to be entered manually.

  4. I tried using the LCModel control files in the output folder and kept getting errors. Is there something I need to change within the control file? Like the paths?

  5. Lastly, is there a feature to import existing LCModel basis sets into Osprey format? I would like to compare some of the fitting and quantification results using Osprey and LCModel for the sLASER sequence.

Thank you and I appreciate any answer you could provide.

-Humberto M.

1 Like

Dear Humberto,

Thank you for your positive feedback and your suggestions. It’s much appreciated.

  1. Can you describe exactly when this is happening. Currently, if you are loading a MRScont.mat file it should be loaded into the GUI and all the modules should which were ran in the previous analysis should automatically be loaded. If you have already loaded and processed your data, these steps will be grayed out in the GUI. If you have added new files into your jobFile.m (You have to attach them to the end of the list) the relevant modules should not be grayed out and you should be able to run them for the new files.
  2. This was a known bug, which was fixed in the most recent update in the develop branch.
  3. All output files created with Osprey are de-identified on purpose. If you are following the recommendations of the Brain Imaging Data Structure initiative you should be able to identify your data by its filename.
  4. This is currently not well documented, but will be described in the next documentation. Here is a short description on how to make this work:

In addition to the .RAW files, Osprey also creates the corresponding .CONTROL files. These files can be used for LCModel batch processing.

for file in /storage/LCModelControlFiles/*;
do /usr/local/.lcmodel/bin/lcmodel < $file;
done 

To create working .CONTROL files you have to specify the following mandatory variables in the osp_lcmcontrol_params() function located in the process folder: key , FILBAS , FOLDER , and DOECC .

key = 0; %Your LCM key goes here
FILBAS = '/storage/myBasisSet_30ms_PRESS.BASIS'; % Location of .BASIS file used in LCModel
FOLDER = '/storage/LCMoutput'; %Output folder (Create this on your linux machine first)
DOECC= 'F'; % No eddy current correction in LCModel as this is already performed in Osprey.

The other parameters are optional and are described in the osp_lcmcontrol_params() function.

  1. The io_LCMBasis() function in the libraries/FID-A/inputOutput folder may be useful for you. It is tested on our .BASIS files. If you have troubles during the process please let us know, as we may need to make some more adaptions on this function. In addition, you may be willing to share your .BASIS file on MRSHub.com (there is a specific folder for basis sets), as this could be useful for other users.

Thanks again for your feedback and please report any other bugs and ideas back to us.

Helge

2 Likes

Hi Humberto,

just quoting the other thread:

Can you give me a bit more details about the basis set and the sequence you are using. Is it an unedited sLASER, because the currently supplied functions are only working for unedited basis sets. If you are able to share the .BASIS files I’d take a look into the import functions and if it works for me.

Hi Helge,

Yes, we used an unedited sLASER sequence (TR/TE:2000/8-12-10ms). What’s the best way to share this file with you? Email?

Best,
-Humberto

It will be enough, if you mail me the .BASIS text files and point me to an example data set in our shared folder.

Helge

Great! I will send you an email with the information.

Thanks!
-Humberto

@Helge I seem to have a similar problem as the one described above. This is the error message I get when running the data as in the tutorial - for the Model data step:

Fitting metabolite spectra from dataset 1 out of 2 total datasets…

Running initial referencing…
Running preliminary analysis with reduced basis set…Unrecognized function or variable ‘lbfgsb_wrapper’.

Error in lbfgsb (line 166)
[f,x,taskInteger,outer_count, k] = lbfgsb_wrapper( m, x, l, u, nbd, …

Error in fit_Osprey_PrelimReduced>fit_Osprey_PrelimReduced_Model (line 299)
[ampl, ~, ~] = lbfgsb(fun, l, u, opts );

Error in fit_Osprey_PrelimReduced>@(x)fit_Osprey_PrelimReduced_Model(x,inputData,inputSettings) (line 157)
[x] = LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData, inputSettings),x0,lb,ub,opts);

Error in LevenbergMarquardt>@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:}) (line 159)
objy=@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:});

Error in LevenbergMarquardt>eval_fun (line 524)
[argu_out{:}]=objy(yGuess,extra_arguments);

Error in LevenbergMarquardt (line 225)
[fval,Resnorm,J,extra_arguments]=eval_fun(objy,yGuess,Jacobian_method,extra_arguments);

Error in fit_Osprey_PrelimReduced (line 157)
[x] = LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData, inputSettings),x0,lb,ub,opts);

Error in fit_Osprey (line 108)
[fitParamsStep1] = fit_Osprey_PrelimReduced(dataToFitRef, resBasisSet, fitRangePPM);

Error in fit_runFit (line 39)
[fitParams, resBasisSet] = fit_Osprey(dataToFit, basisSet, fitOpts);

Error in osp_fitUnEdited (line 63)
[fitParams, resBasisSet] = fit_runFit(dataToFit, basisSet, fitModel, fitOpts);

Error in OspreyFit (line 57)
[MRSCont] = osp_fitUnEdited(MRSCont);

Error in osp_onFit (line 33)
MRSCont = OspreyFit(MRSCont);

Error while evaluating UIControl Callback.

Error using uix.TabPanel/set.TabTitles (line 475)
Property ‘TabTitles’ should be a cell array of strings, one per tab.

Error in osp_processingWindow (line 50)
gui.layout.fitTab.TabTitles = {’…’};

Error in osp_onFit (line 31)
[gui,MRSCont] = osp_processingWindow(gui,MRSCont);

Error while evaluating UIControl Callback.


Any suggestions how to solve this?
Thanks in advance,
Koen

Hi Koen, what OS and MATLAB version are you running?

The matlab version is R_2021b and OS is Monterey

Ah, man - I’m fearing the worst. I hope MathWorks didn’t mess with the mex architecture in R2021b. The core fitting algorithm is written in C and called with pre-compiled mex binaries ( stephenbeckr/L-BFGS-B-C: L-BFGS-B, converted from Fortran to C, with Matlab wrapper (github.com)). If it’s not too much work, would you mind trying a slightly older MATLAB version (between 2017 and 2020 - we are confident that it works on those).

Thanks,
Georg

This is the error message when using the Matlab 2019a version:

Elapsed time 8.376941 seconds
Timestamp January 08, 2022 18:10:33 Osprey 1.1.0 OspreyFit

Fitting metabolite spectra from dataset 1 out of 2 total datasets…

Running initial referencing…
Running preliminary analysis with reduced basis set…Undefined function or variable ‘lbfgsb_wrapper’.

Error in lbfgsb (line 166)
[f,x,taskInteger,outer_count, k] = lbfgsb_wrapper( m, x, l, u, nbd, …

Error in fit_Osprey_PrelimReduced>fit_Osprey_PrelimReduced_Model (line 299)
[ampl, ~, ~] = lbfgsb(fun, l, u, opts );

Error in
fit_Osprey_PrelimReduced>@(x)fit_Osprey_PrelimReduced_Model(x,inputData,inputSettings)
(line 157)
= LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData,
inputSettings),x0,lb,ub,opts);

Error in
LevenbergMarquardt>@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:})
(line 159)
objy=@(y,vara)obj(reshape(transformback(y),size(xForm)),vara{:});

Error in LevenbergMarquardt>eval_fun (line 524)
[argu_out{:}]=objy(yGuess,extra_arguments);

Error in LevenbergMarquardt (line 225)
[fval,Resnorm,J,extra_arguments]=eval_fun(objy,yGuess,Jacobian_method,extra_arguments);

Error in fit_Osprey_PrelimReduced (line 157)
= LevenbergMarquardt(@(x) fit_Osprey_PrelimReduced_Model(x, inputData,
inputSettings),x0,lb,ub,opts);

Error in fit_Osprey (line 108)
[fitParamsStep1] = fit_Osprey_PrelimReduced(dataToFitRef, resBasisSet,
fitRangePPM);

Error in fit_runFit (line 39)
[fitParams, resBasisSet] = fit_Osprey(dataToFit, basisSet, fitOpts);

Error in osp_fitUnEdited (line 63)
[fitParams, resBasisSet] = fit_runFit(dataToFit, basisSet, fitModel,
fitOpts);

Error in OspreyFit (line 57)
[MRSCont] = osp_fitUnEdited(MRSCont);

Error in osp_onFit (line 33)
MRSCont = OspreyFit(MRSCont);

Error while evaluating UIControl Callback.

There also a problem with compiling the MEX file. It seems that it’s impossible to accept the xcode license:

mex -setup
Warning: Xcode is installed, but its license has not been accepted. Run Xcode
and accept its license agreement.

Error using mex
No supported compiler was found. For options, visit
Compatible Windows Compilers - MATLAB & Simulink.

Hmmm, can you open Spotlight and open XCode once?
(From macos - How to accept Xcode license? - Ask Different (stackexchange.com))

I am able to run XCode and I also opened a terminal where I input the following code: sudo xcodebuild -license accept I scrolled to the bottom and typed agree. Normally the license should be accepted then, but still got the matlab error the the license has not been accepted.

I now deleted XCode and will install it again. Hopefully this works.

1 Like

Unfortunately installing XCode does not result in any changes. Still not able to get the license accepted.

1 Like

[PROBLEM SOLVED]

The problem is the combination of the operating system and Xcode.
macOS Monterey in combination with Xcode 13 does not work for compiling the MEX file.

SOLUTION:
I now used an older Mac with MacOS Mojave version 10.14.6 in combination with MATLAB_R2020a. For this I installed Xcode 11.3.1. After Xcode installation, I was able to agree the licence (pop-up screen).

Then I opened a terminal and typed: ‘sudo xcodebuild -licence’

Next, I got a message that I had to install the developer tools.

After I did this, I returned to the matlab command window and opened the directory that contained the compile_mex.m file. This worked!

I ran a test to model the example data using Osprey (followed Georg’s online tutorial) and this was a succes.

1 Like

Thank you, Koen. I’m sorry Monterey was the root cause - my hope is that the next MATLAB releases make this work somehow (I’m not sure what to do if not!).

We tried out to install Osprey on another Mac:

BigSur 11.6 and Xcode v13 works for making the MEX file works also.
But from Matlab R_2020b up to the latest version I can’t get past the data modelling.

Combination these sotwares with R_2020a, an error popped up in the co-registration step:

Timestamp January 10, 2022 17:44:48 Osprey 1.1.0 OspreyCoreg
Coregistering voxel from dataset 2 out of 2 total datasets…

… done.
Elapsed time 4.511502 seconds
Error using uix.VBox/set.Heights (line 66)
Size of property ‘Heights’ must match size of contents.

Error in osp_iniCoregWindow (line 117)
set(gui.layout.coregTab, ‘Heights’, [-0.1 -0.9]);

Error in osp_onCoreg (line 51)
osp_iniCoregWindow(gui);

Error while evaluating UIControl Callback.

Any ideas how to solve this one?

Thanks in advance,
Koen

Hi Koen,

You’ve previously installed the two necessary toolboxes, right?
Widgets Toolbox - Compatibility Support - File Exchange - MATLAB Central (mathworks.com)
GUI Layout Toolbox - File Exchange - MATLAB Central (mathworks.com)

Note that one of them says “compatibility support”, which is the suitable version for v2020a and earlier - make sure that you install that one and not the one for 2020b and later. MATLAB have (of course) overhauled their UI-building architecture in 2020b, and with that came a new Widgets Toolbox release that isn’t backwards-compatible. We’re still figuring out what to do about all of this.