⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avw_hdr_read.html

📁 mri_toolbox是一个工具用来MRI. 来自于SourceForge, 我上传这个软件,希望能结识对医疗软件感兴趣的兄弟.
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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_hdr_read</title>  <meta name="keywords" content="avw_hdr_read">  <meta name="description" content="avw_hdr_read - read Analyze format data header (*.hdr)">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <meta name="generator" content="m2html &copy; 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> &gt;  <a href="index.html">mri_toolbox</a> &gt; avw_hdr_read.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for mri_toolbox&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>avw_hdr_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_hdr_read - read Analyze format data header (*.hdr)</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_hdr_read(fileprefix, 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_hdr_read - read Analyze format data header (*.hdr)

 [ avw, machine ] = avw_hdr_read(fileprefix, [machine])

 fileprefix - string filename (without .hdr); the file name
              can be given as a full path or relative to the
              current directory.
 
 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.

 avw.hdr - a struct, all fields returned from the header.
           For details, find a good description on the web
           or see the Analyze File Format pdf in the 
           mri_toolbox doc folder or read this .m file.

 This function is called by avw_img_read
 
 See also <a href="avw_hdr_write.html" class="code" title="function avw_hdr_write(avw, fileprefix, machine)">avw_hdr_write</a>, <a href="avw_hdr_make.html" class="code" title="function [ avw ] = avw_hdr_make">avw_hdr_make</a>, <a href="avw_view_hdr.html" class="code" title="function avw_view_hdr(avw,parent)">avw_view_hdr</a>, <a href="avw_view.html" class="code" title="function [ varargout ] = avw_view(avw,parent,command),">avw_view</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)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><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_img_read.html" class="code" title="function [ avw, machine ] = avw_img_read(fileprefix,IMGorient,machine)">avw_img_read</a>	avw_img_read - read Analyze format data image (*.img)</li><li><a href="avw_img_read_4d.html" class="code" title="function [ avw, machine ] = avw_img_read_4d(fileprefix,volIndex,IMGorient,machine)">avw_img_read_4d</a>	avw_img_read - read Analyze format data image (*.img)</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 [ dsr ] = read_header(fid)</a></li><li><a href="#_sub2" class="code">function [hk] = header_key(fid)</a></li><li><a href="#_sub3" class="code">function [ dime ] = image_dimension(fid)</a></li><li><a href="#_sub4" class="code">function [ hist ] = data_history(fid)</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_hdr_read(fileprefix, machine)</a>0002 0003 <span class="comment">% avw_hdr_read - read Analyze format data header (*.hdr)</span>0004 <span class="comment">%</span>0005 <span class="comment">% [ avw, machine ] = avw_hdr_read(fileprefix, [machine])</span>0006 <span class="comment">%</span>0007 <span class="comment">% fileprefix - string filename (without .hdr); the file name</span>0008 <span class="comment">%              can be given as a full path or relative to the</span>0009 <span class="comment">%              current directory.</span>0010 <span class="comment">%</span>0011 <span class="comment">% machine - a string, see machineformat in fread for details.</span>0012 <span class="comment">%           The default here is 'ieee-le' but the routine</span>0013 <span class="comment">%           will automatically switch between little and big</span>0014 <span class="comment">%           endian to read any such Analyze header.  It</span>0015 <span class="comment">%           reports the appropriate machine format and can</span>0016 <span class="comment">%           return the machine value.</span>0017 <span class="comment">%</span>0018 <span class="comment">% avw.hdr - a struct, all fields returned from the header.</span>0019 <span class="comment">%           For details, find a good description on the web</span>0020 <span class="comment">%           or see the Analyze File Format pdf in the</span>0021 <span class="comment">%           mri_toolbox doc folder or read this .m file.</span>0022 <span class="comment">%</span>0023 <span class="comment">% This function is called by avw_img_read</span>0024 <span class="comment">%</span>0025 <span class="comment">% See also avw_hdr_write, avw_hdr_make, avw_view_hdr, avw_view</span>0026 <span class="comment">%</span>0027 0028 <span class="comment">% $Revision: 1.10 $ $Date: 2004/02/07 01:41:51 $</span>0029 0030 <span class="comment">% Licence:  GNU GPL, no express or implied warranties</span>0031 <span class="comment">% History:  05/2002, Darren.Weber@flinders.edu.au</span>0032 <span class="comment">%                    The Analyze format and c code below is copyright</span>0033 <span class="comment">%                    (c) Copyright, 1986-1995</span>0034 <span class="comment">%                    Biomedical Imaging Resource, Mayo Foundation</span>0035 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0036 0037 version = <span class="string">'[$Revision: 1.10 $]'</span>;0038 fprintf(<span class="string">'\nAVW_HDR_READ [v%s]\n'</span>,version(12:16));  tic;0039 0040 <span class="keyword">if</span> ~exist(<span class="string">'fileprefix'</span>,<span class="string">'var'</span>),0041     msg = sprintf(<span class="string">'...no input fileprefix - see help avw_hdr_read\n\n'</span>);0042     error(msg);0043 <span class="keyword">end</span>0044 <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>0045 0046 0047 <span class="keyword">if</span> findstr(<span class="string">'.hdr'</span>,fileprefix),0048     <span class="comment">% fprintf('...removing .hdr extension from ''%s''\n',fileprefix);</span>0049     fileprefix = strrep(fileprefix,<span class="string">'.hdr'</span>,<span class="string">''</span>);0050 <span class="keyword">end</span>0051 <span class="keyword">if</span> findstr(<span class="string">'.img'</span>,fileprefix),0052     <span class="comment">% fprintf('...removing .img extension from ''%s''\n',fileprefix);</span>0053     fileprefix = strrep(fileprefix,<span class="string">'.img'</span>,<span class="string">''</span>);0054 <span class="keyword">end</span>0055 file = sprintf(<span class="string">'%s.hdr'</span>,fileprefix);0056 0057 <span class="keyword">if</span> exist(file),0058     fprintf(<span class="string">'...reading %s Analyze format'</span>,machine);0059     fid = fopen(file,<span class="string">'r'</span>,machine);0060     avw.hdr = <a href="#_sub1" class="code" title="subfunction [ dsr ] = read_header(fid)">read_header</a>(fid);0061     avw.fileprefix = fileprefix;0062     fclose(fid);0063     0064     <span class="keyword">if</span> ~isequal(avw.hdr.hk.sizeof_hdr,348),0065         fprintf(<span class="string">'...failed.\n'</span>);0066         <span class="comment">% first try reading the opposite endian to 'machine'</span>0067         <span class="keyword">switch</span> machine,0068         <span class="keyword">case</span> <span class="string">'ieee-le'</span>, machine = <span class="string">'ieee-be'</span>;0069         <span class="keyword">case</span> <span class="string">'ieee-be'</span>, machine = <span class="string">'ieee-le'</span>;0070         <span class="keyword">end</span>0071         fprintf(<span class="string">'...reading %s Analyze format'</span>,machine);0072         fid = fopen(file,<span class="string">'r'</span>,machine);0073         avw.hdr = <a href="#_sub1" class="code" title="subfunction [ dsr ] = read_header(fid)">read_header</a>(fid);0074         avw.fileprefix = fileprefix;0075         fclose(fid);0076     <span class="keyword">end</span>0077     <span class="keyword">if</span> ~isequal(avw.hdr.hk.sizeof_hdr,348),0078         <span class="comment">% Now throw an error</span>0079         fprintf(<span class="string">'...failed.\n'</span>);0080         msg = sprintf(<span class="string">'...size of header not equal to 348 bytes!\n\n'</span>);0081         error(msg);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -