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

analyze_hdr_read

PURPOSE ^

Read Analyze/Nifti format header

SYNOPSIS ^

function [dim,vox,origin] = analyze_hdr_read(imagefile)

DESCRIPTION ^

 Read Analyze/Nifti format header 
   [dim,vox,origin] = analyze_hdr_read(imagefile)

 imagefile - filename 
 
 --- Output
 DIM(1:3)     - image size 
 VOX(1:3)     - voxel size [mm]
 ORIGIN(1:3)  - origin [voxel index]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 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 [dim,vox,origin] = analyze_hdr_read(imagefile)
0002 % Read Analyze/Nifti format header
0003 %   [dim,vox,origin] = analyze_hdr_read(imagefile)
0004 %
0005 % imagefile - filename
0006 %
0007 % --- Output
0008 % DIM(1:3)     - image size
0009 % VOX(1:3)     - voxel size [mm]
0010 % ORIGIN(1:3)  - origin [voxel index]
0011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 [hdr, filetype] = load_nii_hdr_cbi(imagefile);
0017 
0018 dim    = hdr.dime.dim(2:4);
0019 vox    = hdr.dime.pixdim(2:4);
0020 
0021 dim    = dim(:)';
0022 vox    = vox(:)';
0023 
0024 if nargout==2, return; end;
0025 
0026 if filetype    == 0
0027     origin = hdr.hist.originator(1:3);
0028 else
0029     nii.hdr = hdr;
0030     nii.filetype = filetype;
0031     
0032     [orient, R, T] = get_orient_info(nii);
0033     
0034     origin = - T;
0035     
0036     origin = origin(:)'; 
0037 end
0038 
0039 return

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