Spec2nii Philips conversion error

Hello everyone!

I’m novice in MR spectroscopy processing and I would really appreciate some help.

OS: Ubuntu WSL 20. 04. 4
spec2nii: version 0.6.10

I exported a 3D whole brain MRSI acquisition from Philips 7700 3T. I got four files:


I successfully converted the ‘act’ files to nifti.

But ‘ref’ files conversion give me an error. Here is the command:

spec2nii philips test_raw_ref.SDAT test_raw_ref.SPAR

And I got this error:

Traceback (last call last):
File “/home/santiago/anaconda3/bin/spec2nii”, line 8, in .
File “/home/santiago/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py”, line 666, in main
File “/home/santiago/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py”, line 283, in init
File “/home/santiago/anaconda3/lib/python3.7/site-packages/spec2nii/spec2nii.py”, line 565, in philips
File “/home/santiago/anaconda3/lib/python3.7/site-packages/spec2nii/Philips/philips.py”, line 39, in read_sdat_spar_pair
File “/home/santiago/anaconda3/lib/python3.7/site-packages/spec2nii/Philips/philips.py”, line 135, in read_sdat
raw_data = np.reshape(raw_data, (rows, samples)).T.squeeze()
File “<array_function internals>”, line 6, in reshape
File “/home/santiago/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py”, line 298, in reshape
return _wrapfunc(a, ‘reshape’, newshape, order=order)
File “/home/santiago/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py”, line 57, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot resize array of size 1113088 to shape (1440,1024)

Any help is appreciated.

Link to files: test_MRSI - Google Drive

Hi @smcepeda ,

Unfortunately spec2nii doesn’t yet handle MRSI int he SDAT/SPAR format. Thanks for the data though, I might be able to find some time to include it.


Thank you @wclarke for your reply!

Is there any other way to process MRSI data from a Philips scanner? For example, conversion from DICOM files? Or is there any other software that can do this? My purpose is to replicate this work: Whole-brain spectroscopic MRI biomarkers identify infiltrating margins in glioblastoma patients | Neuro-Oncology | Oxford Academic


Yes, I think DICOM should work.

I have exported DICOM files in ‘enhanced’ format. I ran spec2nii philips_dcm DCM_DIR and got this error:

Found 10 files.
Traceback (most recent call last):
File “/home/santiago/anaconda3/envs/fsl_mrs3/bin/spec2nii”, line 8, in
File “/home/santiago/anaconda3/envs/fsl_mrs3/lib/python3.8/site-packages/spec2nii/spec2nii.py”, line 679, in main
File “/home/santiago/anaconda3/envs/fsl_mrs3/lib/python3.8/site-packages/spec2nii/spec2nii.py”, line 290, in init
File “/home/santiago/anaconda3/envs/fsl_mrs3/lib/python3.8/site-packages/spec2nii/spec2nii.py”, line 622, in philips_dicom
self.imageOut, self.fileoutNames = multi_file_dicom(files_in, args.fileout, args.tag, args.verbose)
File “/home/santiago/anaconda3/envs/fsl_mrs3/lib/python3.8/site-packages/spec2nii/Philips/philips_dcm.py”, line 105, in multi_file_dicom
raise CSINotHandledError(‘CSI data is currently not handled for the Philips DICOM format.’
spec2nii.Philips.philips_dcm.CSINotHandledError: CSI data is currently not handled for the Philips DICOM format.Please contact the developers if you have examples of this type of data.

Link to dicom files: