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

📄 avw_hdr_write.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_write</title>  <meta name="keywords" content="avw_hdr_write">  <meta name="description" content="AVW_HDR_WRITE - Write Analyze header file (*.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_write.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_write</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_WRITE - Write Analyze header file (*.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_hdr_write(avw, 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_WRITE - Write Analyze header file (*.hdr)
 
 avw_hdr_write(avw, fileprefix, machine)
 
 eg, avw_hdr_write(avw,'test');
 
 avw        - a struct with .hdr field, which itself is a struct,
              containing all fields of an Analyze header.
              For details, see avw_hdr_read.m
 
 fileprefix - a string, the filename without the .hdr extension.
              If empty, may use avw.fileprefix
 
 machine    - a string, see machineformat in fread for details.
              The default here is 'ieee-le'.
 
 See also, <a href="avw_hdr_read.html" class="code" title="function [ avw, machine ] = avw_hdr_read(fileprefix, machine)">AVW_HDR_READ</a> <a href="avw_hdr_make.html" class="code" title="function [ avw ] = avw_hdr_make">AVW_HDR_MAKE</a>           <a href="avw_img_read.html" class="code" title="function [ avw, machine ] = avw_img_read(fileprefix,IMGorient,machine)">AVW_IMG_READ</a> <a href="avw_img_write.html" class="code" title="function avw_img_write(avw, fileprefix, IMGorient, machine)">AVW_IMG_WRITE</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_make.html" class="code" title="function [ avw ] = avw_hdr_make">avw_hdr_make</a>	AVW_HDR_MAKE - Create Analyze format data header (avw.hdr)</li><li><a href="avw_hdr_write.html" class="code" title="function avw_hdr_write(avw, fileprefix, machine)">avw_hdr_write</a>	AVW_HDR_WRITE - Write Analyze header file (*.hdr)</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="avw_hdr_write.html" class="code" title="function avw_hdr_write(avw, fileprefix, machine)">avw_hdr_write</a>	AVW_HDR_WRITE - Write Analyze header file (*.hdr)</li><li><a href="avw_img_write.html" class="code" title="function avw_img_write(avw, fileprefix, IMGorient, machine)">avw_img_write</a>	avw_img_write - write Analyze image files (*.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 write_header(fid,avw)</a></li><li><a href="#_sub2" class="code">function header_key(fid,hk)</a></li><li><a href="#_sub3" class="code">function image_dimension(fid,dime)</a></li><li><a href="#_sub4" class="code">function data_history(fid,hist)</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_hdr_write(avw, fileprefix, machine)</a>0002 0003 <span class="comment">% AVW_HDR_WRITE - Write Analyze header file (*.hdr)</span>0004 <span class="comment">%</span>0005 <span class="comment">% avw_hdr_write(avw, fileprefix, machine)</span>0006 <span class="comment">%</span>0007 <span class="comment">% eg, avw_hdr_write(avw,'test');</span>0008 <span class="comment">%</span>0009 <span class="comment">% avw        - a struct with .hdr field, which itself is a struct,</span>0010 <span class="comment">%              containing all fields of an Analyze header.</span>0011 <span class="comment">%              For details, see avw_hdr_read.m</span>0012 <span class="comment">%</span>0013 <span class="comment">% fileprefix - a string, the filename without the .hdr extension.</span>0014 <span class="comment">%              If empty, may use avw.fileprefix</span>0015 <span class="comment">%</span>0016 <span class="comment">% machine    - a string, see machineformat in fread for details.</span>0017 <span class="comment">%              The default here is 'ieee-le'.</span>0018 <span class="comment">%</span>0019 <span class="comment">% See also, AVW_HDR_READ AVW_HDR_MAKE</span>0020 <span class="comment">%           AVW_IMG_READ AVW_IMG_WRITE</span>0021 <span class="comment">%</span>0022 0023 <span class="comment">% $Revision: 1.9 $ $Date: 2004/03/17 06:08:18 $</span>0024 0025 <span class="comment">% Licence:  GNU GPL, no express or implied warranties</span>0026 <span class="comment">% History:  05/2002, Darren.Weber@flinders.edu.au</span>0027 <span class="comment">%           02/2003, Bennett.Landman@ieee.org</span>0028 <span class="comment">%                    - more specific data history var sizes</span>0029 <span class="comment">%                    - 02/2003 confirmed, Darren</span>0030 <span class="comment">%</span>0031 <span class="comment">%                    The Analyze format and c code below is copyright</span>0032 <span class="comment">%                    (c) Copyright, 1986-1995</span>0033 <span class="comment">%                    Biomedical Imaging Resource, Mayo Foundation</span>0034 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0035 0036 version = <span class="string">'[$Revision: 1.9 $]'</span>;0037 fprintf(<span class="string">'AVW_HDR_WRITE [v%s]\n'</span>,version(12:16));  tic;0038 0039 <span class="comment">%----------------------------------------------------------------------------</span>0040 <span class="comment">% Check inputs</span>0041 0042 <span class="keyword">if</span> ~exist(<span class="string">'avw'</span>,<span class="string">'var'</span>),0043     fprintf(<span class="string">'...no input avw - calling avw_hdr_make\n'</span>);0044     avw = <a href="avw_hdr_make.html" class="code" title="function [ avw ] = avw_hdr_make">avw_hdr_make</a>;0045 <span class="keyword">elseif</span> isempty(avw),0046     fprintf(<span class="string">'...empty input avw - calling avw_hdr_make\n'</span>);0047     avw = <a href="avw_hdr_make.html" class="code" title="function [ avw ] = avw_hdr_make">avw_hdr_make</a>;0048 <span class="keyword">elseif</span> ~isfield(avw,<span class="string">'hdr'</span>),0049     fprintf(<span class="string">'...empty input avw.hdr - calling avw_hdr_make\n'</span>);0050     avw = <a href="avw_hdr_make.html" class="code" title="function [ avw ] = avw_hdr_make">avw_hdr_make</a>;0051 <span class="keyword">end</span>0052 <span class="keyword">if</span> ~isequal(avw.hdr.hk.sizeof_hdr,348),0053     msg = sprintf(<span class="string">'...avw.hdr.hk.sizeof_hdr must be 348!\n'</span>);0054     error(msg);0055 <span class="keyword">end</span>0056 0057 quit = 0;0058 <span class="keyword">if</span> ~exist(<span class="string">'fileprefix'</span>,<span class="string">'var'</span>),0059     <span class="keyword">if</span> isfield(avw,<span class="string">'fileprefix'</span>),0060         <span class="keyword">if</span> ~isempty(avw.fileprefix),0061             fileprefix = avw.fileprefix;0062         <span class="keyword">else</span>,0063             quit = 1;0064         <span class="keyword">end</span>0065     <span class="keyword">else</span>0066         quit = 1;0067     <span class="keyword">end</span>0068     <span class="keyword">if</span> quit,0069         fprintf(<span class="string">'...no input fileprefix - see help avw_hdr_write\n\n'</span>);0070         helpwin <a href="avw_hdr_write.html" class="code" title="function avw_hdr_write(avw, fileprefix, machine)">avw_hdr_write</a>;0071         <span class="keyword">return</span>;0072     <span class="keyword">end</span>0073 <span class="keyword">end</span>0074 0075 <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>0076 0077 <span class="keyword">if</span> findstr(<span class="string">'.hdr'</span>,fileprefix),0078 <span class="comment">%    fprintf('AVW_HDR_WRITE: Removing .hdr extension from ''%s''\n',fileprefix);</span>0079     fileprefix = strrep(fileprefix,<span class="string">'.hdr'</span>,<span class="string">''</span>);0080 <span class="keyword">end</span>0081 0082 0083 0084 <span class="comment">%----------------------------------------------------------------------------</span>0085 <span class="comment">% MAIN</span>0086 0087 tic;0088 0089 fid = fopen(sprintf(<span class="string">'%s.hdr'</span>,fileprefix),<span class="string">'w'</span>,machine);0090 <span class="keyword">if</span> fid &lt; 0,0091     msg = sprintf(<span class="string">'Cannot write to file %s.hdr\n'</span>,fileprefix);0092     error(msg);0093 <span class="keyword">else</span>0094     fprintf(<span class="string">'...writing %s Analyze header.\n'</span>,machine);0095     <a href="#_sub1" class="code" title="subfunction write_header(fid,avw)">write_header</a>(fid,avw);

⌨️ 快捷键说明

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