wtclarke / spec2nii

Multi-format in vivo MR spectroscopy conversion to NIFTI
Other
27 stars 23 forks source link

No luck with Bruker data #18

Closed benhibou closed 1 year ago

benhibou commented 3 years ago

Hello,

I have try to use spec2nii with Bruker data but it quickly run into trouble as it try to reshape some array:

I issue the command --> spec2nii bruker -m FID -o ./ ./10/fid while I reside into a directory which contains a subdirectory "./10". In ./10 is the "method" file and all the relevant fid, ... as they appear when a MRS experiment is run with Bruker. The output gives:

Traceback (most recent call last): File "/Users/benagain/opt/anaconda3/bin/spec2nii", line 10, in sys.exit(main()) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py", line 485, in main spec2nii(args) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py", line 247, in init args.func(args) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py", line 456, in bruker self.imageOut, self.fileoutNames = read_bruker(args) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/spec2nii/bruker.py", line 42, in read_bruker for data, orientation, dwelltime, meta, name in yield_bruker(args): File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/spec2nii/bruker.py", line 71, in yield_bruker d = Dataset(args.file, property_files=[bruker_properties_path], parameter_files=['method']) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/dataset.py", line 180, in init self.load() File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/dataset.py", line 254, in load self.load_data() File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/dataset.py", line 502, in load_data self._data = self._read_data() File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/dataset.py", line 512, in _read_data return self._schema.deserialize(data, self._schema.layouts) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/schemas.py", line 162, in deserialize data = self._acquisitions_to_encode(data, layouts) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/brukerapi/schemas.py", line 200, in _acquisitions_to_encode return np.reshape(data, layouts['encoding_space'], order='F') File "<__array_function__ internals>", line 6, in reshape File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 301, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/Users/benagain/opt/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 61, in _wrapfunc return bound(args, **kwds) ValueError: cannot reshape array of size 8192 into shape (2048,1)

In the experiment the parameter PVM_SpecMatrix corresponds to a 1-dimensional array and is equal to 2048. I am not sure if this could be connected to the last line of the error message.

Thank you in advance for your comment,

Benoit

wtclarke commented 3 years ago

Hi @benhibou ,

Sorry for the delay in replying to your message. Could you describe the data a bit more? What other dimensions (coils, repeats, other encodings) are you expecting?

BW

Will

wtclarke commented 1 year ago

Closing due to lack of activity. Please reopen if desired.