wtclarke / fsl_mrs_fmrs_demo Goto Github PK
View Code? Open in Web Editor NEWFitting fMRS data in FSL-MRS - ISMRM 2022
License: MIT License
Fitting fMRS data in FSL-MRS - ISMRM 2022
License: MIT License
Hi William,
I am trying to run fsl_dynmrs command with my data but I get an error message. The same problem appears for a demo data (sub0_stim.nii.gz, design_mat.csv & fmrs_model.py). I've just realized that I haven't used the provided basis set but slaser's basis from Your other repository. I provide the message below and kindly ask for Your support.
fsl_dynmrs --data test.nii --basis ../sLASER_3T_28ms.basis --dyn_config ./fmrs_model.py --time_variables ./designmat.csv --baseline_order 2 --metab_groups Mac --output ./out --report --overwrite Traceback (most recent call last): File "/usr/local/bin/fsl_dynmrs", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.7/site-packages/fsl_mrs/scripts/fsl_dynmrs.py", line 195, in main dyn_res = dyn.fit(init=init, verbose=args.verbose) File "/usr/local/lib/python3.7/site-packages/fsl_mrs/dynamic/dynmrs.py", line 262, in fit x0 = self.vm.mapped_to_free(init['x']) File "/usr/local/lib/python3.7/site-packages/fsl_mrs/dynamic/variable_mapping.py", line 524, in mapped_to_free bounds=bounds).x File "/usr/local/lib/python3.7/site-packages/scipy/optimize/_minimize.py", line 627, in minimize **options) File "/usr/local/lib/python3.7/site-packages/scipy/optimize/tnc.py", line 377, in _minimize_tnc bounds=new_bounds) File "/usr/local/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 262, in _prepare_scalar_function finite_diff_rel_step, bounds, epsilon=epsilon) File "/usr/local/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 140, in __init__ self._update_fun() File "/usr/local/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 233, in _update_fun self._update_fun_impl() File "/usr/local/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 137, in update_fun self.f = fun_wrapped(self.x) File "/usr/local/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 134, in fun_wrapped return fun(np.copy(x), *args) File "/usr/local/lib/python3.7/site-packages/fsl_mrs/dynamic/variable_mapping.py", line 508, in loss pred = func(x) TypeError: model_glm() got an unexpected keyword argument 't'
Environment built with the following Dockerile:
`FROM python:3.7
RUN apt-get update
RUN apt-get install -y git
RUN git clone https://git.fmrib.ox.ac.uk/fsl/fsl_mrs.git
WORKDIR "/fsl_mrs"
RUN pip install .`
Hi, Clarke, I am so interested in the topic of functional MRS, I tried to study the code you shared in the "main_demo.ipynb", but come across some problems. When I load the demo data, It is reported that "sub0_stim.nii.gz is not a gzip file". I also can't open the demo data with FSLeyes. appreciate it if you can give me some tips. details are listed below:
from fsl_mrs.utils import mrs_io
data = mrs_io.read_FID('simulated_data/sub0_stim.nii.gz')
print(data.shape)
ImageFileError Traceback (most recent call last)
Cell In[9], line 4
1 from fsl_mrs.utils import mrs_io
3 # data represents a NIfTI-MRS file in memory
----> 4 data = mrs_io.read_FID('simulated_data/sub0_stim.nii.gz')
6 # what's in the data?
7 print(data.shape)
File ~/.conda/envs/fsl_mrs/lib/python3.8/site-packages/fsl_mrs/utils/mrs_io/main.py:88, in read_FID(filename)
86 filename = Path(os.readlink(filename))
87 try:
---> 88 return nifti_mrs.NIFTI_MRS(filename)
89 except (nifti_mrs.NotNIFTI_MRS, fslpath.PathError):
90 data_type, id_ext = _check_datatype(Path(filename))
File ~/.conda/envs/fsl_mrs/lib/python3.8/site-packages/fsl_mrs/core/nifti_mrs.py:106, in NIFTI_MRS.init(self, *args, **kwargs)
103 args = list(args)
104 filename = Path(args[0]).name
--> 106 super().init(*args, **kwargs)
108 # Store original filename for reports etc
109 self._filename = filename
File ~/.conda/envs/fsl_mrs/lib/python3.8/site-packages/fsl/data/image.py:1238, in Image.init(self, image, name, header, xform, loadData, calcRange, threaded, dataSource, loadMeta, dataMgr, **kwargs)
1236 if isinstance(image, (str, Path)):
1237 image = op.abspath(addExt(image))
-> 1238 nibImage = nib.load(image, **kwargs)
1239 dataSource = image
1240 saved = True
File ~/.conda/envs/fsl_mrs/lib/python3.8/site-packages/nibabel/loadsave.py:105, in load(filename, **kwargs)
103 matches, msg = _signature_matches_extension(filename, sniff)
104 if not matches:
--> 105 raise ImageFileError(msg)
107 raise ImageFileError(f'Cannot work out file type of "{filename}"')
ImageFileError: File /home/rshuang/Amy/test/fsl_mrs_fmrs_demo/simulated_data/sub0_stim.nii.gz is not a gzip file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.