Quantitative Imaging

From VISTA LAB WIKI

Jump to: navigation, search

This page explains how to arrange SPGR and SEIR data from the magnet, align each separately, and fit T1 M0 maps estimating the HLF. We documented our procedure in a run script under each subject's directory.


Contents

[edit] Scan Quantitative T1 and PD

the scans are based on set of spoiled gradient eco (SPGR in GE scanner) and a set of spin echo inversion recovery with epi readout (SEIR-epi) the SPGR are used to fit the T1 and PD to fit the signal equation we need at list two SPGR with different flip angles (4 20). we recommend using four flip angle (4, 10 20 30). in 1mm^3 resultion the four scans will take about 20 min 2mm^3 will take about 9 min the SEIR is used to fit the B1 map. the basic idea is to use the unbiased SEIR T1 to correct the biased SPGR T1. To fit SEIR we need at list 3 inversion time (IT). we recommend to use for ( 50 400 1200 2400 ms). this should will take about 5 min.

scanning instruction
SPGR

  1. keep the TR as low so the scan will be fast. long TR will make the SNR better but will result in long scans. in 3T we recommend TR of 10ms and in 1.5T we recommends 14ms.
  2. keep the TE as small as possible in GE scanner select TE= minimum. we used TE=2 longer TE might crate a unwanted T2* weighting.
  3. don't use Fast SPGR for reason we don't now we can only fit T1 maps but not PD with those images. those images are faster but with lower SNR
  4. make sure to use multi coil receiver array like 8-channels or 32-channels.
  5. make sure that the magnet save the different coils images. this is NOT the scanner default, to set it in GE scanner change the C.V. saveinter=1.

an induction to know that you set it right will be that the magnet shows many strange images when you scan (each coil image) and not only the nice brain images. we also recommend to save the P. file (but this information are currently not in use, to set it in GE scanner change C.V. autolock=1.

  1. make sure that the scanner keep the pre-scan parameter the same fro all the SPGR scans. In GE magnets the way to do it is by useing manual pre-scan without any parameter change from the second SPGR and on. this will make the scanner to use the pre-scan parameter that where define before (for the first scan). We recommend that the first scan will be the one with the highest signal so you won't hit the any coil sealing effects (in the recommended flip angles set this is the 10 degree scan)


SEIR

  1. keep the TR as low so the scan will be fast. long TR will make the SNR and the fit better but will result in long scans. we recommend that is a bit longer then the longer IT, TR=2450ms.
  2. keep the TE as small as possible in GE scanner select TE= minimum full.
  3. resolution can be law we used 128x 128 inplan with slice of 4 mm. we used 20 slices that cover most but not all the brain.
  4. make sure you use a slub excitation. in GE mark the imaging option sequential and change the C.V. a_gzrf0=0. An induction for that will be if the scan time is not changing for the different IT.
  5. make sure that the scanner keep the pre-scan parameter the same fro all the SEIR scans. In GE magnets the way to do it is by useing manual pre-scan without any parameter change from the second SEIR and on. this will make the scanner to use the pre-scan parameter that where define before (for the first scan). We recommend that the first scan will be the one with the highest signal so you won't hit the any coil sealing effects (in the recommended inversion time set this is the 2400ms).

[edit] Download the data

Data collected from the CNI can be downloaded via the NIMS database.

We only need the .dicom files but it's OK to have all the other files as well (it only requires more space - a lot more).

If you download the data fomr the CNI website you should change the permissions so every one in the lab will be able to work with the data. You can do this by changing to the directory were you saved the data and run the following command in a shell:

 chmod -R 775 nameOfDirectgory

[edit] Fit the data

The user can run all the fitting process by a single call in Matlab. using mrQ_run.m the code assume Sun grid engine (SGE) Freesurfer and Ants are defined. it is posible to run the code without those softwares, but the user have to change the code accordingly.
setting

  1. the code was checked only for Linux environment
  2. use Matlab with version 2010 or newer
  3. update your mrVista repositories . in particular the mrQ mrDiffusion and kendrick's repositories
  4. include a free surfer insulation. have a free surfer directory in your ./bathch file (see freesurfer page)
  5. include a Ants insulation, and update the /bathch file for Ants
  6. include a SGE insulation, and update the /bathch file for SGE, define an output directory (see SGE page)
  7. the function assume the data are arrange in the same way as it is in the Stanford CNI magnet. the data should be saved as niifti files and a dicom directory with dicom are also exist. This convention may be different for each scanner. it is good idea to cheack this and maybe arrange the data with this conventions or edit the first function that call the raw directory ( mrQ_arrangeData.m)

The

  mrQ_run(RawDir,arrangeRawFlag,SEIR_seriesNumbers,SPGR_seriesNumbers,refIm,sub,freesurfer,channels,useNiftiFlag,alignFlag,...
  complexFlag,useAbs,mmPerVox,interp,skip,coilWeights,clobber)

Below is a list of the input variable and a description of what they are:

 % INPUT VARIABLES:
 %   RawDir            - The path of the directory containing the raw MR
 %                       data.the function assume the data are arrange in the same way as it is in the Stanford CNI magnet. 
 %                       the data should be saved as niifti files and a dicom directory with dicom are also exist.
 %                       This convention may be different for each scanner. 
 %                       It is good idea to cheack this and maybe arrange the data with this conventions
 %                       or edit the first function that call the raw directory ( mrQ_arrangeData.m)
 % 
 %   arangeRawFlag     - Needs to be 1 to move every file from the original
 %                       magnet directory (dataDir) to a raw directory
 %                       inside it (if this was done set = 0, or empty).
 % 
 %   SEIR_seriesNumbers- A cell array containing the SEIR_epi series numbers
 %                       from dataDir/raw.  (if this input exists a SEIR dir
 %                       will be created with data and fitT1_GS directories
 %                       inside it). The scan dicom will be extracted from
 %                       the data Dir. If SEIR_epi already exists and a new
 %                       one will be created.
 % 
 %   SPGR_seriesNumbers- A cell array with the SPGR series numbers from
 %                       dataDir/raw. This input creates a SPGR directory
 %                       with data inside it. The scan dicom will be
 %                       extracted from the data Dir. If SPGR already exists
 %                       a new one will be created.
 %
 %  refImg              Different ref images can be used as an input (refImg is a
 %                      path to a nifti image). If there is no refImg (refImg is
 %                      empty) then the SPGR with a similar contrast to the T1
 %                      weighted image will be selected and the user will be
 %                      asked to mark the ac/pc using mrAnatAverageAcpcNifti
 %
 %       sub            - Subject name used for different file names
 %                       like the SGE. if the name is not porvided we will take it for the
 %                        raw directory
 %
 %   freesurfer         -an exssisting freesurfer segmentation aparc+aseg in
 %                       nii.gz format. if this is not provied then freesurfer segmentation on a
 %                       syntetic T1w image that we will calculate from the data. the freesurfer
 %                       segmentation may take 24 hours. freesurfer segmentation may failed and
 %                       the user need to cheack if it is.
 % 
 %   channels          - A 1xN array (where N is the number of series). If
 %                       any of the SPGR data has multi-channel dicoms make
 %                       the series number equal to the number of channels.
 %                       The default is zero.
 % 
 %   useNiftiFlag      - A 1xN logical array (where N is the number of
 %                       series). If it is set to 1 the code will use the
 %                       nii.gz file and the channel variable input is not
 %                       used. *** WHY USE THIS OR DON'T? ***
 %
 %   alignFlag          - if to align the SEIR data set the defult is 1 (yes).
 %
 %  complexFlag         - if the SEIR data is complex and not only magnitude the defult is 0 (no).
 %
 %   useAbs              -if the SEIR data is complex but only magnitude need to be used defult is 0 (no).
 %
 %   mmPerVox           - The resolution at which you want to resample the data.
 %                        This is a 3X1 (1x3?) vector. If empty, the dicom
 %                        resolution will be used-this does not have to be the
 %                        native scan size as the magnet output % is zeroed. The
 %                        saved directory will have the resolution in its name.
 %
 %  interp              -Interpolation method. [Default = 1]
 %                       1 = trilinear,
 %                       7 = b-spline (resampling algorithm)
 %
 %  skip                -you can skip any of the scans in spgrDir if you want by
 %                       passing in a 1xn vector of scans to skip.
 %
 %  coilWeights         -determine optimal coil weights and save them out.
 %                       Default = true; when we use more then 8 chanels
 %                       coils
 %
 %  clobber              -Overwrite existing data and reprocess. [default = false]
 %
 %Example :
 %
 %RawDir='/biac2/wandell2/data/WMDevo/adult/133_KK/QuantativeImaging/20120308_2002';
 %SEIR_seriesNumbers={'0005' '0006' '0007' '0008'};
 %SPGR_seriesNumbers={'0010' '0011' '0012' '0013'};
 %
 %mrQ_run(RawDir,[],SEIR_seriesNumbers,SPGR_seriesNumbers,[],'133_KK')


we will provide below description for most of the key function in the fitting process. More details can be found in mrQ_run.m function and in the function within.

[edit] Arrange the Data

The data comes in from the scanner with little organization. We would like the data to be organized for easy access, so first we arrange the SPGR and SEIR data from the magnet by using the following function call:

 [mrQ]=mrQ_arrangeData(dataDir,arrangeRawFlag,SEIR_seriesNumbers,SPGR_seriesNumbers,channels,useNiftiFlag)

%

Below is a list of the input variable and a description of what they are:

% 
% INPUT VARIABLES:
%   dataDir           - The path of the directory containing the raw MR
%                       data. the function assume the data are arange in
%                       the way the Stanford CNI. the data should be saved
%                       as niifti files and a dicom directory with dicom
%                       are also exsist. 
% 
%   arangeRawFlag     - Needs to be 1 to move every file from the original
%                       magnet directory (dataDir) to a raw directory
%                       inside it (if this was done set = 0, or empty).
% 
%   SEIR_seriesNumbers- A cell array containing the SEIR_epi series numbers
%                       from dataDir/raw.  (if this input exists a SEIR dir
%                       will be created with data and fitT1_GS directories
%                       inside it). The scan dicom will be extracted from
%                       the data Dir. If SEIR_epi already exists and a new
%                       one will be created.
% 
%   SPGR_seriesNumbers- A cell array with the SPGR series numbers from
%                       dataDir/raw. This input creates a SPGR directory
%                       with data inside it. The scan dicom will be
%                       extracted from the data Dir. If SPGR already exists
%                       a new one will be created.
% 
%   channels          - A 1xN array (where N is the number of series). If
%                       any of the SPGR data has multi-channel dicoms make
%                       the series number equal to the number of channels.
%                       The default is zero.
% 
%   useNiftiFlag      - A 1xN logical array (where N is the number of
%                       series). If it is set to 1 the code will use the
%                       nii.gz file and the channel variable input is not
%                       used. 
%
% OUTPOUTs             - mrQ structure will be saved. the raw data will be move to raw Dir.
%                       the SPGR will be saved in SPGR dir.
%                       the SEIR in SEIR DIR. 
%                       each data set will have it's own Di structure for the anaysis.
                      

Maybe we should provide an example file tree:

[edit] Fitting the SEIR EPI data

There are two functions that we are working with:

mrQ_initSEIR
mrQ_fitSEIR_T1


[edit] mrQ_initSEIR

This function will arrange the data for T1 in the data directory, and save it as a file called SEIR_Dat.mat

[data extra xform] = mrQ_initSEIR(SEIRdir,alignFlag,complexFlag,useAbs,niilistFM);

Loads all dicom data found within 'SEIRdir' into a single matrix ('data'), aligns each series to the first, rearranges the 'data' matrix and generates a SEIR_Dat.mat file containing all the DICOM image data in the variable 'data' (4-D double) as well as the transform used to align the SEIR series in the variable 'xform'. Also in the .mat file is the variable 'extra' which contains 'tVec' - (1xN) the inversion times for each series (N) and 'T1Vec' - [1:5000]. Each of these variables are returned.

 % INPUTS:
 %       SEIRdir     - The directory containing your SEIR epi data,
 %                     organized in seperate folders containg the raw dicom
 %                     images from each of the SEIR EPI acquisitions.
 % 
 %       alignFlag   - Set to 1 if you want to align the SEIR slices. - If
 %                     the SEIR data has more than a few slices it is a good
 %                     idea to try to align them.
 % 
 %       complexFlag - Set to 1 if using complex numbers, else empty or 0.
 % 
 %       useAbs      - Set to 1 if you want to use the complex the data as
 %                     absolute data.
 %     niilistFM       -  A list of Nii or nii gz file of the data this is
 %                     usful when other operation like field mapping was done on the raw
 %                     data. the niilist is a structure the size (i) is the number of
 %                     different images niilist{i}='nmaeofFile' niilist{i+1}='nmae
 %
 % 
 % OUTPUTS: 
 %                     ** (Check with Aviv to make sure this is correct) **
 %       data        - matrix with all the dicom data  
 %       
 %       extra:      - tVec:  [2400 1200 400 50] = Inversion time for each
 %                                                 series.
 %                   - T1Vec: [1x5000 double] = ?
 % 
 %       xform       - The transform computed to align the SEIR slices to
 %                     the first. Returned from relaxAlignAll
 %       saveName    - path to the saved data file
 % 
 % USAGE NOTES:
 %       Note that this function works only with dicoms. The different
 %       inversion time dicoms need to be under a directory called "data".
 %       The data directory should be under the SEIR path, then the SEIRdir.
 %       this function is just a  modification made by aviv mazer in june
 %       2011 on  the getData.m that was written by J. Barral, M.
 %       Etezadi-Amoli, E. Gudmundson, and N. Stikov, 2009
 % 
 % EXAMPLE USAGE:
 %       SEIRdir   = '/baseDir/QI/20110622_0582/SEIR_epi_1';
 %       alignFlag = 1; 
 % 
 %       [data extra xform] = mrQ_initSEIR(SEIRdir,alignFlag);
 %

[edit] mrQ_fitSEIR_T1

Formerly fitSEIR_T1

This function will fit T1, but requires some interaction by the user (optional - see below). Note that this function works only with dicoms. The different inversion time dicoms need to be under a directory called "data". The data directory should be under the SEIR path, then the T1fit_GS. This function will create a file called T1FitNLSPR_SEIR_Dat.mat under the fit directory.


Data Checks: Interpreting the graphs (User interaction)

  1. The first check: If the data was not using complex numbers, then the graph should have 4 points in a rough v shape (or check mark shape). If the data is in complex numbers, then the graph should have 4 points roughly in the shape of a sloping line.
  2. The second check: make sure the red line fitted to the data runs through the 4 points.
  3. Finally, a histogram will appear. Make sure there is a peak around 1000ms (for the white matter) and another peak later 1400ms (for the gray matter). In 1.5T the peaks are 650 900 ms.

The function will save the fitted image in a new directory called "fitT1_GS" under the T1path.

  • To do: Upload some images of the graphs.

Syntax:

 % 
 % mrQ_fitSEIR_T1(SEIRdir,complexFlag,outDir,[checkData=1],mrQ)
 % 
 % Loads SEIR_Dat.mat file from the directory 'data' in the SEIRdir, and
 % performs T1 mapping, also displays the results for the user to check if
 % checkData = 1.
 % 
 % 
 % INPUTS:
 %   SEIRdir -     Path to your desired T1 image. Use the same path as in
 %                 mrQ_initSEIR.
 %   complexFlag - this should be 1 if the data is complex (recommended for
 %                 T1 fits). The default is zero.
 %   checkData -   If you want to visually check the data leave empty or set
 %                 to 1. To not check data set to 0.
 %   mrQ      -    information structure
 %
 % OUTPUTS:
 %     mrQ      -    information structure, updated
 %   This function will save the fitted image in a new directory called
 %   "fitT1_GS" under the SEIRdir.
 %
 % WEB RESOURCES:
 %   http://white.stanford.edu/newlm/index.php/Quantitative_Imaging
 % 
 % 
 % EXAMPLE USAGE:
 %   SEIRdir = '/biac2/wandell2/data/WMDevo/adult/109_AL/QuantitativeImaging/20110622_0582/SEIR_epi_1'
 %   mrQ_fitSEIR_T1(SEIRdir,[],[],[],mrQ);
 %

[edit] Initialize SPGR Data - mrQ_initSPGR.m

This function loads all of the dicoms in spgrDir/data. Note that each individual dicom directory is within a directory named 'data' within spgrDir. * This function won't work with multi coil data, so take care of that in mrQ_arrangeData.m.
This function will align dicoms with the same TR and TE (for T1 M0 linear fit later), so if there is a different TR or TE you will have to select the right TR and TE. Note that you can also work with multiple TRs, but then the relevant line needs to be commented within the code.

  • Note that by default this code calls mrQ_multicoilWeighting.m to calculate the individual coil weights.

Syntax and Usage

 % 
 % [s,xform,mmPerVox,niiFiles,flipAngles,mrQ] =  mrQ_initSPGR(spgrDir,[refImg],[mmPerVox],[interp],[skip],clobber,mrQ)
 % 
 % Load and align all the SPGR dicoms in the spgrDir. (It won't work
 % for multi-coil data, so take care of that in mrQ_arrangeData.m).
 %
 % This function will align dicoms with the same TR and TE (for T1-M0 linear
 % fit). So if there is a different TR or TE you will have to select the the
 % right TR and TE. Note that you can also work with multiple TR's but then
 % the relevant line needs to be commented. *** MORE INFO ON THIS NEEDED ***
 % 
 % 
 % 
 % INPUTS
 %       spgrDir:  Where the SPGR dicom directories are
 % 
 %       refImg:   Different ref images can be used as an input (refImg is a
 %                 path to a nifti image). If there is no refImg (refImg is
 %                 empty) then the SPGR with a similar contrast to the T1
 %                 weighted image will be selected and the user will be
 %                 asked to mark the ac/pc using mrAnatAverageAcpcNifti
 % 
 %       mmPerVox: The resolution at which you want to resample the data.
 %                 This is a 3X1 (1x3?) vector. If empty, the dicom
 %                 resolution will be used-this does not have to be the
 %                 native scan size as the magnet output % is zeroed. The
 %                 saved directory will have the resolution in its name.
 % 
 %       interp:   Interpolation method. [Default = 1]
 %                 1 = trilinear, 
 %                 7 = b-spline (resampling algorithm)
 % 
 %       skip:     you can skip any of the scans in spgrDir if you want by
 %                 passing in a 1xn vector of scans to skip.
 % 
 %      clobber:   Overwrite existing data and reprocess. [default = false]
 %
 %        mrQ:     information structure
 %
 % 
 % OUTPUTS
 %       S:        All the aligned images are saved with the structure S.
 % 
 %       xform:    The matrix that transforms from raw to acpc.
 % 
 %       mmPerVox: The resolution that the data was sampled to.
 % 
 %                 * These three outputs are saved in the output directory
 %                   in the file: fullfile(outDir,'dat_aligned.mat');
 %    
 %       niiFiles: A list of full paths to the nifti files used. If nifti
 %                 files were not used this will be = [];
 %       
 %     flipAngles: A 1xn vector of flip angles.
 %
 %     mrQ:          information structure, updated  
 % 
 % 
 % WEB RESOURCES
 %       http://white.stanford.edu/newlm/index.php/Quantitative_Imaging
 % 
 % 
 % EXAMPLE USAGE
 %       spgrDir  = '/viridian/scr1/data/qmr/20111109_1426/SPGR_1';
 %       refImg   = [];
 %       mmPerVox = [];
 %       interp   = [];
 %       skip     = [];
 %       [s,xform,mmPerVox,niiFiles,flipAngles,mrQ] = mrQ_initSPGR(spgrDir,refImg,mmPerVox,interp,skip,clobber,mrQ);
 % 
 % (C) Stanford University, VISTA Lab 
 %



next a call to waiting of the coils is optimal mrQ_multicoilWeighting.m

[edit] Fitting T1 map and M0 image from the SPGRs

This function fits T1 map M0 image. The SPGR data with a range of flip angles.

note1: To run this part you also need Kendrick svn code so add it and remember to unzip ba3 files.

note2: The function will save AnalysisInfo.mat file that keep track of the input and dates of the file in the directory. The file will be updated when this function is run again and when the other relevant functions mrQ are used.

note3: the function make call to freesurfer to SGE and ANts so all software need to insulted be up to date

-The SGE calls are in : mrQ_fitB1_LSQ.m the B1 fit. mrQ_fitT1PD_LSQ.m the T1 fit

-The Ants call: mrQ_NLANTS_warp_SPGR2EPI_RB.m and mrQ_smmothL_B1.m

-The freeSufer mrQ_Callfs_autosegment.m this autosegment is then finish outside the function by mrQfinalized_autosegment.m

mrQfit_T1M0_ver2(dataDir,lsqfit,SEIRepi_Dir,coilWeights,runfreesurfer,sub,clobber,outDir,complexFlag)


% INPUTS:
%       dataDir            - The directory where the aligned SPGR exists
%                            named dat_aligned.mat
%
%       lsqfit             - [1] - for lsqfit of T1 using the Grid
%                            (recommended).
%                            [0] - for linear fit (a fast default)
%
%       SEIRepi_Dir:       - Path to the epi SEIR directory.
%                            The epi SEIR directory should contain the
%                            out-put from fit mrQ_fitSEIR_T1 (see above)
%       coilWeights         - if a coill Weighting data exsist we will use it . in tje other case we
%                              will use the coil Weighting as given from the magnets 
%
%      runfreesurfer        - if a freesurfer is needed we will make a call
%                           for that after we crate a sysntetic T1-Weighted image
%
%       clobber:              Overwrite existing data and reprocess. [default = false]
%
%       outDir             - Path to where you want the data to be
%                            written to. If the out directory is same then
%                            the data directory default, leave it empty.
%
%
%
%       complexFlag:       - if SEIRepi ws complex data set to 1.
%                            default = zero
%
%       sub                - Subject name used when SGE cmd is executed.
%
%
% OUTPUT:
%       AnalysisInfo       -The function  tries to keep track of the last
%                           runs so it will save a structure name AnalysisInfo  in the outDir.
%                           AnalysisInfo.mat keeps track of the input and dates of the
%                           file in the directory. That file will be updated when this function
%                           is run again and when the other relevant functions are used like
%                           mrQ_PD and mrQ_HLF.
%                           maps like T1 M0 B1, etc. are written to the
%                           output directory ('outDir').
%                     
%       
%
%
% WEB RESOURCES
%       http://white.stanford.edu/newlm/index.php/Quantitative_Imaging
%
%
% EXAMPLE USAGE:
%     % [mrQ.AnalysisInfo]=mrQfit_T1M0_ver2(mrQ.spgr_initDir,mrQ.lsq,mrQ.SEIRepiDir,mrQ.SPGR_coilWeights,mrQ.runfreesurfer,mrQ.sub);
%



This function creates a synthetic SPGR T1 weighted image using the T1, the B1 inhomogeneity map. The files created will be named: t1wfs_4.nii.gz.


Syntax:

synthesisT1w(dataDir,B1file,outDir,trIn,flipangleIn)

dataDir: the path to the directory where the align.mat file exists from the getSEIR function earlier.

B1file: Specify where the B1 inhomogeneity map exists. If you leave it empty, it will use the B1 file from the data directory.

outDir: the path to where you would like to save the data. trIn the tr we use to simulate the synthetic T1 weighted flipangleIn the flip angle we use to simulate the synthetic T1 weighted

[edit] Fitting Proton Density (PD)

we will define a CSF ROI.

 mrQ_CSF(outDir,freesurfer,T1file)

the function will save a CSF file in outDir according to the freesurfer. the freesurfer ROI will be limit to the voxel with the right note that we need a FreeSurfer segmentation map to this part please check the relevant pages Free Surfer

[edit] Tissue/water volume fraction (WVF/TVF) calculation

we will make M0 file for each coil using. the T1 and B1 map we already Fit.

this will also register each coil input to the acpc coordinate we define before.

 mrQ_multicoilM0(datDir,T1file,B1file,niifile,flip_Angles)

note you don't have to edit the T1file B1file as long as they are in the datDir. they suppose to be there becouse they are the outputs of mrQfit_T1M0_ver2.m you run before. the raw nii.gz file and the flip angle need to be added.


example:
niifile={'/biac4/wandell/biac2/wandell2/data/WMDevo/adult/108_AM/QuantitativeImaging/20111020_1294_32ch_1mm3 /20111020_1294/raw/0009_01_SPGR_1mm_10deg.nii.gz'
'/biac4/wandell/biac2/wandell2/data/WMDevo/adult/108_AM/QuantitativeImaging/20111020_1294_32ch_1mm3/20111020_1294/raw/0010_01_SPGR_1mm_4deg.nii.gz'
'/biac4/wandell/biac2/wandell2/data/WMDevo/adult/108_AM/QuantitativeImaging/20111020_1294_32ch_1mm3/20111020_1294/raw/0011_01_SPGR_1mm_30deg.nii.gz'
'/biac4/wandell/biac2/wandell2/data/WMDevo/adult/108_AM/QuantitativeImaging/20111020_1294_32ch_1mm3/20111020_1294/raw/0012_01_SPGR_1mm_20deg.nii.gz'
};
mrQ_multicoilM0(outDir,[],[],niifile,[10 4 30 20])



calculate the PD and WF

next we will use the multi coil information to split the PD from the coils gain.

this is a lot of work and we do it on small boxes along the brain. it will be better to use the SGE grid to make it faster (input 1). the out put result we be in tmpSGM0 directory when the calculation a different function will combine the different boxes along, the see below.

 [mrQ.opt]=mrQ_fitPD_multicoil(outDir,SunGrid,M0cfile,degrees,sub)

the input is M0cfile is a nii.gz files created by mrQ_multicoilM0.m before the degrees is the polynomial degree that are fitted the default is 3. sub is the name of the subject for the SGE runs


Building the maps

 mrQ_BuildCoilsfitsPD(outDir);

this we crate two nii.gz file that are the PD combine from all the brain boxes. one image is a mean combine PD_fitGboxMean.nii.gz the other is median PD_fitGboxMedian.nii.gz and water fraction map a WF_map.nii.gz.

[edit] Fitting the Volume of water interacting Protons (VIP)

last we calculate the final map using a water-surface T1 model.

The maps are: Tissue volume TV, Volume of water interacting Protons VIP and the water-surface water interaction ratio SIR (SIR=VIP/TV).

[AnalysisInfo]=mrQ_VIP(outDir,WFfile,T1file,mField,T1freeval,Fullerton)
% ABOUT THE MODEL:
% 
%   The T1 value is modeled as a weighted sum of two fast exchanging pools; a
%   free pool (with T1f = ~4.3 sec) and a hydration pool (T1h).
%       
%       1/T1 = fh/T1h + (1-fh)/T1f
% 
%   T1h is estimated as a linear function of the magnetic field (Fullerton
%   1984). (calculate in-vitro with different tissue types)
% 
%       T1h = 1.83 x f + 25, 
% 
%   OR our new model: (calculate with in-vivo brain data)
% 
%       T1h = 0.934 x f + 93.03
% 
%   Where f is the Larmor frequency for the given magnetic field. 
%   * Model estimation std for our values are 0.0252 and 1.8035
% 
%   Rearranging the equation above, the water fraction (fh) is given by: 
%       
%       fh = (1/T1-1/T1f) x (1/T1h-1/T1f).
% 
% 
% INPUTS:
%       outDir    - Directory containing the aligned SPGR data.
% 
%       WFfile    - The Water Fraction file from mrQ_WF
% 
%       T1file    - The T1 fit nifti
% 
%       mField    - The strength of the magnetic field. Default taken from 
%                   the dicom header. 
% 
%       T1freeval - Defaults to 4.3
% 
%       Fullerton - Boolean: 1 = use the Fullerton model for the
%                   calculation, 0 = don't use it. 
% 
% 
% OUTPUTS:
%    AnalysisInfo  - an information structure
%   maps that are saved
% if Fullerton==1
%     dtiWriteNiftiWrapper(single(fh), xform, fullfile(outDir,'T1wVIP_fitFullerton.nii.gz'));
%     dtiWriteNiftiWrapper(single(VIP), xform, fullfile(outDir,'VIP_fitFullerton.nii.gz'));
%     
% else
%     
%    dtiWriteNiftiWrapper(single(fh), xform, fullfile(outDir,'T1wVIP_fit.nii.gz'));
%     dtiWriteNiftiWrapper(single(VIP), xform, fullfile(outDir,'VIP_map.nii.gz'));
%     dtiWriteNiftiWrapper(single(TV), xform, fullfile(outDir,'TV_map.nii.gz'));
%     dtiWriteNiftiWrapper(single(SIR), xform, fullfile(outDir,'SIR_map.nii.gz'));
% 
% (C) Stanford University, VISTA Lab
%
Personal tools