FSL-MRS Spec2Nii reshape issue

Hi,

I’m new to FSL-MRS and we’re currently testing out an EPSI sequence to use in future data collection. I’ve been trying to convert the data using Spec2Nii, but keep getting a reshaping error. I’ve tried looking around but most of the solutions deal with regular python coding and not this package.

Is there a known solution to getting the reshaping to work? Below I have put the error message I get when running “spec2nii dicom -f myfile myepsidir/”

Thank you for your help,
Tim

Error Message:
Found 1152 files.
Traceback (most recent call last):
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/bin/spec2nii”, line 10, in
sys.exit(main())
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/spec2nii.py”, line 521, in main
spec2nii(*args)
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/spec2nii.py”, line 272, in init
args.func(args)
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/spec2nii.py”, line 374, in dicom
self.imageOut, self.fileoutNames = multi_file_dicom(files_in, args.fileout, args.tag, args.verbose)
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/dicomfunctions.py”, line 97, in multi_file_dicom
specDataCmplx, orientation, dwelltime, meta_obj = process_siemens_csi(img, verbose=verbose)
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/dicomfunctions.py”, line 280, in process_siemens_csi
return process_siemens_csi_vx(img, verbose)
File “/u/project/CCN/apps/conda/rh7/fsl-mrs/lib/python3.9/site-packages/spec2nii/dicomfunctions.py”, line 301, in process_siemens_csi_vx
specDataCmplx = specDataCmplx.reshape((slices, rows, cols, spectral_points))
ValueError: cannot reshape array of size 3800000 into shape (36,38,100,1000)

Hi @tjordan ,

I’ll drop you an email about getting some example data.

Will

Hi,
I’m currently testing the EPSI sequence on a Siemens system. I have the exact same problem as Tim.
The spec2nii dicom is not working because of a reshape issue. Do you have some advice to process such data without the Midas package ?
Thanks in advance,
Margaux

Hi @margauxnsb ,

Is this EPSI from the MIDAS package? If so it turns out that the DICOM files are actually hacked to contain raw kt-space data, i.e. unreconstructed data. Here is an extract from my conversation with Tim.

Hi Tim,

Sorry for the delay in responding. It looks like this WIP is from the MIDAS project (http://mrir.med.miami.edu:8000/midas) and doesn’t export the data reconstructed. I.e. the DICOM files are hacked to contain raw kt-space data and are completely invalid as proper DICOM files. For this data you have to provide your own reconstruction (hard) or use the MIDAS project software (much easier). Spec2nii doesn’t provide reconstruction because in a general sense that’s not possible (without knowing the exact sequence trajectory, which isn’t stored in raw data headers).

I think there is a way of exporting the reconstructed data from that software, which if you can figure out I’d be very happy to help you get the reconstructed data into the NIfTI-MRS format. Sorry I can’t provide an easy solution.

Hi @wclarke,
Thanks a lot for your answer. Unfortunately, the indicated MIDAS page looks shutdown for me. Do you know if there are an alternative website/page?

I’m not sure. Andrew Maudsley (@amaudsley) did post the package on here a couple of years ago: [code submission] midas mrsi - #2 by admin but the link there is dead as you say. You could try contacting him via his Miami webpage if you are sure that the data is from the MIDAS package. https://umiamihealth.org/en/sylvester-comprehensive-cancer-center/research/faculty/andrew-a-maudsley-phd

The MIDAS project website is indeed dead and will likely not be resurrected. We can still make the software available, please email me directly for information.
It’s unclear if the previous posts are referring to data obtained with the EPSI sequence made available from Miami, but if so, the format of the DICOM files is indeed the raw data as created by the standard data export on Siemens scanners.

1 Like