Home > vbmeg > functions > tool_box > dmri_processor > functions > util > dmri_mrview.m

dmri_mrview

PURPOSE ^

MRTrix viewer 'mrview' requires .nii file.

SYNOPSIS ^

function dmri_mrview(struct_file)

DESCRIPTION ^

 MRTrix viewer 'mrview' requires .nii file.
 This function launches 'mrview' with file extension .nii or .nii.gz file.

 [Usage]
    dmri_mrview(struct_file);

 [Input]
    struct_file : niftigz or nifti format of MR image.

 [Output]
    none

 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_mrview(struct_file)
0002 % MRTrix viewer 'mrview' requires .nii file.
0003 % This function launches 'mrview' with file extension .nii or .nii.gz file.
0004 %
0005 % [Usage]
0006 %    dmri_mrview(struct_file);
0007 %
0008 % [Input]
0009 %    struct_file : niftigz or nifti format of MR image.
0010 %
0011 % [Output]
0012 %    none
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 %
0018 % --- Previous check
0019 %
0020 if nargin ~= 1
0021     error('Please check input argument.');
0022 end
0023 if exist(struct_file, 'file') ~= 2
0024     error('Specified file not found.');
0025 end
0026 
0027 %
0028 % --- Main Procedure
0029 %
0030 nii_created = false;
0031 if strcmpi(struct_file(end-6:end), '.nii.gz')
0032     unzip_struct_file = strrep(struct_file, '.nii.gz', '.nii');
0033     if exist(unzip_struct_file, 'file') ~= 2
0034         nii_created = true;
0035         system(['gunzip -c -d ', struct_file ' > ' unzip_struct_file]);
0036     end
0037     struct_file = unzip_struct_file;
0038 end
0039 % Launch viewer
0040 dmri_system(['mrview ', struct_file, ' -debug'], '-echo');
0041 
0042 if nii_created
0043     delete(unzip_struct_file);
0044 end
0045

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