create transformation info between T1-space, Difusion space and FreeSurfer space. [Usage] dmri_transwarp_info_create(freesurfer_dir, t1_brain_gz_file, fa_gz_file, output_dir); [Input] freesurfer_dir : FreeSurfer single subject directory. t1_brain_gz_file : T1 nifti-gz file(.nii.gz) which contains only brain part. fa_gz_file : FA nifti-gz file(.nii.gz) Fractional Anisotropy image. [Output] none [Example] freesurfer_dir = '/home/cbi-data4/rhayashi/te1-face/freesurfer/Sub08'; t1_brain_gz_file = '/home/cbi-data4/rhayashi/te1-face/t1/Sub08/nifti_gz/struct_brain.nii.gz'; fa_gz_file = '/home/cbi-data4/rhayashi/te1-face/fsl/Sub08/data_FA.nii.gz'; output_dir = '/home/cbi-data4/rhayashi/te1-face/fsl/Sub08/xfm/rot_mod'; dmri_transwarp_info_create(freesurfer_dir, t1_brain_gz_file, fa_gz_file, output_dir); Example output files. /home/cbi-data4/rhayashi/te1-face/fsl/Sub08/xfm/rot_mod fa2freesurfer_warp.nii.gz fa2strict_warp.nii.gz freeesurfer2fa_warp.nii.gz struct2fa_warp.nii.gz fa2struct.mat freesurfer2struct.mat struct2freesurfer.mat Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function dmri_transwarp_info_create(freesurfer_dir, ... 0002 t1_brain_gz_file, ... 0003 fa_gz_file, ... 0004 output_dir) 0005 % create transformation info between T1-space, Difusion space and FreeSurfer space. 0006 % [Usage] 0007 % dmri_transwarp_info_create(freesurfer_dir, t1_brain_gz_file, 0008 % fa_gz_file, output_dir); 0009 % [Input] 0010 % freesurfer_dir : FreeSurfer single subject directory. 0011 % t1_brain_gz_file : T1 nifti-gz file(.nii.gz) which contains only brain part. 0012 % fa_gz_file : FA nifti-gz file(.nii.gz) Fractional Anisotropy image. 0013 % 0014 % [Output] 0015 % none 0016 % 0017 % [Example] 0018 % freesurfer_dir = '/home/cbi-data4/rhayashi/te1-face/freesurfer/Sub08'; 0019 % t1_brain_gz_file = '/home/cbi-data4/rhayashi/te1-face/t1/Sub08/nifti_gz/struct_brain.nii.gz'; 0020 % fa_gz_file = '/home/cbi-data4/rhayashi/te1-face/fsl/Sub08/data_FA.nii.gz'; 0021 % output_dir = '/home/cbi-data4/rhayashi/te1-face/fsl/Sub08/xfm/rot_mod'; 0022 % 0023 % dmri_transwarp_info_create(freesurfer_dir, t1_brain_gz_file, fa_gz_file, output_dir); 0024 % 0025 % Example output files. 0026 % /home/cbi-data4/rhayashi/te1-face/fsl/Sub08/xfm/rot_mod 0027 % fa2freesurfer_warp.nii.gz 0028 % fa2strict_warp.nii.gz 0029 % freeesurfer2fa_warp.nii.gz 0030 % struct2fa_warp.nii.gz 0031 % 0032 % fa2struct.mat 0033 % freesurfer2struct.mat 0034 % struct2freesurfer.mat 0035 % 0036 % Copyright (C) 2011, ATR All Rights Reserved. 0037 % License : New BSD License(see VBMEG_LICENSE.txt) 0038 0039 % 0040 % --- Previous check 0041 % 0042 if nargin ~= 4 0043 error('Please check input argument.'); 0044 end 0045 if exist(freesurfer_dir, 'dir') ~= 7 0046 error('Specified FreeSurfer directory not found.'); 0047 end 0048 if exist(t1_brain_gz_file, 'file') ~= 2 0049 error('Specified t1 brain image file not found.'); 0050 end 0051 if exist(fa_gz_file, 'file') ~= 2 0052 error('Specified Fractional Anisotropy image file not found.'); 0053 end 0054 if exist(output_dir, 'dir') ~= 7 0055 mkdir(output_dir); 0056 if exist(output_dir, 'dir') ~= 7 0057 error('Cannot create output directory.'); 0058 end 0059 end 0060 0061 % 0062 % --- Main Procedure 0063 % 0064 disp('Creating transformation info between T1-space, Difusion-space and FreeSurfer-space.'); 0065 start = tic; 0066 trans_cmd = which('make_transwarp.sh'); 0067 cmd = ['chmod 755 ', trans_cmd]; 0068 system(cmd); 0069 command = [trans_cmd ' ', freesurfer_dir, ' ', ... 0070 t1_brain_gz_file, ' ', ... 0071 fa_gz_file, ' ', ... 0072 output_dir]; 0073 [status, cmdout] = dmri_system(command, '-echo'); 0074 if status ~= 0 0075 error('Please check input arguments'); 0076 end 0077 toc(start); 0078