Home > vbmeg > functions > tool_box > dmri_processor > functions > job > dmri_job_t1_preprocess.m

dmri_job_t1_preprocess

PURPOSE ^

Preprocess T1 las analyze image and create files for DTI processing.

SYNOPSIS ^

function dmri_job_t1_preprocess(t1_parm)

DESCRIPTION ^

 Preprocess T1 las analyze image and create files for DTI processing.
 threshold is used for creating skull stripping image.

 [Usage]
    dmri_job_t1_preprocess(t1_parm);

 [Input]
    t1_parm : parameter for processing.
         .mri_file          : LAS analyze filename(.img)            [string]
                                      or
                              NIfTI file(.nii)
                              This file can be created from DICOM files 
                              using VBMEG function: convert_dicom_nifti.m
                              
         .threshold         : <<optional>>                    [value]
                              fractional intensity threshold (0->1).
                              default is 0.5; smaller values give larger brain
                              outline estimates.
         .output_dir        : <<optional>>                    [string]
                                output directory. 
                                if not specified, current directory is set.
         .output_basename   : <<optional>>                    [string]
                                basename of output files.
                                if not specified, 'struct' is set.

 [Output]
    none

 Output files:
    output_dir/output_basename.nii.gz
              /output_basename_brain.nii.gz
              /output_basename_mask.nii.gz
 [Note]
   File format - .nii.gz is a standard format for FSL utility.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dmri_job_t1_preprocess(t1_parm)
0002 % Preprocess T1 las analyze image and create files for DTI processing.
0003 % threshold is used for creating skull stripping image.
0004 %
0005 % [Usage]
0006 %    dmri_job_t1_preprocess(t1_parm);
0007 %
0008 % [Input]
0009 %    t1_parm : parameter for processing.
0010 %         .mri_file          : LAS analyze filename(.img)            [string]
0011 %                                      or
0012 %                              NIfTI file(.nii)
0013 %                              This file can be created from DICOM files
0014 %                              using VBMEG function: convert_dicom_nifti.m
0015 %
0016 %         .threshold         : <<optional>>                    [value]
0017 %                              fractional intensity threshold (0->1).
0018 %                              default is 0.5; smaller values give larger brain
0019 %                              outline estimates.
0020 %         .output_dir        : <<optional>>                    [string]
0021 %                                output directory.
0022 %                                if not specified, current directory is set.
0023 %         .output_basename   : <<optional>>                    [string]
0024 %                                basename of output files.
0025 %                                if not specified, 'struct' is set.
0026 %
0027 % [Output]
0028 %    none
0029 %
0030 % Output files:
0031 %    output_dir/output_basename.nii.gz
0032 %              /output_basename_brain.nii.gz
0033 %              /output_basename_mask.nii.gz
0034 % [Note]
0035 %   File format - .nii.gz is a standard format for FSL utility.
0036 %
0037 % Copyright (C) 2011, ATR All Rights Reserved.
0038 % License : New BSD License(see VBMEG_LICENSE.txt)
0039 
0040 %
0041 % --- Previous check
0042 %
0043 if nargin ~= 1
0044     error('Please check input arguments');
0045 end
0046 if ~isfield(t1_parm, 'mri_file')
0047     error('mri_file not specified.');
0048 end
0049 if exist(t1_parm.mri_file, 'file') ~= 2
0050     error('mri_file not found.');
0051 end
0052 mri_file = t1_parm.mri_file;
0053 
0054 % output directory
0055 if isfield(t1_parm, 'output_dir')
0056     output_dir = t1_parm.output_dir;
0057 else
0058     output_dir = pwd;
0059 end
0060 if exist(output_dir, 'dir') ~= 7
0061     mkdir(output_dir);
0062     if exist(output_dir, 'dir') ~= 7
0063         error('failed to create output directory.');
0064     end
0065 end
0066 % output basename
0067 if isfield(t1_parm, 'output_basename')
0068     output_basename = t1_parm.output_basename;
0069 else
0070     output_basename = 'struct';
0071 end
0072 
0073 % threshold
0074 if isfield(t1_parm, 'threshold')
0075     threshold = t1_parm.threshold;
0076 else
0077     threshold = 0.5;
0078 end
0079 
0080 %
0081 % --- Main Procedure
0082 %
0083 
0084 % Create gzipped NIfTI file - struct.nii.gz
0085 struct_nifti_file = [output_dir, '/', output_basename '.nii'];
0086 command  = ['mri_convert --out_type nii ' mri_file, ' ' struct_nifti_file];
0087 dmri_system(command);
0088 command2 = ['gzip -f ' struct_nifti_file];
0089 system(command2);
0090 
0091 % Create skull stripped brain file and mask file
0092 brain_image_extract([struct_nifti_file, '.gz'], threshold);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005