📄 avw2ctf.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 avw2ctf</title> <meta name="keywords" content="avw2ctf"> <meta name="description" content="mri = avw2ctf(avw)"> <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> > avw2ctf.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>avw2ctf</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>mri = avw2ctf(avw)</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 mri = avw2ctf(avw) </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"> mri = avw2ctf(avw)
The purpose of this function is to convert an Analyze volume into a CTF
.mri volume. It currently requires that the Analyze volume is
256x256x256, 1x1x1 mm voxels. The avw_read function can
handle various Analyze orientations, so this function assumes that the
avw.img volume has axial unflipped orientation (it always is when
returned by avw_read, regardless of the format in the .img file). The
returned mri struct in the matlab workspace can be saved using
ctf_write_mri (available in the ctf module of the cvs repository, see
http://eeg.sf.net/.</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="ctf_make_mri.html" class="code" title="function mri = ctf_make_mri">ctf_make_mri</a> ctf_make_mri - create a CTF mri struct with zero image</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"></ul><!-- crossreference --><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 mri = avw2ctf(avw)</a>0002 0003 <span class="comment">% mri = avw2ctf(avw)</span>0004 <span class="comment">%</span>0005 <span class="comment">% The purpose of this function is to convert an Analyze volume into a CTF</span>0006 <span class="comment">% .mri volume. It currently requires that the Analyze volume is</span>0007 <span class="comment">% 256x256x256, 1x1x1 mm voxels. The avw_read function can</span>0008 <span class="comment">% handle various Analyze orientations, so this function assumes that the</span>0009 <span class="comment">% avw.img volume has axial unflipped orientation (it always is when</span>0010 <span class="comment">% returned by avw_read, regardless of the format in the .img file). The</span>0011 <span class="comment">% returned mri struct in the matlab workspace can be saved using</span>0012 <span class="comment">% ctf_write_mri (available in the ctf module of the cvs repository, see</span>0013 <span class="comment">% http://eeg.sf.net/.</span>0014 <span class="comment">%</span>0015 0016 <span class="comment">% $Revision: 1.1 $ $Date: 2004/05/21 18:53:00 $</span>0017 0018 <span class="comment">% Licence: GNU GPL, no implied or express warranties</span>0019 <span class="comment">% History: 08/2003, Darren.Weber_at_radiology.ucsf.edu</span>0020 <span class="comment">% - adapted from an appendex to CTF document</span>0021 <span class="comment">% MRIConverter.pdf, which is copied at the end of this</span>0022 <span class="comment">% function.</span>0023 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>0024 0025 0026 mri = <a href="ctf_make_mri.html" class="code" title="function mri = ctf_make_mri">ctf_make_mri</a>;0027 0028 mri.file = [avw.fileprefix,<span class="string">'.mri'</span>];0029 0030 0031 ver = <span class="string">'[$Revision: 1.1 $]'</span>;0032 fprintf(<span class="string">'\nCTF_AVW2MRI [v%s]\n'</span>,ver(12:16)); tic;0033 0034 0035 <span class="comment">% these checks for the volume dims/pixel size could be replaced with an</span>0036 <span class="comment">% interpolation function that could take any Analyze volume and convert it</span>0037 <span class="comment">% to 256x256x256, 1x1x1 mm</span>0038 <span class="keyword">if</span> avw.hdr.dime.dim(2) ~= 256,0039 error(<span class="string">'avw.hdr.dime.dim(2) ~= 256'</span>);0040 <span class="keyword">end</span>0041 <span class="keyword">if</span> avw.hdr.dime.dim(3) ~= 256,0042 error(<span class="string">'avw.hdr.dime.dim(3) ~= 256'</span>);0043 <span class="keyword">end</span>0044 <span class="keyword">if</span> avw.hdr.dime.dim(4) ~= 256,0045 error(<span class="string">'avw.hdr.dime.dim(4) ~= 256'</span>);0046 <span class="keyword">end</span>0047 0048 <span class="keyword">if</span> avw.hdr.dime.pixdim(2) ~= 1,0049 error(<span class="string">'avw.hdr.dime.dim(2) ~= 256'</span>);0050 <span class="keyword">end</span>0051 <span class="keyword">if</span> avw.hdr.dime.pixdim(3) ~= 1,0052 error(<span class="string">'avw.hdr.dime.dim(3) ~= 256'</span>);0053 <span class="keyword">end</span>0054 <span class="keyword">if</span> avw.hdr.dime.pixdim(4) ~= 1,0055 error(<span class="string">'avw.hdr.dime.dim(4) ~= 256'</span>);0056 <span class="keyword">end</span>0057 0058 0059 <span class="comment">% mri.hdr.dataSize = 1 or 2 (bytes), 8 or 16 bits</span>0060 <span class="keyword">if</span> avw.hdr.dime.bitpix == 8,0061 mri.hdr.dataSize = 1;0062 mri.hdr.clippingRange = 255;0063 <span class="keyword">else</span>0064 mri.hdr.dataSize = 2;0065 mri.hdr.clippingRange = 65536;0066 <span class="keyword">end</span>0067 0068 <span class="comment">% This next step should always work correctly, given that avw_read always</span>0069 <span class="comment">% converts any Analyze orientation into axial unflipped in the matlab</span>0070 <span class="comment">% workspace variable avw.img; the axial unflipped orientation is</span>0071 <span class="comment">% (+X left, +Y anterior, +Z superior); the ctf orientation is</span>0072 <span class="comment">% (+X right, +Y posterior, +Z inferior), the complete opposite.</span>0073 temp = flipdim(avw.img,1);0074 temp = flipdim(temp,2);0075 temp = flipdim(temp,3);0076 mri.img = temp;0077 0078 t=toc; fprintf(<span class="string">'...done (%5.2f sec).\n\n'</span>,t);0079 0080 <span class="keyword">return</span></pre></div><hr><address>Generated on Fri 21-May-2004 12:38:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -