Hi MRS experts,
I am learning to use FSL_MRS now. We are fitting the spectrum of a phantom consisting of PVP molecules. The preprocessing works well so far and we got a well-shaped water reference peak and some PVP peaks. How could export the spectrum for manual Lorentzian fitting? Thanks.
Best,
Ruifeng
Hi @ruifengd,
Sorry, I’m not 100% certain what you mean. Do you want to load the data from the processed NIfTI-MRS file?
In python you can use FSL’s methods
from fsl_mrs.utils import mrs_io
data = mrsi_io.read_FID('path/to/processed.nii.gz')
Then you can access the data using data[:]
. For other languages see our minimal examples.
Thanks.
After loading, data[:] gives the time-domain signals. I want to export the spectrum with x-axis in units of ppm.
You can take the FFT. There are two ways you could go about this in FSL
-
from fsl_mrs.utils.misc import FIDToSpec
spectra = FIDToSpec(data[:], axis=3)
-
mrs_list = data.mrs()
first_spectrum = mrs_list[0].get_spectrum()
ppm_axis = mrs_list[0].getAxes()