mp2rage: Compute a T1 map using MP2RAGEĀ¶


% This m-file has been automatically generated using qMRgenBatch(mp2rage)
% 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 mp2rage on CLI.
% Demo files are downloaded into mp2rage_data folder.
% Written by: Agah Karakuzu, 2017
% =========================================================================


qMRinfo('mp2rage'); % Describe the model
  mp2rage: Compute a T1 map using MP2RAGE


(MP2RAGE)       MP2RAGE UNI image.
(B1map)         Excitation (B1+) fieldmap. Used to correct flip angles. (optional)
(Mask)          Binary mask to a desired region (optional).
(INV1mag)       Magnitude image from the first GRE readout (optional).
(INV1phase)     Phase image from the first GRE readout (optional).
(INV2mag)       Magnitude image from the second GRE readout (optional).
(INV2phase)     Phase image from the second GRE readout (optional).
T1              Longitudinal relaxation time [s].
Corrected for B1+ bias IF the B1map is provided.
R1              Longitudinal relaxation rate [1/s]
Corrected for B1+ bias IF the B1map is provided.
MP2RAGE         Combined MP2RAGE image if INV1mag, INV1phase, INV2mag, INV2phase
images were provided but MP2RAGE was not.
MP2RAGEcor      MP2RAGE image corrected for B1+ bias if B1map is provided.

Reference page in Doc Center
doc mp2rage


a- create object

Model = mp2rage;

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

         |- mp2rage object needs 7 data input(s) to be assigned:
|-   MP2RAGE
|-   INV1mag
|-   INV1phase
|-   INV2mag
|-   INV2phase
|-   B1map
|-   Mask
data = struct();

% MP2RAGE.mat contains [143  218    2] data.
% B1map.mat contains [143  218    2] data.
data.MP2RAGE= double(MP2RAGE);
data.B1map= double(B1map);

b- fit dataset

           |- This section will fit data.
FitResults = FitData(data,Model,0);
=============== qMRLab::Fit ======================
Operation has been started: mp2rage
Warning: =============== mp2rage::b1correction ===========
B1 data is not in [0-2] range. B1map magnitude will be scaled down.
Elapsed time is 0.302942 seconds.
Operation has been completed: mp2rage

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.
Warning: Directory already exists.


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

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
% Not available for the current model.

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
% Not available for the current model.