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

dmri_job_FA_preprocess

PURPOSE ^

Create FA image.

SYNOPSIS ^

function dmri_job_FA_preprocess(fa_parm)

DESCRIPTION ^

 Create FA image.

 [Usage]
     dmri_job_FA_preprocess(fa_parm);

 [Input]
     fa_parm.dti_4d_image : DTI 4D-NIfTI.gz file(.nii.gz)
                            with bvec file, bval file
            .threshold    : fractional intensity threshold (0->1); 
                            default=0.5; smaller values give larger brain 
                            outline estimates.
            .output_dir   : output directory
            .basename     : basename of FA image.
                            (e.g. 'data_FA)

 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_FA_preprocess(fa_parm)
0002 % Create FA image.
0003 %
0004 % [Usage]
0005 %     dmri_job_FA_preprocess(fa_parm);
0006 %
0007 % [Input]
0008 %     fa_parm.dti_4d_image : DTI 4D-NIfTI.gz file(.nii.gz)
0009 %                            with bvec file, bval file
0010 %            .threshold    : fractional intensity threshold (0->1);
0011 %                            default=0.5; smaller values give larger brain
0012 %                            outline estimates.
0013 %            .output_dir   : output directory
0014 %            .basename     : basename of FA image.
0015 %                            (e.g. 'data_FA)
0016 %
0017 % Copyright (C) 2011, ATR All Rights Reserved.
0018 % License : New BSD License(see VBMEG_LICENSE.txt)
0019 
0020 %
0021 % --- Previous check
0022 %
0023 if nargin ~= 1
0024     error('Please check input argument.');
0025 end
0026 if ~isfield(fs_parm, 'dti_4d_image_file')
0027     error('dti_4d_image_file is a required field.');
0028 end
0029 if exist(fs_parm.dti_4d_image_file, 'file') ~= 2
0030     error('Specified dti_4d_image_file not found.');
0031 end
0032 
0033 %
0034 % --- Extract brain image and brain mask from 4D-NIfTI.gz
0035 %
0036 data_4d_image_file = fs_parm.dti_4d_image_file;
0037 if ~isfield(fs_parm, 'threshold')
0038     threshold = 0.5;
0039 end
0040 is_okay = false;
0041 while(is_okay)
0042     brain_image_extract(data_4d_image_file, threshold);
0043         % will put files into the same directory.
0044         %   (_brain, _brain_mask is added as a postfix.)
0045         %   data_4d_image_file_brain.nii.gz
0046         %   data_4d_image_file_brain_mask.nii.gz
0047 
0048 
0049     % !! Quality Check !!
0050     % Is extracted skull stripped brain Okay?(Check the result.)
0051     command = ['fslview ' ...
0052                 strrep(data_4d_image_file, '.nii.gz', '_brain.nii.gz'), ...
0053                 ' ', data_4d_image_file];
0054     dmri_system(command);
0055 
0056     res = questdlg('Is the extracted skull stripped brain ok?', ...
0057                    'Quality check', ...
0058                    'Yes', 'No', 'No');
0059 
0060     % Input new threshold when the result is not good.
0061     if strcmpi(res, 'No')
0062         defaultanswer = {num2str(threshold)};
0063         new_threshold = ...
0064             inputdlg('Enter the threshold for skull strip', ...
0065                      'Input', 1, defaultanswer);
0066         if isempty(new_threshold)
0067            disp('Stopped processing.');
0068            return;
0069         else
0070            threshold = str2double(new_threshold{1});
0071         end
0072      else
0073         % exit loop
0074         is_okay = true;
0075      end
0076 end
0077 
0078 %
0079 % --- Create FA image
0080 %
0081 brain_mask_file = [strrep(data_4d_image_file, '.nii.gz', '_brain_mask.nii.gz'];
0082 bvec_file       = [strrep(data_4d_image_file, '.nii.gz', '_bvec'];
0083 bval_file       = [strrep(data_4d_image_file, '.nii.gz', '_bval'];
0084 basename        = 'data_ecc_FA';
0085 
0086 dmri_FA_image_create(data_4d_image_file, ...
0087                      bval_file, bvec_file, ...
0088                      brain_mask_file, ...
0089                      output_dir, ...
0090                      basename);
0091     % will put files into the same directory.
0092     %    output_dir/basename.nii.gz

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