0001 function [result, cancelled] = brain_file_maker_make_mask_file(...
0002 obj, spm_norm_file, standard_mask_file, mask_file)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0025 if ~exist('spm_norm_file', 'var') || isempty(spm_norm_file)
0026 error('spm_norm_file is a required parameter.');
0027 end
0028 if ~exist('standard_mask_file', 'var') || isempty(standard_mask_file)
0029 error('standard_mask_file is a required parameter.');
0030 end
0031 if ~exist('mask_file', 'var') || isempty(mask_file)
0032 error('mask_file is a required parameter.');
0033 end
0034
0035
0036
0037
0038 result = SUCCESS;
0039 cancelled = false;
0040
0041 if exist(mask_file, 'file') == 2
0042 res = questdlg('Mask file already exists, recreate it?', ...
0043 'confirm', 'Yes', 'No', 'Yes');
0044 if strcmp(res, 'No')
0045 cancelled = true;
0046 return;
0047 end
0048 end
0049
0050 analyze_file = [vb_analyze_info_get_file_prefix(obj.analyze_info), '.hdr'];
0051 h = brain_file_maker_show_wait_dialog;
0052 [avw, XYZspm] = vb_map_mask_image(...
0053 analyze_file, ...
0054 standard_mask_file, ...
0055 spm_norm_file);
0056 vb_fsave(mask_file, 'avw', 'XYZspm');
0057 brain_file_maker_delete_wait_dialog(h);
0058
0059
0060