Home > vbmeg > functions > tool_box > load_NIFTI > convert_dicom > convert_nifti_to_ras.m

convert_nifti_to_ras

PURPOSE ^

Convert nifti file to RAS NIFTI file

SYNOPSIS ^

function [avw] = convert_nifti_to_ras(fname,fnout)

DESCRIPTION ^

 Convert nifti file to RAS NIFTI file
 --- Usage
   convert_nifti_to_ras(fname,fnout);
 --- Input
 fname : Input NIFTI file namw
 fnout : Output RAS NIFTI file name

 Made by Masa-aki Sato 2010-1-10

 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   [avw] = convert_nifti_to_ras(fname,fnout)
0002 % Convert nifti file to RAS NIFTI file
0003 % --- Usage
0004 %   convert_nifti_to_ras(fname,fnout);
0005 % --- Input
0006 % fname : Input NIFTI file namw
0007 % fnout : Output RAS NIFTI file name
0008 %
0009 % Made by Masa-aki Sato 2010-1-10
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 
0015 % Load NIFTI header & image
0016 avw = load_nii_cbi(fname);
0017 
0018 %  Check NIFTI format
0019 if ~isfield(avw,'filetype') || avw.filetype == 0
0020     error('File is not Nifti-format');
0021 end
0022 
0023 % Change to RAS
0024 avw = change_orient_ras(avw);
0025 
0026 avw.filetype = 2;
0027 %     1 : NIFTI   .hdr/.img , (.hdr : 348 byte)
0028 %     2 : NIFTI   .nii      , (.nii : 348 byte hdr + 4 bite skip + image data)
0029 
0030 if nargin==2 && ~isempty(fnout)
0031     % Save as NIFTI format
0032     save_nii_cbi(avw, fnout);
0033 end

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