load NIFTI file and convert image into RAS orientation nii = load_nii_ras(fname) fname : NIFTI file name Made by Masa-aki Sato 2008-02-17 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [nii] = load_nii_ras(fname) 0002 % load NIFTI file and convert image into RAS orientation 0003 % nii = load_nii_ras(fname) 0004 % fname : NIFTI file name 0005 % 0006 % Made by Masa-aki Sato 2008-02-17 0007 % 0008 % Copyright (C) 2011, ATR All Rights Reserved. 0009 % License : New BSD License(see VBMEG_LICENSE.txt) 0010 0011 nii = load_nii(fname); 0012 0013 if isfield(nii,'filetype') & nii.filetype > 0 0014 % NIFTI data format 0015 nii = change_orient_ras(nii); 0016 else 0017 % Analyze data format : LAS format 0018 dim = size(nii.img); 0019 0020 % --- flip image left-right 0021 nii.img(1:dim(1),:,:) = nii.img(dim(1):-1:1,:,:); 0022 end 0023