Numpy Axis Error - FSL MRS


I am receiving the error message:

numpy.AxisError: axis 4 is out of bounds for array of dimension 4

When I simply attempt to visualise my converted raw metabolite spectra (METAB_RAW_1.nii.gz) using:

mrs_tools vis METAB_RAW_1.nii.gz

Please advise on how to fix this.


Hi Joe,

Sorry you’ve ran into an error. Could you tell me what mrs_tools info METAB_RAW_1.nii.gz gives you?

Hi Will,

Thanks for the response. Apologies I should’ve added this in the original message.

mrs_tools info METAB_RAW_1.nii.gz gives me:

Read file METAB_RAW_1.nii.gz (/Users/joephilby/Documents/NeuRA/Spec Programmes/fsl_mrs-master/PRESS_0.8x0.8x0.8-6_1-act:ref).

NIfTI-MRS version 0.7

Data shape (1, 1, 1, 1024, 1)

Dimension tags: [‘DIM_DYN’, None, None]

Spectrometer Frequency: 127.758832 MHz

Dwelltime (Bandwidth): 5.000E-04s (2000 Hz)

Nucleus: 1H

Field Strength: 3.00 T

Hi @Joe_Philby
This arises from that extra singleton dimension on the data Data shape (1, 1, 1, 1024, 1).

This is something I need to clean up, but for now there might be a work around. How are you converting the data?


Hi Will,

I am using the spec2nii tool to convert my Philips SDAT file into a .nii.gz file so I can use it in the FSL-MRS software.