Spectral modelling in spectrIm-QMRS - General remarks
The default fitting engine of the 64-bits version of spctrIm-QMRS is TDFDFit, which is a non linear least squares fitting algorithm. TDFDFit enables the fitting of in vivo MR-spectra using prior knowledge alike LCModel, Quest, etc.
An iterative nonlinear least-squares fitting algorithm in the frequency domain using time domain models for quantification of complex frequency domain MR spectra is presented. The algorithm allows incorporation of prior knowledge and has both the advantage of time-domain fitting with respect to handling the problem of missing data points and truncated data sets and of frequency-domain fitting with respect to multiple frequency-selective fitting. The described algorithm can handle, in addition to Lorentzian and Gaussian line-shapes, Voigt and nonanalytic lineshapes. The program allows the user the design of his own fitting strategy to optimize the probability of reaching the global least-squares minimum. The application of the fitting program is illustrated with examples from in vivo 1H– 31P-, and 13C-MR spectroscopy.
The graphical user interface to define prior knowledge models in a fast and efficient way are decribed on this html-page and the linked html-pages. The information here should enable you to make very quickly prior knowledge models which can be applied to loaded MRS(I) date in spectrIm-QMRS.
The Prior Knowledge Modelling Window
If the user selects via the main menu of spectrIm-QMRS or via the toolbar button to create and edit a new TDFDFit-model, the following, so called "TDFDFit prior knowledge and modelling window" appears:
On top a little window is shown which states values which charactirize the loaded spectral data set, and are extracted (as far as possible) automatically from the loaded Dicom MRS(I) dataset.
The following data entries are available:
- Fit model name : enter the name of the model as a string without blanks and characters which cannot be used in filenames
- Nucleus : select the nucleus of the spectrum to be modelled [drop down list]
- Resonance frequency : resonance frequency as provided in the Dicom file
- PPM in spectral center : sets the value in ppm units in the center of the spectrum (e.g. often 4.7 ppm for 1H)
- Number of samples : here the number of complex samples are indicated. Do not change the value here, since unexpectred behaviour may result.
- Acquisition bandwidth : the number of complex acquistion points per second. Is obtained from the Dicom file loaded in spectrIm-QMRS.
- First order phase : first order phase in degrees over spectral width
- Data truncation point : point number in time domain after which the data should be cut. Note that this will influence the spectral resolution, but will improve computation time.
- Number of points to ignore : ignore indicates the number of points which should be set to zero at the begin of the free induction decay or echo which should be set to zero during fitting.
Please note that in general the parameters that show up in the popup window can be used, and result in valid models.
After pressing the "Apply" button the TDFDFit modelling window becomes visible:
Adding Voigt-lines to the Model
The model is empty at start, and can be filled with spectral components of different types:
- Voigt lines : which which has a Lorentzian as well as Gaussian lineshape
- Numeric pattern : this is either a component of a simulated basisset or a measured spectrum of a metabolite, e.g. Cr.
- Parametric pattern : this is data structure which models a spectrum of a metabolite, by a linited amount of Voigt lines (e.g. Cr modelled by two Voigt lines).
- Metabolite : is a concatination of Voigt lines, numeric patterns, parametric patterns
The following example should demonstrate how to add Voigt lines to the model. The simplest and fastest way to add a Voigt line to the empty model is by pressing the "+ Voigt" toolbar button
If one presses the toolbar button "+ Voigt" the spectrum view below will interpret the next mouse click as the position and amplitude of the Voigt line to be added. Here the user clicked at the maximum of the NAA resonance and the blue Voigt line will appear in the spectrum as well as an entry "Line" in the model-tree view on the leftside of the GUI:
For each Voigt line to add the "+ Voigt" button must be pressed. In the case displayed below the user pressed a total of nine times to get an intial guess for the prototype spectrum:
The Voigt lines added get a default name "Line_xx" where xx is a numeric value (see above). With this information the prototype spectrum could be fitted. The optimization of this model with 9 Voigt line model can be done by pressing the "Optimize prototype model" on the lower left side of the GUI. After the spectral model is optimized, the GUI looks like following:
Imposing Prior Knowledge to a Model
The model above was optimized without imposing any prior knowledge to the model. If no prior knowledge modelling is applied, the model has the highest degree of freedom, and can adapt itself very nicely to the data. However, under this conditions, the optimal model parameters often do not reflect physical meaningfull solutions. The fit can look great, the parameters not making any sense.
The solution to this problem is an approach which is already known for a very long time, and that is of imposing so-called "prior-knowledge" to the spectral model.
The idea dates back to 1990 where de Graaf et al. propose this prior knowledge incorporation in their paper entitled "Improved quantification of in vivo 1H NMR spectra by optimization of signal acquisition and processing and by incorporation of prior knowledge into the spectral fitting". The idea was also applied in LCModel published in 1993. The fitting engine used in "spectrIm-QMRS" is TFDFfit (1998). It has many similarities with LCModel; e.g. that fitting is performed in frequency domain, and that measured as well as simulated basis sets can be used for creating the model spectra etc.
Applying "prior knowledge" means simply said that a priori knowledge on the spectrum is used in the model. Each Voigt line can be modelled by 5 parameters. For a model consisting of N Voigt lines 5N parameters must, in principle, be fitted. For instance the a priori known relative resonance frequency differences between all resonances in the spectrum can reduce an N-line model fit from a 5N-dimensional fit, to a 4N+1 dimensional fit.
Similarly, prior knowledge can be applied to common phase difference between lines (or basisset components (also referred to as patterns in spectrIm-QMRS), common Lorentzian and Gaussian linewidth parameters, and amplitude ratios within multiples. It is often possible to reduce the dimensionality of an N-component model from 5N to N + 4. This not only makes the computation time of the fitting process much shorter, it also causes the variances in the fitted parameters (the so-called Cramér Rao bounds ) to be smaller.
NOTE: Although application of prior knowledge lowers the variance and is highly recommended for quantification of spectra, keep, however, in mind that there is also the so-called bias variance tradeoff to keep in mind: reduction of the model parameters to the minimum might be good for the variance, however if the model does not resemble the physical reality, the fitted model parameters will be biased.
Prior knowledge editor
Now we will describe how to do the actual prior knowlegde for the 9 line model defined above. The same prototype spectrum as above is used again, but now 11 lines are selected again by clicking 11 times on the maxima of the peaks in the spectrum, and the GUI looks the nearly the same as before. Let us focus on the interactive prior knowledge editor marked in the red box:
Before we optimize this model, we first change the names of the peaks to something more understandable names. This can most simple be achieved by clicking the right mouse button. The context menu of the spectrIm-QMRS model tree pops up, and a by selecting "Rename node" the selected spectral node name can be changed.
After proper renaming is done, the definition of the prior knowledge can be performed (but not necessarily in this order). Now let us focus on the drop down menus as indicated in the redbox of figure below:
Prior knowledge can be determined for each parameter type separately. Let's select the "NAA" tree node in the tree node. Than select the upper dropdown menu as indicated in green in the figure above. The user the first entry is named "Free". If this option is selected the NLLS fitting algorithm will fit this parameter. If "NAA" is selected while in the treeview above also the tree item "NAA" than the fittin algorithm will not change this parameter at all: at the end of the fit, the numeric value will be identical before and after the fit. In other words this parameter is untouched. If any other item of the dropdown list is selected, the value of "NAA" changes depending on how the free parameter of the refence spectral component is changing. Note that it does not make sense to set a reference to a parameter which is not fitted itself.
In the following screenshot NAA has been used as reference of all other spectral components. The GUI will look as follows:
Now we are set to optimize the prototype model.
First save the model first via the file menu: "File -> Save TDFDFit model".
The model can be optimized by pressing the "Optimize prototype model" button. Note that we expect a less well fitted spectrum now, due to the substantial lower degree of freedom of the model. Although, in this case, the spectrum is still very well fitted, despite the massively reduced degree of freedom. One can inspect the obtained components after the fit.
Now select the "Cr-CH3" tree view node. The editor values and the drop down menus will change there values as a result of this. The selected spectral component will be draw in red in the spectrum on the righthand side, the sum model spectrum in blue, and the prototype spectrum in black.
Please verify for yourself that for each tree view node name unequal to "NAA" the offset, phase and Lorentzinan line width parameter have the same numerical value. The Gaussian linewidth parameters of all components have unchanged value equal to the initial value (zero).
If the optimized spectral model seems to be an accurate enough model of the prototype model, the model needs to be saved by selecting the file menu item "File->Save TDFDfit model". This model can now be applied to any measured dataset of the same type, i.e. the same field strength, same machine, and same scanner measurement parameters.
Follow this Applying prior knowledge models to see how one can use this model spectrum in all day clinical cases (or study cases).