📄 avw_img_read_4d.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_4d</title> <meta name="keywords" content="avw_img_read_4d"> <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_4d.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_4d</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_4d(fileprefix,volIndex,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, [volIndex], [orient], [machine])
fileprefix - a string, the filename without the .img extension
volIndex - the volume to read from a 4D file, where the first volume
has index 1 (the default)
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) from a volume of a 4D Analyze file 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)"></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,volIndex,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_4d(fileprefix,volIndex,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, [volIndex], [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">% volIndex - the volume to read from a 4D file, where the first volume</span>0010 <span class="comment">% has index 1 (the default)</span>0011 <span class="comment">%</span>0012 <span class="comment">% orient - read a specified orientation, integer values:</span>0013 <span class="comment">%</span>0014 <span class="comment">% '', use header history orient field</span>0015 <span class="comment">% 0, transverse unflipped (LAS*)</span>0016 <span class="comment">% 1, coronal unflipped (LA*S)</span>0017 <span class="comment">% 2, sagittal unflipped (L*AS)</span>0018 <span class="comment">% 3, transverse flipped (LPS*)</span>0019 <span class="comment">% 4, coronal flipped (LA*I)</span>0020 <span class="comment">% 5, sagittal flipped (L*AI)</span>0021 <span class="comment">%</span>0022 <span class="comment">% where * follows the slice dimension and letters indicate +XYZ</span>0023 <span class="comment">% orientations (L left, R right, A anterior, P posterior,</span>0024 <span class="comment">% I inferior, & S superior).</span>0025 <span class="comment">%</span>0026 <span class="comment">% Some files may contain data in the 3-5 orientations, but this</span>0027 <span class="comment">% is unlikely. For more information about orientation, see the</span>0028 <span class="comment">% documentation at the end of this .m file. See also the</span>0029 <span class="comment">% AVW_FLIP function for orthogonal reorientation.</span>0030 <span class="comment">%</span>0031 <span class="comment">% machine - a string, see machineformat in fread for details.</span>0032 <span class="comment">% The default here is 'ieee-le' but the routine</span>0033 <span class="comment">% will automatically switch between little and big</span>0034 <span class="comment">% endian to read any such Analyze header. It</span>0035 <span class="comment">% reports the appropriate machine format and can</span>0036 <span class="comment">% return the machine value.</span>0037 <span class="comment">%</span>0038 <span class="comment">% Returned values:</span>0039 <span class="comment">%</span>0040 <span class="comment">% avw.hdr - a struct with image data parameters.</span>0041 <span class="comment">% avw.img - a 3D matrix of image data (double precision)</span>0042 <span class="comment">% from a volume of a 4D Analyze file</span>0043 <span class="comment">%</span>0044 <span class="comment">% The returned 3D matrix will correspond with the</span>0045 <span class="comment">% default ANALYZE coordinate system, which</span>0046 <span class="comment">% is Left-handed:</span>0047 <span class="comment">%</span>0048 <span class="comment">% X-Y plane is Transverse</span>0049 <span class="comment">% X-Z plane is Coronal</span>0050 <span class="comment">% Y-Z plane is Sagittal</span>0051 <span class="comment">%</span>0052 <span class="comment">% X axis runs from patient right (low X) to patient Left (high X)</span>0053 <span class="comment">% Y axis runs from posterior (low Y) to Anterior (high Y)</span>0054 <span class="comment">% Z axis runs from inferior (low Z) to Superior (high Z)</span>0055 <span class="comment">%</span>0056 <span class="comment">% See also: avw_hdr_read (called by this function),</span>0057 <span class="comment">% avw_view, avw_write, avw_img_write, avw_flip</span>0058 <span class="comment">%</span>0059 0060 0061 <span class="comment">% $Revision: 1.1 $ $Date: 2004/02/04 00:12:10 $</span>0062 0063 <span class="comment">% Licence: GNU GPL, no express or implied warranties</span>0064 <span class="comment">% History: 05/2002, Darren.Weber@flinders.edu.au</span>0065 <span class="comment">% The Analyze format is copyright</span>0066 <span class="comment">% (c) Copyright, 1986-1995</span>0067 <span class="comment">% Biomedical Imaging Resource, Mayo Foundation</span>0068 <span class="comment">% 01/2003, Darren.Weber@flinders.edu.au</span>0069 <span class="comment">% - adapted for matlab v5</span>0070 <span class="comment">% - revised all orientation information and handling</span>0071 <span class="comment">% after seeking further advice from AnalyzeDirect.com</span>0072 <span class="comment">% 03/2003, Darren.Weber@flinders.edu.au</span>0073 <span class="comment">% - adapted for -ve pixdim values (non standard Analyze)</span>0074 <span class="comment">% 11/2003, Darren.Weber_at_radiology.ucsf.edu</span>0075 <span class="comment">% - adapted for 4D Analyze files</span>0076 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0077 0078 0079 error(<span class="string">'in development'</span>);0080 0081 0082 <span class="keyword">if</span> ~exist(<span class="string">'fileprefix'</span>,<span class="string">'var'</span>),0083 msg = sprintf(<span class="string">'...no input fileprefix - see help avw_img_read\n\n'</span>);0084 error(msg);0085 <span class="keyword">end</span>0086 <span class="keyword">if</span> ~exist(<span class="string">'volIndex'</span>,<span class="string">'var'</span>), volIndex = 1; <span class="keyword">end</span>0087 <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>0088 <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>0089 0090 <span class="keyword">if</span> findstr(<span class="string">'.hdr'</span>,fileprefix),0091 fileprefix = strrep(fileprefix,<span class="string">'.hdr'</span>,<span class="string">''</span>);0092 <span class="keyword">end</span>0093 <span class="keyword">if</span> findstr(<span class="string">'.img'</span>,fileprefix),0094 fileprefix = strrep(fileprefix,<span class="string">'.img'</span>,<span class="string">''</span>);0095 <span class="keyword">end</span>0096 0097 <span class="comment">% MAIN</span>0098 0099 <span class="comment">% Read the file header</span>0100 [ 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);0101 0102 avw = <a href="#_sub1" class="code" title="subfunction [ avw ] = read_image(avw,volIndex,IMGorient,machine)">read_image</a>(avw,volIndex,IMGorient,machine);0103 0104 <span class="keyword">return</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -