Home > vbmeg > functions > tool_box > mri_toolbox > avw_read_ras.m

avw_read_ras

PURPOSE ^

avw_read - read Analyze/Nifti format data image to RAS

SYNOPSIS ^

function [avw] = avw_read_ras(fileprefix)

DESCRIPTION ^

 avw_read - read Analyze/Nifti format data image to RAS
 
 [avw] = avw_read_ras;
 [avw] = avw_read_ras(fileprefix);
 
 This function calls load_nii_ras
 
 fileprefix - a string, the filename without the .img extension.
              A gui prompt appears if this argument is missing.
 
 
 Returned values:
 
  avw.hdr - a struct with image data parameters.
  avw.img - a 3D matrix of image data (double precision).
    For NIFTI
  avw.fileprefix - NIFTI filename without extension.
  avw.machine - machine string variable.
  avw.filetype =
     0 : Analyze .hdr/.img , (.hdr : 348 byte)
     1 : NIFTI   .hdr/.img , (.hdr : 348 byte)
         hdr.dime.vox_offset = 0;
     2 : NIFTI   .nii      , (.nii : 348 byte hdr + 4 bite skip + image data)
         hdr.dime.vox_offset = 352;

 Made by Masa-aki Sato 2008-02-17

 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] = avw_read_ras(fileprefix)
0002 % avw_read - read Analyze/Nifti format data image to RAS
0003 %
0004 % [avw] = avw_read_ras;
0005 % [avw] = avw_read_ras(fileprefix);
0006 %
0007 % This function calls load_nii_ras
0008 %
0009 % fileprefix - a string, the filename without the .img extension.
0010 %              A gui prompt appears if this argument is missing.
0011 %
0012 %
0013 % Returned values:
0014 %
0015 %  avw.hdr - a struct with image data parameters.
0016 %  avw.img - a 3D matrix of image data (double precision).
0017 %    For NIFTI
0018 %  avw.fileprefix - NIFTI filename without extension.
0019 %  avw.machine - machine string variable.
0020 %  avw.filetype =
0021 %     0 : Analyze .hdr/.img , (.hdr : 348 byte)
0022 %     1 : NIFTI   .hdr/.img , (.hdr : 348 byte)
0023 %         hdr.dime.vox_offset = 0;
0024 %     2 : NIFTI   .nii      , (.nii : 348 byte hdr + 4 bite skip + image data)
0025 %         hdr.dime.vox_offset = 352;
0026 %
0027 % Made by Masa-aki Sato 2008-02-17
0028 %
0029 % Copyright (C) 2011, ATR All Rights Reserved.
0030 % License : New BSD License(see VBMEG_LICENSE.txt)
0031 
0032 
0033 if ~exist('fileprefix','var'),
0034   [pathname, fileprefix] = ...
0035      vb_file_select({'.nii', '.hdr'}, 'Analyze/Nifti .hdr/.nii file');
0036   if isempty(fileprefix)
0037     error('no file specified');
0038   else
0039     fileprefix = fullfile(pathname, fileprefix{1});
0040   end
0041 end
0042 
0043 avw = load_nii_ras(fileprefix);
0044 
0045 return

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