SpICeS User Guide - dwong263/MAGIQ GitHub Wiki
The Spectroscopy Interactive Component Selector is a program that allows you to visualize fitting results generated by the fitMANSuite. You can load a .dat
file and the corresponding .out
file and visualize each component of the fitted model. This allows you to visually assess whether or not you've achieved a good fit, as well as generate figures for posters, presentations, and papers.
First set your working directory by clicking the Set Working Directory button. Choose the directory which contains your .dat
file and your .out
file. Next, select the .out
file by clicking the Browse button in the Output File panel. Load the file in by clicking the Confirm button. Finally, select the .dat
file by clicking the Browse button in the In-Vivo Spectra panel and load the file by clicking Confirm.
Once the file has been loaded, you'll notice that the list of Available Metabolites will populate. Each item in this list is a component of the fitted model that you can visualize.
To plot your data, simply hit the Plot button at the bottom of the user interface. The blue line is the data, the orange is the fitted model, and the green line is the residual.
If you want to visualize different components of the model, you can define visualization groups to do so. You can define the group by typing in the Define Visualization Groups panel. A visualization group is defined as comma-separated list, with the first item of the list being the name of the visualization group, and all other items being group members.
<Group Name>, <group member 1>, <group member 2>, <group member 3>;
Ensure you are selecting items in the Available Metabolites list as group members. The semicolon (;
) denotes the end of a visualization group. When plotting a visualization group SPICeS simply adds the lineshapes of all group members together and plots the group underneath the full spectrum. For example, suppose the following visualization group was defined:
NAA+Cr, naa_acetyl, naa_aspartate, creatine_N(CH3), creatine_X;
The resulting plot will be:
You can define multiple groups to visualize multiple components of the model at the same time:
In this example, the following visualization groups were defined:
MM, lm1,lm2,lm3,lm4,lm5,lm6,lm7,lm8,lm9,lm10,lm11,lm12,lm13,lm14;
NAA, naa_acetyl, naa_aspartate;
NAAG, naag_acetyl, naag_aspartyl, naag_glutamate;
Lac, lactate;
Cr, creatine_N(CH3), creatine_X;
Cho, choline_N(CH3)3_a, choline_N(CH3)3_b, choline_1-CH2_2-CH2;
Myo, myoinositol;
Glc, d-glucose-alpha;
PEth, peth;
Scyllo, scyllo-inositol;
Tau, taurine;
Glu, glutamate;
GSH, glutathione_cysteine, glutathione_glutamate, glutathione_glycine;
Notice that each visualization group was typed on their own separate line.
You can save the visualization groups that you have defined into a *.vis
file by clicking the Save Visualization Groups button. The saved *.vis
file is simply a text file that contains a copy of what you typed into the Define Visualization Groups panel.
Conversely, you can load in a previously saved set of visualization groups by clicking the Load Visualization Groups button and selecting the *.vis
file you want to load.
There are several plotting parameters that can be adjusted. Note that these parameters only affect the visualization of the spectrum and model components in the Plot panel. It does not actually alter the data whatsoever.
Parameter | Description |
---|---|
VSHIFT |
Changing VSHIFT changes the amount of vertical space between model components |
HSHIFT |
Changing HSHIFT changes the amount of relative horizontal shift between the fitted model (orange) and the acquired data (blue) |
FT1 |
FT1 is the number of sample points at the beginning of the free induction decay to skip. Skipping points at the beginning of the free induction decay allows to apply a first order phase shift correction. See more details below. |
sfactor |
Changing sfactor shifts the fitted model, the model components, and the acquired data along the frequency axis. A positive value shifts the spectrum to the left while a negative value shifts the spectrum to the right. |
pfactor |
Changing pfactor applies a zero order phase correction. |
lb |
lb specifies the damping factor of an exponential filter applied to the visualization. An lb value of 0 means that no exponential filter is applied. |
Suppose you have some data that looks like this:
This data has a first-order phase (i.e. a phase that depends on frequency linearly), a result of the acquisition gradient turning on slightly before the center of the stimulated echo. To visualize the data nicely, you can remove the points at the beginning of the signal, such that the first point of the signal is now the center of the stimulated echo.
To do this, ensure that the Extrapolate to Zero checkbox is not checked, and type the number of points you want to remove in the FT1
field.
Here is the data again with an FT1
value of 3
:
Suppose you have some data that looks like this:
Notice in this plot that the acquired data as a little bit of a baseline distortion, causing the fitted model and the data not to line up properly in the visualization.
To fix this, specify an FT1
value and ensure that the Extrapolate to Zero checkbox is checked. When plotting, SPICeS will now take replace FT1
number of points at the beginning of the acquired data signal with the corresponding points from the fitted model signal. For example, if FT1
had the value 3
, the first three points of the acquired data signal would be replaced with the first three points of the fitted model signal prior to plotting.
Here is the data again with an FT1
value of 6
and Extrapolate to Zero checked:
The other parameters that are just for your information and cannot be adjusted. These include:
Parameter | Description |
---|---|
B0 | The reference frequency of the scanner used to acquire the data. |
Dwell Time | The time between sample points of the data. |
Samples | The total number of sample points of the data. |
To save the visualization, click the Floppy Disk icon. You can save the visualization in a variety of formats, including the *.eps
and *.svg
vector formats which can be edited in programs such as Inkscape or Canvas.