FSL-MRS spec2nii philips dicom dimension issue

Hello everyone,

I’m a medical doctorate in a Neuropsychiatry and Neuroimaging Lab and we just begun to use FSL-MRS (version: 1.1.13) for our spectroscopy data.
We acquired our data in a Philips Ingenia Elition 3.0T X and saved them as enhanced dicom files. The scanner produced two files one raw dicom and one spectroscopy file. I only used the second one for the further steps. Converting these files with spec2nii philips_dcm works, but I am having some issues with the dimensions and the following processing steps.

For example, when I run the predefined fsl_mrs preproc ( fsl_mrs_preproc --output processed --data file.nii.gz --reference file_ref.nii.gz --report ) I’ m getting this error:
ValueError: remove_unlike only makes sense for data with a dynamic dimension

And when I use mrs_tools info to see the dimensionality of the data, the 5th and 6th dimensions are not specified.

So, now for my questions:
Did I make a mistake converting my files from Dicom to Nifti? Are these dimensions essential or can I change or omit the preprocessing steps that use these dimensions? Or is there any other way?

I have attached a folder with the enhanced dicom files as well as the output from spec2nii dump.
Please let me know if you would like any additional information.

Many thanks,

spec2nii_dump.txt (2.2 KB)

SPEC_data.zip (733.6 KB)

Hi VerenaD,

It looks like the conversion was mostly okay; the main issue here is that the standard fsl_mrs_preproc script is designed to work with unprocessed raw data (with multiple transients recorded separately), whereas your spectroscopy dicom has already been processed to a large extent – making most of the steps in fsl_mrs_preproc redundant.

If you are able to get hold of the raw unprocessed data, it will give a lot more flexibility in terms of processing. I’d strongly recommend doing it this way (I’m not familiar with the Philips system, so I don’t have specific advice on how to do so).

If not, the question then becomes: how much of the pre-processing is already handled on the scanner, is this pre-processing appropriate for quantification by fsl_mrs, and what (if anything) remains to be done?

You could try putting the converted data straight into fsl_mrs and see how it looks… perhaps also investigate the the fsl_mrs_proc command for any of the remaining steps, if needed.

One slightly peculiar thing I noticed when fitting your data: there may be something not quite right in the frequency scaling, which may represent an issue with the conversion (could also be an issue with the random basis set I used though). I didn’t look in depth, but suggest you pay close attention to any slight shifts in the major peaks…


Hi Verena,

Alex is exactly right. The data is fairly preprocessed already, but as I’m not an expert in Philips data, I’m not certain what processing has been applied to get to this point. Clearly averages have been aligned and they and coils have been combined, but it’s not easy to tell whether water reference based eddy current correction has already been applied. Though to make life easier for users I should make fsl_mrs_preproc skip steps that aren’t required.

For what it’s worth the data looks of good quality. E.g. the DLPFC_L scan looks like this:

, which I would suggest is fine for further analysis (i.e. fitting) in fsl_mrs.

@Alex, what basis did you use to try and fit? If it was created for Siemens, then the 2.89T rather than 3T field strength might bite you.

Ah yes – most likely that was my mistake.

Hello everyone,

first of all thank you @alex and @wclarke for the detailed information.

As you suggested, I did some preprocessing steps with the fsl_mrs subcommands. The metab data looked nice unprocessed, but the water reference looked not fully processed when I visualized it.
For example the right putamen:

So I tried performing the remaining preprocessing steps. I used the following steps:
Eddy current correction (ECC) for both (metab and ref).
Centering the echo as described in the tutorial, although I wasn’t sure if these were the right parameters for my sequence (fsl_mrs_proc truncate --file fsl_mrs_proc/file_ecc.nii.gz --points -1 --pos first --filename file_trunc --output fsl_mrs_proc -r)
Removal of residual water
Phase correction

After ECC, the visualization of my metabolites looked a bit weird, but the reference file was fine. When visualizing the final processed files, the metab.nii looked better than after ECC, but seemed a bit shifted in one example. So I’m not sure if all the steps were required or even if I left out an important step.
(This example is the acc from a different subject than the one whose folder I had provided you.)
Before processing:

After processing:

The processed file to the examples before (putamen on the right), however, looks good.

What is your opinion, should I do the preprocessing steps?

The next problem occurred when I tried to fit my data. As I understood it, I can’t use the basis spectra files from the example in the fsl_mrs tutorial, because they were created for the STEAM sequence.
So, first I tried to create my own basis spectra using the fls_sim function, but unfortunately I wasn’t able to create a json file as I couldn’t figure out all sequence description parameters and sequence block parameters which were described on https://open.win.ox.ac.uk/pages/fsl/fsl_mrs/seq_file_params.html#seq-file-params.
So I tried to find a basis spectra file for a philips PRESS 35 sequence.
I found one .basis file at this page (http://s-provencher.com/lcm-basis.shtml) but when I wanted to apply it, I got this back:

Then I found a folder (on MR Spectroscopy Basis Sets | MR SCIENCE Laboratory) that contained .raw files for the various metabols, but unfortunately that didn’t work either.

Do you have any idea how I could solve this problem?

I am sorry for asking so many questions, but unfortunately I have no more ideas of my own what I could try. So, I would be very grateful if you could help me.

If you need more information, here is a description of my acc sequence and otherwise feel free to ask me.
ACC_SV_PRESS_35.txt (2.6 KB)

Many thanks,

I’m away from my computer, so apols for the short answers.

Regarding the preprocessing, its hard to tell if ecc is needed, but I’m confident that you dont need to apply the truncation to centre the echo. @admin do you know if ecc is applied in recon whem the output is Dicom on Philips?

Regarding the basis sets, ignore the one from lcmodel, its a) encrypted and b) its not clear it is suitable. The one from Chris Juchems lab is a much better prospect. I added a function in the newest version of fsl-mrs (v2.0.0) to be able to convert the raw files to a fsl basis set.

basis_tools convert raw_basis_dir --bandwidth xxxx --fieldstrength 3.0 fsl_basis_dir

Just replace xxx with the true bandwidth.

There should be an exam card flag ContrastSpectral CorrectionApply Spectral Correction. If that flag is set to YES, ECC will be applied on the scanner. (I’m not 100% sure about this, but I believe that it is only applied to the water-suppressed spectrum, but not to the water reference itself!).

1 Like

First of all, thank you for your quick answers @wclarke and @admin, that is really great.
Regarding the processing, I looked it up in the exam card and Spectral Correction is set to yes. So, I just applied ECC on the water reference, residual water removal and phase correction. The data looks very nice now.
Regarding the basis sets, I updated conda and converted the .raw. files to a fsl basis set. After that I tried to fit the data, but it didn’t look nice.

I just recognized that our bandwidth is set to 2000 Hz while the one from Chris Juchems is either 2500 or 4000 Hz. So perhaps this is the problem?
Do you have any idea?

Many thanks,

Hi Verena,

Could you try running the following on the converted basis spectra:

basis_tools conj converted_basis/ converted_basis_conj/

And then rerun the fit using --basis converted_basis_conj/

You also need to have a think about what metabolites to include. There are a huge number in those basis set, far more than is sensible to include. Can I suggest you restrict the list to the most visible metabolite peaks for now? E.g. Tau, sI, PCr, PCho, NAAG, NAA, mI, Lac, GPC Glu, Gln, GABA, Cr, Asp, Asc, Ala. This can be achieved by just deleting the irrelavent json files from the basis directory.

You will also need to add some default MM to that basis set as per the documentation here and here.


thank you again for your quick answer @wclarke.
I restricted the list of metabolites, applied:
basis_tools conj converted_basis/ converted_basis_conj/
and added some default MM to that basis with
basis_tools add_set --add_MM basis_without_mm/ basis_with_default_mm/

Then I rerun the fitting with
fsl_mrs--data SPEC_E/fsl_mrs_proc/acc_metab.nii.gz --basis basis_with_default_mm --output fsl_mrs_fit_mm2 --metab_groups MM09 MM12 MM14 MM17 MM21 --report.
But the result was not better.

I think the problem is that the basis set I am using has the wrong bandwidth (4000 Hz instead of 2000 Hz). Because when I visualize my basis spectra it is shifted compared to the peaks of my spectrum.

So, I think I have to resample the basis spectra at the different bandwidth or to simulate my own basis spectra? Unfortunately, I am not very familiar with either of these approaches and would appreciate advice on which is better.

Many thanks,

Hi Verena,

Now I’m not too sure what is going on. FSL should handle the BW resampling. Is the basis set appropriate for the field strength? Could you perhaps send me an example of your data and the basis set.


Hi Will,
yes, sure!
I thought the folders were generated for 3T, but I couldn’t find the information again, so I will a have closer look.
Here you have a folder for one participant, which includes all raw data and preprocessed data of the acc and the right putamen, the last fitting I did and the basis folder (conj and with MM) I used.
SPEC.zip (1.3 MB)

I downloaded the basis set from MR Spectroscopy Basis Sets | MR SCIENCE Laboratory and chose the two folder for Philips PRESS TE 35:
one with BW 2500 and NPts 1024 RawBasis_for_PRESSPhilips_TE_35_BW_2500_NPts_1024.zip (202.4 KB)
and the other one with BW 4000 and NPts 2048 RawBasis_for_PRESSPhilips_TE_35_BW_4000_NPts_2048.zip (644.7 KB).
I could just use the second one for my fitting, because for BW 2500, I got this error:

Thank you for your help! If you need more data, please just ask.


Hi Verena,

Just to be sure: when you ran basis_tools convert, did you specify the bandwidth of your data (2000 Hz) or of the basis set (4000 Hz)? I believe the latter is correct in this context… ie:

basis_tools convert RawBasis_for_PRESSPhilips_TE_35_BW_4000_NPts_2048 --bandwidth 4000 --fieldstrength 3.0 fsl_basis_dir


The error you see for the other basis set (1024 pts, 2500 Hz) is due to the reduced time coverage of that basis set: 1024/2500=0.409 s. It should have at least the same temporal coverage as your data (1024/2000=0.512 s); the 2048 pts/ 4000 Hz basis set meets this criterion (0.512 s)

Hi Alex,

thank you for your help.
No, I run the basis tools with BW 2000 because I thought I should put my true bandwidth in.
I just run the fitting again and it looks much better this time.

Thank you!!

So, here’s what I have so far…

# Convert the basis set (obtained from http://juchem.bme.columbia.edu/mr-spectroscopy-basis-sets), specifying bandwidth of that basis set
basis_tools convert RawBasis_for_PRESSPhilips_TE_35_BW_4000_NPts_2048 --bandwidth 4000 --fieldstrength 3.0 fsl_basis_dir

# Take a meaningful subset of the many available basis components
mkdir fsl_basis_reduced;
cd  RawBasis_for_PRESSPhilips_TE_35_BW_4000_NPts_2048
cp Tau.json sI.json PCr.json PCho.json NAAG.json NAA.json mI.json Lac.json GPC.json Glu.json Gln.json GABA.json Cr.json Asp.json Asc.json Ala.json  ../fsl_basis_reduced
cd ..

mrs_tools vis fsl_basis_reduced


… which gives a reasonable fit without the default MM components

fsl_mrs --data acc_press.nii.gz --h2o acc_press_ref.nii.gz  --basis ../../from_juchem/fsl_basis_reduced

For some reason basis_tools add_set --add_MM breaks though…


Turns out basis_tools add_set --add_MM uses the opposite conjugate sense from the other basis components :roll_eyes:

Hopefully @wclarke can suggest a clearner solution, but my crude workaround is to just take the conjugate of the MM parts:

# add default MM components
basis_tools add_set --add_MM fsl_basis_reduced fsl_basis_with_MM

# take the conjugate of the generated mm components only...
cd fsl_basis_with_MM
mkdir mmbits
mv MM* mmbits/
basis_tools conj mmbits .

The resulting basis set, complete with default MM components:


Then finally:

fsl_mrs --data acc_press.nii.gz --h2o acc_press_ref.nii.gz  --basis ../../from_juchem/fsl_basis_with_MM --output this_had_better_work

Behold! It fits :slight_smile:

Amazing work! That’s exactly right what you did.

Someone was asking about the MM on the FSL JISC mailing list. Sorry about that, at some point I’ve tied myself in knots with the basis phase and frequency convention. They differ between the FSL simulator, LCModel .basis, and LCModel .raw format. I’ll get that patched up in the next release.

One thing you need to do with that final fit is add
-metab_groups MM09 MM12 MM14 MM17 MM21
to ensure the MM can broaden separately. Details are in the documentation.


thanks to both of you for your amazing help.
I was able to reproduce the results and add a T1 image to the fitting. The output looks good. :smile:

Thank you very much!

Great, please do ask about anything else!

Hello again,
two more questions actually came to my mind.
First, I noticed that in the reports individual metabolites cannot be determined (999 in the table).
For example in the left dlpfc Ala, Glen, Gly, MM14, NAAG and PCho can not be defined.

Since it varies between regions and subjects, I was wondering what that could be due to. Is it simply due to the location of the individual voxel or can I influence this by preprocessing after all?

Furthermore, I wanted to ask if the baseline looks good like this, as it is slightly shifted down or skewed in some subjects. Is this ok or do I still need to change something in the analysis?
For example here or in the plot above:

Thank you for your help and feedback.

Many greetings,