mono_t2: Compute a monoexponential T2 mapĀ¶


% This m-file has been automatically generated using qMRgenBatch(mono_t2)
% Command Line Interface (CLI) is well-suited for automatization
% purposes and Octave.
% Please execute this m-file section by section to get familiar with batch
% processing for mono_t2 on CLI.
% Demo files are downloaded into mono_t2_data folder.
% Written by: Agah Karakuzu, 2017
% =========================================================================


qMRinfo('mono_t2'); % Describe the model
  mono_t2: Compute a monoexponential T2 map

Mono-exponential fit

SEdata          Multi-echo data, 4D volume with different echo times in time dimension
(Mask)          Binary mask to accelerate the fitting (optional)

T2              Transverse relaxation time [s]
M0              Equilibrium magnetization

TE Array [nbTE]:
[TE1; TE2;...;TEn]     column vector listing the TEs [ms]

FitType         Linear or Exponential
DropFirstEcho   Link Optionally drop 1st echo because of imperfect refocusing
Offset          Optionally fit for offset parameter to correct for imperfect refocusing

Example of command line usage:
Model = mono_t2;  % Create class from model
Model.Prot.SEData.Mat=[10:10:320]'; %Protocol: 32 echo times
data = struct;  % Create data structure
data.SEData = load_nii_data('SEData.nii.gz');
FitResults = FitData(data,Model); %fit data

Reference work for DropFirstEcho and codeOffset options:

Reference page in Doc Center
doc mono_t2


a- create object

Model = mono_t2;

b- modify options

         |- This section will pop-up the options GUI. Close window to continue.
|- Octave is not GUI compatible. Modify Model.options directly.
Model = Custom_OptionsGUI(Model); % You need to close GUI to move on.


a- load experimental data

         |- mono_t2 object needs 2 data input(s) to be assigned:
|-   SEdata
|-   Mask
data = struct();
% SEdata.nii.gz contains [260  320    1   30] data.
% Mask.nii.gz contains [260  320] data.

b- fit dataset

           |- This section will fit data.
FitResults = FitData(data,Model,0);
=============== qMRLab::Fit ======================
Operation has been started: mono_t2
Elapsed time is 0.027740 seconds.
Operation has been completed: mono_t2

c- show fitting results

         |- Output map will be displayed.
|- If available, a graph will be displayed to show fitting in a voxel.
|- To make documentation generation and our CI tests faster for this model,
we used a subportion of the data (40X40X40) in our testing environment.
|- Therefore, this example will use FitResults that comes with OSF data for display purposes.
|- Users will get the whole dataset (384X336X224) and the script that uses it for demo
via qMRgenBatch(qsm_sb) command.
FitResults_old = load('FitResults/FitResults.mat');

d- Save results

         |-  qMR maps are saved in NIFTI and in a structure FitResults.mat
that can be loaded in qMRLab graphical user interface
|-  Model object stores all the options and protocol.
It can be easily shared with collaborators to fit their
own data or can be used for simulation.
FitResultsSave_nii(FitResults, 'mono_t2_data/SEdata.nii.gz');
Warning: Directory already exists.


   |- This section can be executed to run simulations for mono_t2.

a- Single Voxel Curve

         |- Simulates Single Voxel curves:
(1) use equation to generate synthetic MRI data
(2) add rician noise
(3) fit and plot curve
      x = struct;
x.T2 = 100;
x.M0 = 1000;
Opt.SNR = 50;
% run simulation
figure('Name','Single Voxel Curve Simulation');
FitResult = Model.Sim_Single_Voxel_Curve(x,Opt);

b- Sensitivity Analysis

         |-    Simulates sensitivity to fitted parameters:
(1) vary fitting parameters from lower (lb) to upper (ub) bound.
(2) run Sim_Single_Voxel_Curve Nofruns times
(3) Compute mean and std across runs
      %              T2            M0 = [1e+02         1e+03]; % nominal values
OptTable.fx = [0             1]; %vary T2... = [1             1]; %...from 1
OptTable.ub = [3e+02         1e+04]; 300
Opt.SNR = 50;
Opt.Nofrun = 5;
% run simulation
SimResults = Model.Sim_Sensitivity_Analysis(OptTable,Opt);
figure('Name','Sensitivity Analysis');
SimVaryPlot(SimResults, 'T2' ,'T2' );