wtclarke / fsl_mrs

Mirror of the FSL-MRS gitlab repository
https://git.fmrib.ox.ac.uk/fsl/fsl_mrs
Other
14 stars 8 forks source link

problem with fsl_mrs_proc coilcombine #16

Closed AbestSG closed 1 year ago

AbestSG commented 1 year ago

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_mrsproc.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

wtclarke commented 1 year ago

Hi @AbestSG,

Sorry for the delay in responding, it's been a busy time. The issue here is that the water references have multiple dynamics.

Data shape (1, 1, 1, 4096, 44, 16) Dimension tags: ['DIM_COIL', 'DIM_DYN', None]

You should combine these averages first before using the reference for coil combination.

fsl_mrs_proc average --dim DIM_DYN --file N14784_svs_se_30_AC_water.nii.gz --output . --filename water_averaged.nii.gz
fsl_mrs_proc coilcombine --file N14784_svs_se_30_AC_met.nii.gz --reference water_averaged.nii.gz --output combined -r
wtclarke commented 1 year ago

Closing this issue. Feel free to reopen if you still need help.