Code Monkey home page Code Monkey logo

fsl_mrs's People

Contributors

alexcraven avatar michielcottaar avatar pauldmccarthy avatar sjbabdi avatar wtclarke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fsl_mrs's Issues

Create basis data with Vespa

Hey,

do you know if there is a way to create basis spectra for FSL_MRS with the Vespa package? I already use it to create basis spectra for LCModel, so it would be quiet convenient to also use it for FSL_MRS basis spectra.

Thanks for your help

Lennard

Processing GE p-files

Dear FSL-MRS Developers,
We are very interested in using the FSL-MSR tools for the data processing for GE data. So far, however, we have not been able to process the sLASER data with these tools as this sequence does not appear to be recognized by the initial NIfTI conversion tool. My colleagues and I have, however, been able to explore data processing with the FSL-MRS tools with data collected with the standard GE PROBE-P sequence.
We have collected some phantom data in both single voxel spectroscopy and multi-voxel chemical shift imaging modes with the GE sLASER sequence, and can share that data with you.
Thanks,
Laima

$FSLDIR not found during segmentation task

Dear #wtclarke

I am experiencing this fsl.utils.run.FSLNotPresent: $FSLDIR is not set - FSL cannot be found! error while testing a segmentation task on the provided example files: T1.nii used as reference for metab.nii . I attach here the print out of the error.

I tried to look it up the original FSL installation website and other similar reported issues for heads up but yet I struggle with the path definition within the fsl_mrs implementation.

The installation of my fsl_mrs followed the conda option and other commands (or at least the few I tried so far) do run.
Would you have any suggestion?

Many thanks

Screenshot 2022-08-02 151523

Show SVS voxel locations - notebook

Dear FSL_MRS developers,

is there any way to show the SVS voxel locations in a T1-image when useing fsl_mrs in a notebook? At the reports and visualisation page I read that it would be easy to get the images with command line use. Unfortuanally i can't figure out how to show them with my notebook.

Thank you for your help!

nifti_mrs_proc slow ?

Hi William, FSL-MRS developers,

I started playing with FSL-MRS and I would first like to thank you for this wonderful tool! πŸ‘

I am processing my MRSI data using the python package but I find it quite slow. Here is a code example with the example data:

import fsl_mrs.utils.mrs_io as mrs_io
from fsl_mrs.utils.preproc import nifti_mrs_proc

mrsi_data = mrs_io.read_FID("/path/to/fsl_mrs/example_usage/example_data/example_mrsi/mrsi.nii.gz")
mrsi_data = nifti_mrs_proc.apodize(mrsi_data, [60.0], figure=True)

After a few seconds, the figure is plotted and then it takes a bit more than 3 minutes to finish. This example is for an apodization but I have this issue with all other processing operations (truncate, fshift, etc.). See below the Spyder profiler results:
image

It seems the method __expandCoverage of the fsl ImageWrapper class is responsible for this. I installed fsl_mrs in conda with python 3.9, Ubuntu 16.04, 8 x 1.9Ghz processor, 16GB memory. My questions: do you have the same execution times on your side? Is this normal? Or maybe it comes from my setup?

I can do more tests if needed.

Thanks!
Tangi

FSL MRS standard fitting model

Hello,

I have a question regarding the paper FSL-MRS: AN end-to-end spectroscopy analysis package. In chapter 2.4.1 you mention the standard fitting model. In the first term M_l,g contains 𝜈;Ξ³g,𝜎g,πœ€g but in the second term M_l,g only contains 𝜈;𝛾 ,πœ€ although in the FFT 𝜎g is mentioned. Would you explain this to me?

Reguards

mrs_tools vis issues

We found an error in mrs_tools vis for MRSI data. When adding the --ppmlim subcommand, whether we specify a reasonable lower and upper limit, such as 0 6 or 4.2 4.5, or crazy values such as 0 100, the plot display is the same each time and it does not throw an error. We tested out mrs_tools vis with the SV Practical Data and it performs as expected (the --ppmlim subcommand works well). Then tested mrs_tools vis with MRSI Practical Data and it does not perform as expected, it performs the same way also with our MRSI data (ignores or cannot handle the --ppmlim subcommand).

MRSI fitting : no absolute quantification will be performed

Hi Will! Thank you very much for possibility of using fsl_mrs. Actually now I am exploring of fsl_mrs and I got problem with running test example fsl_mrs MRSI Fitting when I run second cell I see err:

%sx fsl_mrsi --data example_data/example_mrsi/mrsi.nii.gz
--basis example_data/example_mrsi/3T_slaser_32vespa_1250.BASIS
--output MRSI/example_mrsi_fit
--mask example_data/example_mrsi/mask.nii.gz
--h2o example_data/example_mrsi/wref.nii.gz
--tissue_frac MRSI/mrsi_seg_wm.nii.gz MRSI/mrsi_seg_gm.nii.gz MRSI/mrsi_seg_csf.nii.gz
--add_MM
--baseline_order 2
--combine PCho GPC --combine Cr PCr --combine NAA NAAG --combine Glu Gln --combine Glc Tau
--ignore Gly HG
--overwrite

['Found duplicate basis name "Gly", renaming to "Gly_1".',
'/home/iurii/anaconda3/envs/fsl_mrs/bin/fsl_mrsi:440: UserWarning:',
'',
'H2O file provided but could not determine TE: no absolute quantification will be performed.', '',
'/home/iurii/anaconda3/envs/fsl_mrs/bin/fsl_mrsi:444: UserWarning:','',
'H2O file provided but could not determine TR: no absolute quantification will be performed.','']

Could you please advise me with this problem?\

Regards,
Iurii

3T GE with unsupressed water: null for mMol/kg

Hi William,
Any idea why after processing my data with anatomical segmentation and water reference, I am getting null results for mMol/kg?
Everything else looks good as far as I can tell (no errors...)

spec2nii ge ../P09216.7
fsl_mrs_preproc --output processed --data P09216.nii.gz --reference P09216_ref.nii.gz --report
fsl_mrs  --data processed/metab.nii.gz --basis LCModel_GE_UnEdited_PRESS_GABA35_.BASIS --output example_svs  --h2o processed/wref.nii.gz --tissue_frac segmentation.json --report

Cheers,
Alex W.

HERMES preprocessing

Looking at the fsl_mrs_preproc_edit script, it seems it only works with MEGA-PRESS data at the moment. Are there plans to include HERMES preprocessing in the future?

Alternatively, is it possible to preprocess HERMES in other software, such as Osprey, and fit the data in fsl_mrs?

Fitting synthetic spectra with simulation parameters as starting points

Hello,

A student of mine has been working with FSL because we need to study our methodologies' effects on quantification results. We are fitting synthetic spectra. For each model we need to fit hundreds of spectra to get useful statistics from the analyses. Currently, 200 spectra is taking 5-7 hours, so 500-1000 will take forever for each model. While the actual fitting results may not match the simulation parameters perfectly, they are a good starting point and should cut down on the fitting time significantly. This is an especially relevant problem for deep learning research where we mainly use synthetic data.

Is this something that could be proto-typed rather quickly, at least in a forked repo? Do you have any suggestions for how to go about this? I am happy to contribute to a final, polished solution, but for the time being, a speedy solution would be very helpful.

Best,
John

Problem converting GE P-file

Hello FSL-MRS developers,
I've just installed (or so I think) FSL-MRS and spec2nii and look forward to using the tools.
I got the following error messages when trying to convert a GE P-file (renamed):

% spec2nii ge P00102.7
Traceback (most recent call last):
File "/Users/nick/opt/anaconda3/bin/spec2nii", line 10, in
sys.exit(main())
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/spec2nii.py", line 486, in main
spec2nii(*args)
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/spec2nii.py", line 128, in init
args.func(args)
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/spec2nii.py", line 353, in ge
data,ref_data, orientation, dwelltime, meta = read_p_file(args.file)
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/GE.py", line 16, in read_p_file
hdr = _read_hdr(filename)
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/GE.py", line 111, in _read_hdr
byte_off,interp_off = _rev_info(rdb_rev)
File "/Users/nick/opt/anaconda3/lib/python3.8/site-packages/spec2nii/GE.py", line 249, in _rev_info
raise ValueError(f'Revision number {rev} not recognised.')
ValueError: Revision number 26.00200080871582 not recognised.

I'm using Mac OS Catalina 10.15.7
Any idea what the problem is?
Thanks,
Nick

GE P-Files

Dear FSL-MRS Developers,

Our team is hoping to use the FSL-MSR tools for the data processing for GE data. However, the spec2nii command seems to not recognize our p-file for conversion to nifti. Does anyone possibly know if there have been changes to p-files that have made them unable to be converted by spec2nii?

Thank you!

dimension error in philips 3T MRS data reprocessing

Hi,

I am relatively new to the field of MRS analysis. I am analyzing MRS data acquired for my Ph.D.

I am running fsl_mrsproc with the following command :

fsl_mrs_proc average --file /mnt/New_Volume/Karthik_Thesis/MRS_BS/Sub-250/sub-250.nii.gz/dACC_SVS_PRESS_35_ref.nii.gz --dim DIM_DYN --output fsl_mrs_proc --filename press_wref_tmp

However, I get the following error :

image

Upon verifying, I found out that my data doesn't have the required parameter specified, as shown by the following command :

image

Help me make sense of this error. I have two doubts:

  1. Is it a problem with the a) scan acquisition parameters; b) scanner software or c) spec2nii conversion that is responsible for the dimensions data not being shown?
  2. Can I skip the steps which require the dimensions to be told to fsl_mrsproc?

DYM EDIT dimension

Hi all,

I'm new to MRS analysis and to FSL-MRS in particular:

I've twix test data (SVS H-MRS of the hippocampus at 3T Siemens Prisma) that I converted to NIFTI (spec2nii twix). In contrast to the data used in the FSL practical, I've a DYM_EDIT dimension in the data.

Data is uploaded here: https://syncandshare.lrz.de/getlink/fiNFCp4Hfa9Dk5uGG7pDpi/

  1. Now I was wondering how to deal with a DYM_EDIT as one dimension in the data? Is it appropriate to just average across DYM_EDIT with fsl_mrs_proc average?

  2. Data looks pretty noisy to me, although three peaks are visible in the metabolite image (128 avgs). I briefly scanned the literature and saw a few published examples of Hippocampus-MRS that looked quite similar. Data of the anterior cingulate from the same subject at the same scanner during the same sequence looked much cleaner. I'd appreciate your opinion on that?

Best,

Lukas

Using LCModel Basis Set: ValueError: could not convert string to float: 'badelt=-3.99999990e-04'

Hello

I am trying to run

fsl_mrs --data processed/metab.nii.gz --basis ~/.lcmodel/basis-sets/3t/all/press_te35_3t_all_v3.basis --output svs --h2o processed/wref.nii.gz --tissue_frac segmentation.json --report

but am getting the following error

Traceback (most recent call last):
File "/usr/local/fsl/fslpython/envs/fslpython/bin/fsl_mrs", line 420, in
main()
File "/usr/local/fsl/fslpython/envs/fslpython/bin/fsl_mrs", line 197, in main
basis, names, basisheader = mrs_io.read_basis(args.basis)
File "/usr/local/fsl/fslpython/envs/fslpython/lib/python3.8/site-packages/fsl_mrs/utils/mrs_io/main.py", line 98, in read_basis
basis, names, header = lcm.readLCModelBasis(filename)
File "/usr/local/fsl/fslpython/envs/fslpython/lib/python3.8/site-packages/fsl_mrs/utils/mrs_io/lcm_io.py", line 144, in readLCModelBasis
header = unpackHeader(header)
File "/usr/local/fsl/fslpython/envs/fslpython/lib/python3.8/site-packages/fsl_mrs/utils/mrs_io/lcm_io.py", line 180, in unpackHeader
tidy_header['dwelltime'] = float(tidy(line).split()[-1])
ValueError: could not convert string to float: 'badelt=-3.99999990e-04'

I would simulate my own, but I really don't know how to write the .json for a 3T GE Discovery PRESS...

Thanks for any help or insight into what I am doing wrong :)

Problem converting and visualizing GE P-file data

Hi Will! Very excited about FSL-MRS. Thanks to you and Saad for putting this all together.

I had my first stab at installing and testing it today and ran into some issues. Installation (in Mac OSX terminal with a newly created conda environment) seemed to go fine with no errors. But when I tried converting a P-file and visualize the results, I ran into a few errors:

  1. First I tried to inspect the contents of my p-file using the -v option in spec2nii as suggested on the "Data Conversion" wiki page"

spec2nii ge -v P04608.7

and was met with the following error:

usage: spec2nii [-h] [--verbose]
{twix,dicom,philips,ge,ismrmrd,text,jmrui,raw} ...
spec2nii: error: unrecognized arguments: -v

So then I tried using --verbose instead of -v:

spec2nii ge --verbose P04608.7

and got the following message:

usage: spec2nii [-h] [--verbose]
{twix,dicom,philips,ge,ismrmrd,text,jmrui,raw} ...
spec2nii: error: unrecognized arguments: --verbose

  1. At this point, I gave up on trying to inspect the data, and just went straight to conversion using:

spec2nii ge P04608.7

When I did this, the command ran to completion (giving a warning that for GE data, the orientation information will not be reliable). All of the expected .nii.gz files were generated, BUT no JSON files were generated.

  1. Lastly, when I tried to visualize the data using:

mrs_vis P04608_frame001.nii.gz

I got the following error message:

Traceback (most recent call last):
File "/Users/jnear/miniconda3/envs/fslmrs/bin/mrs_vis", line 158, in
main()
File "/Users/jnear/miniconda3/envs/fslmrs/bin/mrs_vis", line 127, in main
tmpmrs = MRS(FID=f, header=header)
File "/Users/jnear/miniconda3/envs/fslmrs/lib/python3.8/site-packages/fsl_mrs/core/MRS.py", line 58, in init
self.set_acquisition_params(centralFrequency=header['centralFrequency'],bandwidth=header['bandwidth'])
File "/Users/jnear/miniconda3/envs/fslmrs/lib/python3.8/site-packages/fsl_mrs/core/MRS.py", line 147, in set_acquisition_params
self.centralFrequency = misc.checkCFUnits(centralFrequency)
File "/Users/jnear/miniconda3/envs/fslmrs/lib/python3.8/site-packages/fsl_mrs/utils/misc.py", line 95, in checkCFUnits
if cf<1E5:
TypeError: '<' not supported between instances of 'NoneType' and 'float'

I can't tell whether this error is because of the missing JSON files? Or if there something wrong with my installation.

Thanks in advance for your help! Happy to share the offending P-file if necessary.

Jamie

version `GLIBC_2.27' not found

I test fsl_mrs on ubuntu16.04, the following issues arise:
OSError: Unable to load '/usr/local/anaconda3/lib/python3.7/site-packages/hlsvdpro/bin/libhlsvdpro.so'. The OS reports: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/anaconda3/lib/python3.7/site-packages/hlsvdpro/bin/libhlsvdpro.so).

I googled this and the solution is to upgrade the OS. But there are some problems to update my OS...are there any other solution?

Windows installation aux directory name

Dear FSL MRS developers,

Thanks for the provision of this toolbox, I'm really looking forward to trying it out. I am using Windows primarily (Windows 10, 64-bit) and am getting the error 'fatal: cannot create directory at 'fsl_mrs/aux': Invalid argument' when trying to clone the repo.

This seems to be related to this [1] very strange anomaly of windows that 'aux' folder name is reserved. I just confirmed this, I am unable to make a directory called aux; this is very strange but I guess it means fsl_mrs will not work on Windows containing the directory 'aux'.

For now I will switch to Linux, and I see fsl_mrs is not tested on Windows; I am happy to help test deployment to Windows if it would be useful.

Best,
Joe

[1] https://stackoverflow.com/questions/36225708/cannot-create-a-directory-named-aux-or-starting-by-aux-on-windows-8-1

XA31: Differences between .rda and .dat

Dear #wtclarke

We already had a quick chat this year regarding converting Siemens XA20 data to the Nifti format using your spec2nii tool. I really appreciated your help!!
Right now, we are acquiring SVS-data (now under XA 31) from a certain area in the hippocampus and want to use the fsl-mrs tool. Technically, I can convert our data and use the preproc script without any error messages. However, the spectra look very strange (compared to the spectra on the Siemens Console). So I thought that the problem might arise at the beginning of the preprocessing – the conversion. Attached you can find a plot of the same SVS-data: one was converted from .dat (resulting in one mtab file and one ref file), and the other was converted from .rda.
It would be great if you could give me a hit on what the problem is. Thanks a lot!

By the way, the preproc script doesn’t work with the rda-converted data because of the missing Dimension tags ?!

Here are the mrs-infos from:

  1. Metab converted from .dat
    NIfTI-MRS version 0.5
    Data shape (1, 1, 1, 2080, 26, 200)
    Dimension tags: ['DIM_COIL', 'DIM_DYN', None]
    Spectrometer Frequency: 123.262808 MHz
    Dwelltime (Bandwidth): 4.167E-04s (2400 Hz)
    Nucleus: 1H
    Field Strength: 2.90 T

  2. Wref converted from .dat
    NIfTI-MRS version 0.5
    Data shape (1, 1, 1, 2080, 26)
    Dimension tags: ['DIM_COIL', 'DIM_DYN', None]
    Spectrometer Frequency: 123.262808 MHz
    Dwelltime (Bandwidth): 4.167E-04s (2400 Hz)
    Nucleus: 1H
    Field Strength: 2.90 T

  3. Metab converted from .rda
    NIfTI-MRS version 0.5
    Data shape (1, 1, 1, 1024)
    Dimension tags: [None, None, None]
    Spectrometer Frequency: 123.262808 MHz
    Dwelltime (Bandwidth): 8.334E-04s (1200 Hz)
    Nucleus: 1H
    Field Strength: 2.90 T
    metab_XA31

3T GE 35TE PRESS - TE "unusal value. Expecting a value < 0.5s"

Hello!
I have a P file that comes from a 3T GE scanner running a 35TE PRESS sequence

I run the following:

spec2nii ge P29696.7 fsl_mrs_preproc --output processed --data P29696.nii.gz --reference P29696_ref.nii.gz --report svs_segment -t T1.nii.gz processed/metab.nii.gz fsl_mrs --data metab.nii.gz --basis my_basis_spectra --output example_svs --h2o wref.nii.gz --tissue_frac segmentation.json --report

The basis set comes from MRSCloud https://braingps.mricloud.org/mrs-cloud

When I run fsl_mrs, it completes, but ends with:
"te is an unusal value. Expecting a value < 0.5 s.
tr is an unusal value. Expecting a value < 20 s."

And in the report it says under Quantification Information:

"Metabolite T2: | 194.0 ms
Metabolite T1: | 1.29 s
Sequence echo time (TE): | 35000000.0 ms
Sequence repetition time (TR): | 1500000.0 s
Relaxation corrected water concentration: | 0 mmol/kg
Metabolite relaxation correction (1/e(-TE/T2)): | inf
Raw concentration to molarity scaling: | nan
Raw concentration to molality scaling: | nan"

Any ideas? I'm happy to share my P file

problem with fsl_mrs_proc coilcombine

Hello,

I converted my TWIX data to nifit format, and then ran fsl_mrs_proc coilcombine but I got the 'ValueError: m has more than 2 dimensions' error. I am a new user to fsl_mrs. Could you please help me with it?

The following is my code detail:
Read file N14784_svs_se_30_AC_met.nii.gz (/Users/sago/Desktop/Work/BCC spectroscopy/resources/TWIX/N14784_BCC2/N14784_2021_11_04_AC_P2052).
NIfTI-MRS version 0.5
Data shape (1, 1, 1, 4096, 44, 128)
Dimension tags: ['DIM_COIL', 'DIM_DYN', None]
Spectrometer Frequency: 123.235708 MHz
Dwelltime (Bandwidth): 2.500E-04s (4000 Hz)
Nucleus: 1H
Field Strength: 2.89 T

(fsl_mrs) sgao@Sungs-iMac N14784_2021_11_04_AC_P2052 % mrs_tools info N14784_svs_se_30_AC_water.nii.gz

Read file N14784_svs_se_30_AC_water.nii.gz (/Users/sago/Desktop/Work/BCC spectroscopy/resources/TWIX/N14784_BCC2/N14784_2021_11_04_AC_P2052).
NIfTI-MRS version 0.5
Data shape (1, 1, 1, 4096, 44, 16)
Dimension tags: ['DIM_COIL', 'DIM_DYN', None]
Spectrometer Frequency: 123.235708 MHz
Dwelltime (Bandwidth): 2.500E-04s (4000 Hz)
Nucleus: 1H
Field Strength: 2.89 T

(fsl_mrs) sgao@Sungs-iMac N14784_2021_11_04_AC_P2052 % fsl_mrs_proc coilcombine --file N14784_svs_se_30_AC_met.nii.gz --reference N14784_svs_se_30_AC_water.nii.gz --output combined -r
Traceback (most recent call last):
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/bin/fsl_mrs_proc", line 10, in
sys.exit(main())
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/fsl_mrs/scripts/fsl_mrs_proc.py", line 361, in main
dataout = args.func(dataList, vars(args))
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/fsl_mrs/scripts/fsl_mrs_proc.py", line 481, in coilcombine
combined = preproc.coilcombine(dataobj.data,
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/fsl_mrs/utils/preproc/nifti_mrs_proc.py", line 84, in coilcombine
_, refWeights = preproc.combine_FIDs(
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/fsl_mrs/utils/preproc/combine.py", line 148, in combine_FIDs
FIDlist, W, C = prewhiten(FIDlist)
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/fsl_mrs/utils/preproc/combine.py", line 42, in prewhiten
C = np.cov(FIDs[start:, :], rowvar=False)
File "<array_function internals>", line 180, in cov
File "/Users/sago/opt/anaconda3/envs/fsl_mrs/lib/python3.10/site-packages/numpy/lib/function_base.py", line 2617, in cov
raise ValueError("m has more than 2 dimensions")
ValueError: m has more than 2 dimensions

Thanks,
Si

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.