0001 function dmri_job_FA_preprocess(fa_parm)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
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
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
0044
0045
0046
0047
0048
0049
0050
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
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
0074 is_okay = true;
0075 end
0076 end
0077
0078
0079
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
0092