📄 avw_img_read.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head> <title>Description of avw_img_read</title> <meta name="keywords" content="avw_img_read"> <meta name="description" content="avw_img_read - read Analyze format data image (*.img)"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 2003 Guillaume Flandin"> <meta name="robots" content="index, follow"> <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> > <a href="index.html">mri_toolbox</a> > avw_img_read.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for mri_toolbox <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>avw_img_read</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>avw_img_read - read Analyze format data image (*.img)</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function [ avw, machine ] = avw_img_read(fileprefix,IMGorient,machine) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment"> avw_img_read - read Analyze format data image (*.img)
[ avw, machine ] = avw_img_read(fileprefix, [orient], [machine])
fileprefix - a string, the filename without the .img extension
orient - read a specified orientation, integer values:
'', use header history orient field
0, transverse unflipped (LAS*)
1, coronal unflipped (LA*S)
2, sagittal unflipped (L*AS)
3, transverse flipped (LPS*)
4, coronal flipped (LA*I)
5, sagittal flipped (L*AI)
where * follows the slice dimension and letters indicate +XYZ
orientations (L left, R right, A anterior, P posterior,
I inferior, & S superior).
Some files may contain data in the 3-5 orientations, but this
is unlikely. For more information about orientation, see the
documentation at the end of this .m file. See also the <a href="avw_flip.html" class="code" title="function [ avw ] = avw_flip(avw,dims)">AVW_FLIP</a> function for orthogonal reorientation. machine - a string, see machineformat in fread for details. The default here is 'ieee-le' but the routine will automatically switch between little and big endian to read any such Analyze header. It reports the appropriate machine format and can return the machine value. Returned values: avw.hdr - a struct with image data parameters. avw.img - a 3D matrix of image data (double precision). The returned 3D matrix will correspond with the default ANALYZE coordinate system, which is Left-handed: X-Y plane is Transverse X-Z plane is Coronal Y-Z plane is Sagittal X axis runs from patient right (low X) to patient Left (high X) Y axis runs from posterior (low Y) to Anterior (high Y) Z axis runs from inferior (low Z) to Superior (high Z) See also: <a href="avw_hdr_read.html" class="code" title="function [ avw, machine ] = avw_hdr_read(fileprefix, machine)">avw_hdr_read</a> (called by this function), <a href="avw_view.html" class="code" title="function [ varargout ] = avw_view(avw,parent,command),">avw_view</a>, <a href="avw_write.html" class="code" title="function avw_write(avw, fileprefix, IMGorient, machine)">avw_write</a>, <a href="avw_img_write.html" class="code" title="function avw_img_write(avw, fileprefix, IMGorient, machine)">avw_img_write</a>, <a href="avw_flip.html" class="code" title="function [ avw ] = avw_flip(avw,dims)">avw_flip</a></pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="avw_hdr_read.html" class="code" title="function [ avw, machine ] = avw_hdr_read(fileprefix, machine)">avw_hdr_read</a> avw_hdr_read - read Analyze format data header (*.hdr)</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="avw_converter_script.html" class="code" title="">avw_converter_script</a> avw_converter_script - convert byte order of .img files</li><li><a href="avw_img_compose.html" class="code" title="function avw = avw_img_compose(files,IMGorient,machine),">avw_img_compose</a> AVW_IMG_COMPOSE - Compose single slice Analyze files into a volume</li><li><a href="avw_read.html" class="code" title="function [ avw, machine ] = avw_read(fileprefix,IMGorient,machine)">avw_read</a> avw_read - read Analyze format data image (*.img)</li><li><a href="mesh_3shell_script.html" class="code" title="">mesh_3shell_script</a> mesh_3shell_script</li></ul><!-- crossreference --><h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><ul style="list-style-image:url(../matlabicon.gif)"><li><a href="#_sub1" class="code">function [ avw ] = read_image(avw,IMGorient,machine)</a></li></ul><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [ avw, machine ] = avw_img_read(fileprefix,IMGorient,machine)</a>0002 0003 <span class="comment">% avw_img_read - read Analyze format data image (*.img)</span>0004 <span class="comment">%</span>0005 <span class="comment">% [ avw, machine ] = avw_img_read(fileprefix, [orient], [machine])</span>0006 <span class="comment">%</span>0007 <span class="comment">% fileprefix - a string, the filename without the .img extension</span>0008 <span class="comment">%</span>0009 <span class="comment">% orient - read a specified orientation, integer values:</span>0010 <span class="comment">%</span>0011 <span class="comment">% '', use header history orient field</span>0012 <span class="comment">% 0, transverse unflipped (LAS*)</span>0013 <span class="comment">% 1, coronal unflipped (LA*S)</span>0014 <span class="comment">% 2, sagittal unflipped (L*AS)</span>0015 <span class="comment">% 3, transverse flipped (LPS*)</span>0016 <span class="comment">% 4, coronal flipped (LA*I)</span>0017 <span class="comment">% 5, sagittal flipped (L*AI)</span>0018 <span class="comment">%</span>0019 <span class="comment">% where * follows the slice dimension and letters indicate +XYZ</span>0020 <span class="comment">% orientations (L left, R right, A anterior, P posterior,</span>0021 <span class="comment">% I inferior, & S superior).</span>0022 <span class="comment">%</span>0023 <span class="comment">% Some files may contain data in the 3-5 orientations, but this</span>0024 <span class="comment">% is unlikely. For more information about orientation, see the</span>0025 <span class="comment">% documentation at the end of this .m file. See also the</span>0026 <span class="comment">% AVW_FLIP function for orthogonal reorientation.</span>0027 <span class="comment">%</span>0028 <span class="comment">% machine - a string, see machineformat in fread for details.</span>0029 <span class="comment">% The default here is 'ieee-le' but the routine</span>0030 <span class="comment">% will automatically switch between little and big</span>0031 <span class="comment">% endian to read any such Analyze header. It</span>0032 <span class="comment">% reports the appropriate machine format and can</span>0033 <span class="comment">% return the machine value.</span>0034 <span class="comment">%</span>0035 <span class="comment">% Returned values:</span>0036 <span class="comment">%</span>0037 <span class="comment">% avw.hdr - a struct with image data parameters.</span>0038 <span class="comment">% avw.img - a 3D matrix of image data (double precision).</span>0039 <span class="comment">%</span>0040 <span class="comment">% The returned 3D matrix will correspond with the</span>0041 <span class="comment">% default ANALYZE coordinate system, which</span>0042 <span class="comment">% is Left-handed:</span>0043 <span class="comment">%</span>0044 <span class="comment">% X-Y plane is Transverse</span>0045 <span class="comment">% X-Z plane is Coronal</span>0046 <span class="comment">% Y-Z plane is Sagittal</span>0047 <span class="comment">%</span>0048 <span class="comment">% X axis runs from patient right (low X) to patient Left (high X)</span>0049 <span class="comment">% Y axis runs from posterior (low Y) to Anterior (high Y)</span>0050 <span class="comment">% Z axis runs from inferior (low Z) to Superior (high Z)</span>0051 <span class="comment">%</span>0052 <span class="comment">% See also: avw_hdr_read (called by this function),</span>0053 <span class="comment">% avw_view, avw_write, avw_img_write, avw_flip</span>0054 <span class="comment">%</span>0055 0056 0057 <span class="comment">% $Revision: 1.9 $ $Date: 2004/02/07 01:41:51 $</span>0058 0059 <span class="comment">% Licence: GNU GPL, no express or implied warranties</span>0060 <span class="comment">% History: 05/2002, Darren.Weber@flinders.edu.au</span>0061 <span class="comment">% The Analyze format is copyright</span>0062 <span class="comment">% (c) Copyright, 1986-1995</span>0063 <span class="comment">% Biomedical Imaging Resource, Mayo Foundation</span>0064 <span class="comment">% 01/2003, Darren.Weber@flinders.edu.au</span>0065 <span class="comment">% - adapted for matlab v5</span>0066 <span class="comment">% - revised all orientation information and handling</span>0067 <span class="comment">% after seeking further advice from AnalyzeDirect.com</span>0068 <span class="comment">% 03/2003, Darren.Weber@flinders.edu.au</span>0069 <span class="comment">% - adapted for -ve pixdim values (non standard Analyze)</span>0070 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0071 0072 <span class="keyword">if</span> ~exist(<span class="string">'fileprefix'</span>,<span class="string">'var'</span>),0073 msg = sprintf(<span class="string">'...no input fileprefix - see help avw_img_read\n\n'</span>);0074 error(msg);0075 <span class="keyword">end</span>0076 <span class="keyword">if</span> ~exist(<span class="string">'IMGorient'</span>,<span class="string">'var'</span>), IMGorient = <span class="string">''</span>; <span class="keyword">end</span>0077 <span class="keyword">if</span> ~exist(<span class="string">'machine'</span>,<span class="string">'var'</span>), machine = <span class="string">'ieee-le'</span>; <span class="keyword">end</span>0078 0079 <span class="keyword">if</span> findstr(<span class="string">'.hdr'</span>,fileprefix),0080 fileprefix = strrep(fileprefix,<span class="string">'.hdr'</span>,<span class="string">''</span>);0081 <span class="keyword">end</span>0082 <span class="keyword">if</span> findstr(<span class="string">'.img'</span>,fileprefix),0083 fileprefix = strrep(fileprefix,<span class="string">'.img'</span>,<span class="string">''</span>);0084 <span class="keyword">end</span>0085 0086 <span class="comment">% MAIN</span>0087 0088 <span class="comment">% Read the file header</span>0089 [ avw, machine ] = <a href="avw_hdr_read.html" class="code" title="function [ avw, machine ] = avw_hdr_read(fileprefix, machine)">avw_hdr_read</a>(fileprefix,machine);0090 0091 avw = <a href="#_sub1" class="code" title="subfunction [ avw ] = read_image(avw,IMGorient,machine)">read_image</a>(avw,IMGorient,machine);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -