0001 function dmri_process_T1_dicom_convert(p)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 disp(mfilename);
0017
0018
0019
0020
0021 if isfield(p, 'ref_mri_file') && ~isempty(p.ref_mri_file)
0022 warning('T1-image create step is skipped because p.ref_mri_file is specified.');
0023 return;
0024 end
0025
0026
0027
0028
0029 if isfield(p, 't1_dicom_dir') && exist(p.t1_dicom_dir, 'dir')==7
0030
0031 elseif isfield(p, 't1_dicom_dir') && isempty(p.t1_dicom_dir)
0032 error('T1-DICOM directory not speicifed.');
0033 end
0034
0035 d = dir(fullfile(p.t1_dicom_dir, ['*', p.t1_dicom_extension]));
0036
0037
0038 input_dicom_file = fullfile(p.t1_dicom_dir, d(1).name);
0039 output_dir = fullfile(p.output_dir, p.t1_dirname);
0040 if exist(output_dir, 'dir') ~= 7, mkdir(output_dir); end
0041
0042
0043 [t1_nifti_file] = convert_dicom_nifti(input_dicom_file, output_dir);
0044
0045
0046 t1_out_file = fullfile(p.output_dir, p.t1_dirname, p.t1_file);
0047 movefile(t1_nifti_file, t1_out_file);
0048
0049 disp(sprintf('T1-file is created : %s', t1_out_file));