This mini practical covers MRSI fitting from Chapter 4. It does not relate to a particular box. MRSI fitting is the same as SVS fitting, except the fitting is done in each voxel separately. This practical covers some additional considerations for MRSI fitting in FSL. As with all these mini-practicals, instructions on how to run FSL commands can be found on the Getting Started page.
Please download the dataset for this example here:
Data download
Once it is downloaded, move it to your preferred working directory and unzip it there.
unzip data_ch4_mrsi.zip cd data_ch4_mrsi
Now we move on to fitting multi-voxel MRS imaging (MRSI) data. We provide a dataset that has already been preprocessed, and we will only be concerned here with the fitting and visualisation of the results.
cd mrsi
First let us look at the provided MRSI data. We do this using FSLeyes, which
allows us to seemlessly look through different voxels. In the command below, we load
FSLeyes with the -smrs
flag, indicating that we are using the MRS plugin.
We will also load the structural image alongside the data:
fsleyes -smrs T1.anat/T1.nii.gz mrsi.nii.gz &
You should see that this is a multi-voxel, single slice dataset. Try to navigate through the different voxels and examine the spectra. You will need to tick the mrsi data in the Overlay list (MRS view panel). Click around in different voxels to get a feel for the overall data quality.
To fit a model to these data, we first need a basis set. There is one provided with this dataset
mrsi_basis
:
basis_tools info mrsi_basis
We can also visualise the basis set.
basis_tools vis mrsi_basis &
This should look like a regular basis set, but you will notice that there is no macromolecule spectrum. The fitting will be pretty bad without those, so we will use the default macromolecule spectrum provided with FSL-MRS, which we will add to this basis set.
We add the default macromolecules using basis_tools add_set --add_MM
.
basis_tools add_set --add_MM mrsi_basis mrsi_basis_mm
If we look at the modified basis set we will now see several broad peaks added to the right hand side of the spectrum. In the legend these will be labelled as five new basis spectra: MM09-MM21.
basis_tools vis mrsi_basis_mm &
Before we start fitting, we need to get partial volume estimates of tissue types, just like we did for SVS fitting. The command line for doing this is very similar:
mrsi_segment --anat=T1.anat --output . mrsi.nii.gz
You should be able to see that unlike for SVS where the output was a single JSON file, here we get 3 NIfTI files (one per tissue type). Load them in the same FSLeyes session and see if they make sense. You should be able to see that they are tissue fractions resampled into the MRSI slice.
We are now ready to run the fitting command.
Read the command below and make sure to understand all the
different inputs (you can run fsl_mrsi --help
to get more details on what the inputs are).
The --metab_groups MM09 ...
command ensures that each of the macromolecule basis spectra
we added above can have its own shift and broadening. The --combine
options sum highly correlated
metabolites.
This may take a few minutes (and up to 20-30 minutes on the FSL Course AWS machines) to run depending on the hardware and number of threads
available. If you don't want to wait, you will find prepared results in prepared_results/fsl_mrsi_out
.
fsl_mrsi --data mrsi.nii.gz \ --mask mask.nii.gz \ --basis mrsi_basis_mm \ --output fsl_mrsi_out \ --metab_groups MM09 MM12 MM14 MM17 MM21 \ --baseline spline,moderate \ --combine Cr PCr \ --combine NAA NAAG \ --combine PCho GPC \ --combine Glu Gln \ --tissue_frac mrsi_seg_{wm,gm,csf}.nii.gz \ --h2o wref.nii.gz \ --report
Once the fitting is done, you can open the report like we did for the SVS data:
firefox fsl_mrsi_out/report.html
This should look familiar. However, you may notice that the report is only telling us about fitting a single spectrum, when in fact we have run it on a number of voxels. The interactive HTML in fact only shows the results of the fitting for the average of all the voxels inside the mask. In the next section, we will look through the results in each voxel using FSLeyes.
If you've already closed FSLeyes, open it again in MRS mode and load the mrsi data alongside the T1:
fsleyes -smrs T1.anat/T1.nii.gz mrsi.nii.gz
Using the menu bar, select Tools->Load FSL-MRS fit
and choose the output folder created
by the fsl_mrsi
command (should be fsl_mrsi_out
).
Now you should be able to see a new panel called "FSL-MRS Results" where you can choose which results to display - try selecting a metabolite from the list to view a metabolite map. In the "MRS View" panel you should be able to see the model predictions and baseline. Add the data plot by ticking mrsi in the Overlay list of the MRS View panel on the right. You can look at individual voxels by simply clicking through in the Ortho View panel.
FSLeyes's MRS plugin recognises the different files found in the results folder. You can look at individual metabolite maps (with different types of normalisation/quantitation), you can also look at QC maps (e.g. SNR). Play around and try to familiarise yourself with the output. Compare the fit for high SNR vs low SNR voxels. Compare voxels at the edge of the ROI to voxels in the middle.
The End!