<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>img.c Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">img.c</div> </div> </div> <div class="contents"> <a href="img_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/******************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Copyright (c) 2002-2009 by Turku PET Centre</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> Library: img</span> <a name="l00006"></a>00006 <span class="comment"> Description: Basic tools for working with IMG data struct.</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00009"></a>00009 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span> <a name="l00010"></a>00010 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00011"></a>00011 <span class="comment"> version 2.1 of the License, or (at your option) any later version.</span> <a name="l00012"></a>00012 <span class="comment"></span> <a name="l00013"></a>00013 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00014"></a>00014 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00015"></a>00015 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span> <a name="l00016"></a>00016 <span class="comment"> See the GNU Lesser General Public License for more details:</span> <a name="l00017"></a>00017 <span class="comment"> http://www.gnu.org/copyleft/lesser.html</span> <a name="l00018"></a>00018 <span class="comment"></span> <a name="l00019"></a>00019 <span class="comment"> You should have received a copy of the GNU Lesser General Public License</span> <a name="l00020"></a>00020 <span class="comment"> along with this library/program; if not, write to the Free Software</span> <a name="l00021"></a>00021 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment"> Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi/</span> <a name="l00024"></a>00024 <span class="comment"></span> <a name="l00025"></a>00025 <span class="comment"> Modification history:</span> <a name="l00026"></a>00026 <span class="comment"> 2002-01-20 Vesa Oikonen</span> <a name="l00027"></a>00027 <span class="comment"> First created.</span> <a name="l00028"></a>00028 <span class="comment"> 2002-03-28 VO</span> <a name="l00029"></a>00029 <span class="comment"> sampleDistance included in IMG structure.</span> <a name="l00030"></a>00030 <span class="comment"> Included function imgDecayCorrection().</span> <a name="l00031"></a>00031 <span class="comment"> 2002-07-30 VO</span> <a name="l00032"></a>00032 <span class="comment"> memset() added to imgInit().</span> <a name="l00033"></a>00033 <span class="comment"> 2002-08-23 VO</span> <a name="l00034"></a>00034 <span class="comment"> _dataType included in IMG structure in img.h.</span> <a name="l00035"></a>00035 <span class="comment"> 2002-12-01 VO</span> <a name="l00036"></a>00036 <span class="comment"> imgDecayCorrection() can be used also to remove decay correction.</span> <a name="l00037"></a>00037 <span class="comment"> 2002-12-03 VO</span> <a name="l00038"></a>00038 <span class="comment"> Included function imgCopyhdr().</span> <a name="l00039"></a>00039 <span class="comment"> 2002-12-23 VO</span> <a name="l00040"></a>00040 <span class="comment"> patientName included in IMG structure.</span> <a name="l00041"></a>00041 <span class="comment"> imgIsotope() included.</span> <a name="l00042"></a>00042 <span class="comment"> Decay correction factors are saved and used in imgDecayCorrection().</span> <a name="l00043"></a>00043 <span class="comment"> 2003-09-04 VO</span> <a name="l00044"></a>00044 <span class="comment"> _fileFormat included in IMG structure in img.h.</span> <a name="l00045"></a>00045 <span class="comment"> 2003-11-04 VO</span> <a name="l00046"></a>00046 <span class="comment"> Added unit nCi/mL.</span> <a name="l00047"></a>00047 <span class="comment"> 2003-12-14 VO</span> <a name="l00048"></a>00048 <span class="comment"> Memory for all pixels is allocated in one chunk, because:</span> <a name="l00049"></a>00049 <span class="comment"> -faster when disk swapping is necessary</span> <a name="l00050"></a>00050 <span class="comment"> -pixel data can be easily saved in tmpfile</span> <a name="l00051"></a>00051 <span class="comment"> -whole data set can be easily processed with one pointer.</span> <a name="l00052"></a>00052 <span class="comment"> Unnecessary includes were removed.</span> <a name="l00053"></a>00053 <span class="comment"> (Patient) orientation included in IMG structure in img.h.</span> <a name="l00054"></a>00054 <span class="comment"> Scanner (type) included in IMG structure in img.h.</span> <a name="l00055"></a>00055 <span class="comment"> 2003-12-18 VO</span> <a name="l00056"></a>00056 <span class="comment"> Included function imgExtractRange().</span> <a name="l00057"></a>00057 <span class="comment"> 2004-05-23 VO</span> <a name="l00058"></a>00058 <span class="comment"> Added unit MBq/ml in img_unit().</span> <a name="l00059"></a>00059 <span class="comment"> Added a few comments.</span> <a name="l00060"></a>00060 <span class="comment"> 2004-06-21 VO</span> <a name="l00061"></a>00061 <span class="comment"> Previous addition should now work.</span> <a name="l00062"></a>00062 <span class="comment"> 2004-08-23 VO</span> <a name="l00063"></a>00063 <span class="comment"> New library function studynr_from_fname() is applied.</span> <a name="l00064"></a>00064 <span class="comment"> MAX_STUDYNR_LEN applied where appropriate.</span> <a name="l00065"></a>00065 <span class="comment"> 2004-09-20 VO</span> <a name="l00066"></a>00066 <span class="comment"> Doxygen style comments are corrected.</span> <a name="l00067"></a>00067 <span class="comment"> 2004-09-24 VO</span> <a name="l00068"></a>00068 <span class="comment"> Added units Bq/cc and uCi/cc in img_unit().</span> <a name="l00069"></a>00069 <span class="comment"> 2006-10-30 VO</span> <a name="l00070"></a>00070 <span class="comment"> imgUnit() moved into imgunit.c.</span> <a name="l00071"></a>00071 <span class="comment"> 2007-01-28 VO</span> <a name="l00072"></a>00072 <span class="comment"> Applies new definitions and IMG struct members.</span> <a name="l00073"></a>00073 <span class="comment"> imgInfo() prints part of information in interfile-type format.</span> <a name="l00074"></a>00074 <span class="comment"> Functions imgDecayCorrection() and imgIsotope() moved to new imgdecay.c.</span> <a name="l00075"></a>00075 <span class="comment"> 2007-02-11 VO</span> <a name="l00076"></a>00076 <span class="comment"> Status (error) message array imgmsg moved back here, with corresponding</span> <a name="l00077"></a>00077 <span class="comment"> enums in img.h.</span> <a name="l00078"></a>00078 <span class="comment"> Added functions imgStatus() and imgSetStatus().</span> <a name="l00079"></a>00079 <span class="comment"> 2007-02-27 VO</span> <a name="l00080"></a>00080 <span class="comment"> Correction in imgInfo().</span> <a name="l00081"></a>00081 <span class="comment"> Added error messages 24 and 25.</span> <a name="l00082"></a>00082 <span class="comment"> 2007-03-13 VO</span> <a name="l00083"></a>00083 <span class="comment"> Added error messages 26 and 27.</span> <a name="l00084"></a>00084 <span class="comment"> 2007-03-26 VO</span> <a name="l00085"></a>00085 <span class="comment"> Polar map variables were added in IMG struct.</span> <a name="l00086"></a>00086 <span class="comment"> Added error messages 28 and 29 for polar maps.</span> <a name="l00087"></a>00087 <span class="comment"> 2007-07-17 Harri Merisaari</span> <a name="l00088"></a>00088 <span class="comment"> Modified for optional ANSi compatibility</span> <a name="l00089"></a>00089 <span class="comment"> 2007-09-06 VO</span> <a name="l00090"></a>00090 <span class="comment"> Bug correction in imgSetStatus().</span> <a name="l00091"></a>00091 <span class="comment"> 2007-09-10 VO</span> <a name="l00092"></a>00092 <span class="comment"> Return value of localtime() is checked.</span> <a name="l00093"></a>00093 <span class="comment"> 2008-07-14 VO</span> <a name="l00094"></a>00094 <span class="comment"> Added function imgAllocateWithHeader() from libtpcmodext.</span> <a name="l00095"></a>00095 <span class="comment"> 2009-02-16 VO</span> <a name="l00096"></a>00096 <span class="comment"> Added comments for Doxygen</span> <a name="l00097"></a>00097 <span class="comment"></span> <a name="l00098"></a>00098 <span class="comment"></span> <a name="l00099"></a>00099 <span class="comment">******************************************************************************/</span> <a name="l00100"></a>00100 <span class="preprocessor">#include <stdio.h></span> <a name="l00101"></a>00101 <span class="preprocessor">#include <stdlib.h></span> <a name="l00102"></a>00102 <span class="preprocessor">#include <math.h></span> <a name="l00103"></a>00103 <span class="preprocessor">#include <string.h></span> <a name="l00104"></a>00104 <span class="preprocessor">#include <time.h></span> <a name="l00105"></a>00105 <span class="comment">/*****************************************************************************/</span> <a name="l00106"></a>00106 <span class="preprocessor">#include "studynr.h"</span> <a name="l00107"></a>00107 <span class="preprocessor">#include "halflife.h"</span> <a name="l00108"></a>00108 <span class="comment">/*****************************************************************************/</span> <a name="l00109"></a>00109 <span class="preprocessor">#include "<a class="code" href="imgunit_8h.html">include/imgunit.h</a>"</span> <a name="l00110"></a>00110 <span class="preprocessor">#include "<a class="code" href="img_8h.html">include/img.h</a>"</span> <a name="l00111"></a>00111 <span class="comment">/*****************************************************************************/</span> <a name="l00113"></a><a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">00113</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[] = { <a name="l00114"></a>00114 <span class="comment">/* 0, STATUS_OK */</span> <span class="stringliteral">"ok"</span>, <a name="l00115"></a>00115 <span class="comment">/* 1, STATUS_FAULT */</span> <span class="stringliteral">"fault in calling routine"</span>, <a name="l00116"></a>00116 <span class="comment">/* 2, STATUS_NOMEMORY */</span> <span class="stringliteral">"out of memory"</span>, <a name="l00117"></a>00117 <span class="comment">/* 3, STATUS_NOFILE */</span> <span class="stringliteral">"cannot open file"</span>, <a name="l00118"></a>00118 <span class="comment">/* 4, STATUS_UNKNOWNFORMAT */</span> <span class="stringliteral">"unknown file format"</span>, <a name="l00119"></a>00119 <span class="comment">/* 5, STATUS_UNSUPPORTED */</span> <span class="stringliteral">"unsupported file type"</span>, <a name="l00120"></a>00120 <span class="comment">/* 6, STATUS_MISSINGMATRIX */</span> <span class="stringliteral">"missing matrix/matrices"</span>, <a name="l00121"></a>00121 <span class="comment">/* 7, STATUS_NOWRITEPERM */</span> <span class="stringliteral">"no permission to write"</span>, <a name="l00122"></a>00122 <span class="comment">/* 8, STATUS_DISKFULL */</span> <span class="stringliteral">"disk full?"</span>, <a name="l00123"></a>00123 <span class="comment">/* 9, STATUS_NOMATLIST */</span> <span class="stringliteral">"cannot read matrix list"</span>, <a name="l00124"></a>00124 <span class="comment">/* 10, STATUS_INVALIDMATLIST */</span> <span class="stringliteral">"invalid matrix list"</span>, <a name="l00125"></a>00125 <span class="comment">/* 11, STATUS_VARMATSIZE */</span> <span class="stringliteral">"variable matrix size"</span>, <a name="l00126"></a>00126 <span class="comment">/* 12, STATUS_NOMAINHEADER */</span> <span class="stringliteral">"cannot read mainheader"</span>, <a name="l00127"></a>00127 <span class="comment">/* 13, STATUS_NOSUBHEADER */</span> <span class="stringliteral">"cannot read subheader"</span>, <a name="l00128"></a>00128 <span class="comment">/* 14, STATUS_NOMATRIX */</span> <span class="stringliteral">"cannot read matrix"</span>, <a name="l00129"></a>00129 <span class="comment">/* 15, STATUS_UNSUPPORTEDAXIALCOMP */</span> <span class="stringliteral">"axial compression is not supported"</span>, <a name="l00130"></a>00130 <span class="comment">/* 16, STATUS_NOIMGDATAFILE */</span> <span class="stringliteral">"image datafile does not exist"</span>, <a name="l00131"></a>00131 <span class="comment">/* 17, STATUS_NOHEADERFILE */</span> <span class="stringliteral">"header file does not exist"</span>, <a name="l00132"></a>00132 <span class="comment">/* 18, STATUS_INVALIDHEADER */</span> <span class="stringliteral">"invalid header contents"</span>, <a name="l00133"></a>00133 <span class="comment">/* 19, STATUS_NOIMGDATA */</span> <span class="stringliteral">"cannot read image data"</span>, <a name="l00134"></a>00134 <span class="comment">/* 20, STATUS_NOSIFDATA */</span> <span class="stringliteral">"cannot read sif data"</span>, <a name="l00135"></a>00135 <span class="comment">/* 21, STATUS_WRONGSIFDATA */</span> <span class="stringliteral">"wrong sif data"</span>, <a name="l00136"></a>00136 <span class="comment">/* 22, STATUS_CANTWRITEIMGFILE */</span> <span class="stringliteral">"cannot write image datafile"</span>, <a name="l00137"></a>00137 <span class="comment">/* 23, STATUS_CANTWRITEHEADERFILE */</span> <span class="stringliteral">"cannot write header file"</span>, <a name="l00138"></a>00138 <span class="comment">/* 24, STATUS_WRONGFILETYPE */</span> <span class="stringliteral">"wrong file type"</span>, <a name="l00139"></a>00139 <span class="comment">/* 25, STATUS_CANNOTERASE */</span> <span class="stringliteral">"cannot erase file"</span>, <a name="l00140"></a>00140 <span class="comment">/* 26, STATUS_CANNOTREAD */</span> <span class="stringliteral">"cannot read data"</span>, <a name="l00141"></a>00141 <span class="comment">/* 27, STATUS_CANNOTWRITE */</span> <span class="stringliteral">"cannot write data"</span>, <a name="l00142"></a>00142 <span class="comment">/* 28, STATUS_UNSUPPORTEDPOLARMAP */</span> <span class="stringliteral">"polar map is not supported"</span>, <a name="l00143"></a>00143 <span class="comment">/* 29, STATUS_INVALIDPOLARMAP */</span> <span class="stringliteral">"invalid polar map"</span>, <a name="l00144"></a>00144 0 <a name="l00145"></a>00145 }; <a name="l00146"></a>00146 <span class="preprocessor">#if 0</span> <a name="l00147"></a>00147 <span class="preprocessor"></span> <a name="l00148"></a>00148 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *_imgStatusMessage[] = <a name="l00149"></a>00149 { <a name="l00150"></a>00150 <span class="comment">/* 0, IMG_ERR_OK */</span> <span class="stringliteral">"ok"</span>, <a name="l00151"></a>00151 <span class="comment">/* 1, IMG_ERR_CALLING */</span> <span class="stringliteral">"fault in calling routine"</span>, <a name="l00152"></a>00152 <span class="comment">/* 2, IMG_ERR_OOM */</span> <span class="stringliteral">"out of memory"</span> <a name="l00153"></a>00153 }; <a name="l00154"></a>00154 <span class="preprocessor">#endif</span> <a name="l00155"></a>00155 <span class="preprocessor"></span><span class="comment">/*****************************************************************************/</span> <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">/*****************************************************************************/</span> <a name="l00163"></a><a class="code" href="img_8h.html#af95041292a0f9e4a82a10b49a074a95c">00163</a> <span class="keywordtype">void</span> <a class="code" href="img_8c.html#af95041292a0f9e4a82a10b49a074a95c">imgInit</a>(<a class="code" href="structIMG.html">IMG</a> *image) { <a name="l00164"></a>00164 <span class="keywordtype">int</span> i = 0; <a name="l00165"></a>00165 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) printf(<span class="stringliteral">"imgInit()\n"</span>); <a name="l00166"></a>00166 memset(image, 0, <span class="keyword">sizeof</span>(<a class="code" href="structIMG.html">IMG</a>)); <a name="l00167"></a>00167 <span class="comment">/*if(image->status!=IMG_STATUS_UNINITIALIZED) return;*/</span> <a name="l00168"></a>00168 image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>=<a class="code" href="img_8h.html#a7aeab2fb426b858c78ec515aaa8f0a67">IMG_STATUS_INITIALIZED</a>; <a name="l00169"></a>00169 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(image, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>); <a name="l00170"></a>00170 image-><a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>=0; <a name="l00171"></a>00171 image-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=0; <a name="l00172"></a>00172 image-><a class="code" href="structIMG.html#ab23da0c2295967727c6d33d0fbdc8c88">zoom</a>=0.0; <a name="l00173"></a>00173 image-><a class="code" href="structIMG.html#ab8bcc846c896a26e5aac045b118fd5cf">radiopharmaceutical</a>[0]=(char)0; <a name="l00174"></a>00174 image-><a class="code" href="structIMG.html#ac9c048a9dc8205b22518b05486d8030b">isotopeHalflife</a>=0.0; <a name="l00175"></a>00175 image-><a class="code" href="structIMG.html#a6ce801dea67ec8224e8cfc9aebb8a909">decayCorrected</a>=(char)0; <a name="l00176"></a>00176 image-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=0; <a name="l00177"></a>00177 image-><a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>=0; <a name="l00178"></a>00178 image-><a class="code" href="structIMG.html#aa25ed90a08d249bc43b076a3c5a30544">orientation</a>=0; <a name="l00179"></a>00179 image-><a class="code" href="structIMG.html#af1d9f4bd7d58988eb4aa9f660a244a64">axialFOV</a>=image-><a class="code" href="structIMG.html#a4a03c16266c7e7dcd6858aca05e7599f">transaxialFOV</a>=image-><a class="code" href="structIMG.html#a399dae5b27dda8d5e1b0e96c885513e4">sampleDistance</a>=0.0; <a name="l00180"></a>00180 image-><a class="code" href="structIMG.html#ad76f79021c93175ec98839613ba4dcd2">studyNr</a>[0]=image-><a class="code" href="structIMG.html#a29013e391052918bd5aa6974eeec811d">patientName</a>[0]=(char)0; <a name="l00181"></a>00181 image-><a class="code" href="structIMG.html#a02cc239e917e7ebf85e34f21448ff080">sizex</a>=image-><a class="code" href="structIMG.html#a80b0609c63f33934bf6e6678c6121cb3">sizey</a>=image-><a class="code" href="structIMG.html#afc2a1d2417a8a3afe2c500173a05c472">sizez</a>=0; <a name="l00182"></a>00182 image-><a class="code" href="structIMG.html#a780bf2ffdee9e977a3a51febb7696701">_dataType</a>=0; <a name="l00183"></a>00183 image-><a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=0; <a name="l00184"></a>00184 image-><a class="code" href="structIMG.html#a7f83c746c35583a9fa323b94d7ea5fb5">scanner</a>=0; <a name="l00185"></a>00185 image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>=0; <a name="l00186"></a>00186 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="img_8h.html#acaea665ceb89d40b45e9987366334bb8">MAX_POLARMAP_NUM_RINGS</a>; i++) { <a name="l00187"></a>00187 image-><a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[i]=0; <a name="l00188"></a>00188 image-><a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[i]=0.0; <a name="l00189"></a>00189 image-><a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[i]=0; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 image-><a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>=0; <a name="l00192"></a>00192 image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>=image-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>=image-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>=image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>=0; <a name="l00193"></a>00193 image-><a class="code" href="structIMG.html#a3fcbe533eed30e6a68f190c4d7e1d575">gapx</a>=image-><a class="code" href="structIMG.html#ae3dafc8f2d8b2f8ab3cd9b21660f5f81">gapy</a>=image-><a class="code" href="structIMG.html#aea74d83981ef722603ebd18fcce9b736">gapz</a>=0.0; <a name="l00194"></a>00194 image-><a class="code" href="structIMG.html#a0e4475f6d2bd9da2f4e35e4eb142ff71">resolutionx</a>=image-><a class="code" href="structIMG.html#a2fa9952c5c950ea93ec64eb8588f7088">resolutiony</a>=image-><a class="code" href="structIMG.html#afe2b3d97e63341cbb408ee64aa20202e">resolutionz</a>=0.0; <a name="l00195"></a>00195 image-><a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>=(<span class="keywordtype">float</span>****)NULL; <a name="l00196"></a>00196 image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00197"></a>00197 image-><a class="code" href="structIMG.html#a0159572be8b2470ec6ada055bb970e9b">pixel</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00198"></a>00198 image-><a class="code" href="structIMG.html#aafa26ff9cee96a0488430af7fe0254ca">column</a>=(<span class="keywordtype">float</span>**)NULL; <a name="l00199"></a>00199 image-><a class="code" href="structIMG.html#a5a5b3d9d71b2072142726fa0c57bdbfe">row</a>=(<span class="keywordtype">float</span>***)NULL; <a name="l00200"></a>00200 image-><a class="code" href="structIMG.html#a898fa520514a631b8afe11d35c2b1093">plane</a>=(<span class="keywordtype">float</span>****)NULL; <a name="l00201"></a>00201 image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>=(<span class="keywordtype">int</span>*)NULL; <a name="l00202"></a>00202 image-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>=image-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>=image-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00203"></a>00203 image-><a class="code" href="structIMG.html#af8f6b963a69d82f9b62a0fcfde538fdf">isWeight</a>=0; <a name="l00204"></a>00204 image-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>=image-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>=image-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>=image-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00205"></a>00205 image-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00206"></a>00206 image-><a class="code" href="structIMG.html#a1674a8df34b0a1b5d10ca415fd93b96a">errstatus</a>=<a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>; <a name="l00207"></a>00207 } <a name="l00208"></a>00208 <span class="comment">/*****************************************************************************/</span> <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="comment">/*****************************************************************************/</span> <a name="l00216"></a><a class="code" href="img_8h.html#ada573d4b40da77be4455bb9fab9a3033">00216</a> <span class="keywordtype">void</span> <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(<a class="code" href="structIMG.html">IMG</a> *image) { <a name="l00217"></a>00217 <span class="keywordtype">int</span> i = 0; <a name="l00218"></a>00218 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) printf(<span class="stringliteral">"imgEmpty()\n"</span>); <a name="l00219"></a>00219 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a><<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>) <span class="keywordflow">return</span>; <a name="l00220"></a>00220 <span class="comment">/* Free up memory */</span> <a name="l00221"></a>00221 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>!=NULL) free(image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>); <a name="l00222"></a>00222 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>!=NULL) free(image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>); <a name="l00223"></a>00223 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>!=NULL) free(image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>); <a name="l00224"></a>00224 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>!=NULL) free(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>); <a name="l00225"></a>00225 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>>0) free(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>); <a name="l00226"></a>00226 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>>0) free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); <a name="l00227"></a>00227 <span class="comment">/* Set variables */</span> <a name="l00228"></a>00228 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(image, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>); <a name="l00229"></a>00229 image-><a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>=0; <a name="l00230"></a>00230 image-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=0; <a name="l00231"></a>00231 image-><a class="code" href="structIMG.html#ab23da0c2295967727c6d33d0fbdc8c88">zoom</a>=0.0; <a name="l00232"></a>00232 image-><a class="code" href="structIMG.html#ab8bcc846c896a26e5aac045b118fd5cf">radiopharmaceutical</a>[0]=(char)0; <a name="l00233"></a>00233 image-><a class="code" href="structIMG.html#ac9c048a9dc8205b22518b05486d8030b">isotopeHalflife</a>=0.0; <a name="l00234"></a>00234 image-><a class="code" href="structIMG.html#a6ce801dea67ec8224e8cfc9aebb8a909">decayCorrected</a>=(char)0; <a name="l00235"></a>00235 image-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=0; <a name="l00236"></a>00236 image-><a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>=0; <a name="l00237"></a>00237 image-><a class="code" href="structIMG.html#aa25ed90a08d249bc43b076a3c5a30544">orientation</a>=0; <a name="l00238"></a>00238 image-><a class="code" href="structIMG.html#af1d9f4bd7d58988eb4aa9f660a244a64">axialFOV</a>=image-><a class="code" href="structIMG.html#a4a03c16266c7e7dcd6858aca05e7599f">transaxialFOV</a>=image-><a class="code" href="structIMG.html#a399dae5b27dda8d5e1b0e96c885513e4">sampleDistance</a>=0.0; <a name="l00239"></a>00239 image-><a class="code" href="structIMG.html#ad76f79021c93175ec98839613ba4dcd2">studyNr</a>[0]=image-><a class="code" href="structIMG.html#a29013e391052918bd5aa6974eeec811d">patientName</a>[0]=image-><a class="code" href="structIMG.html#a7dc9c21dbaf6b609a32e54c708e089c1">patientID</a>[0]=(char)0; <a name="l00240"></a>00240 image-><a class="code" href="structIMG.html#a7743f4bab187593657c7bd4b7e99fe32">userProcessCode</a>[0]=image-><a class="code" href="structIMG.html#a3651200fbb19796a635502a7b7d2c2c3">studyDescription</a>[0]=(char)0; <a name="l00241"></a>00241 image-><a class="code" href="structIMG.html#a02cc239e917e7ebf85e34f21448ff080">sizex</a>=image-><a class="code" href="structIMG.html#a80b0609c63f33934bf6e6678c6121cb3">sizey</a>=image-><a class="code" href="structIMG.html#afc2a1d2417a8a3afe2c500173a05c472">sizez</a>=0; <a name="l00242"></a>00242 image-><a class="code" href="structIMG.html#a3fcbe533eed30e6a68f190c4d7e1d575">gapx</a>=image-><a class="code" href="structIMG.html#ae3dafc8f2d8b2f8ab3cd9b21660f5f81">gapy</a>=image-><a class="code" href="structIMG.html#aea74d83981ef722603ebd18fcce9b736">gapz</a>=0.0; <a name="l00243"></a>00243 image-><a class="code" href="structIMG.html#a0e4475f6d2bd9da2f4e35e4eb142ff71">resolutionx</a>=image-><a class="code" href="structIMG.html#a2fa9952c5c950ea93ec64eb8588f7088">resolutiony</a>=image-><a class="code" href="structIMG.html#afe2b3d97e63341cbb408ee64aa20202e">resolutionz</a>=0.0; <a name="l00244"></a>00244 image-><a class="code" href="structIMG.html#a780bf2ffdee9e977a3a51febb7696701">_dataType</a>=0; <a name="l00245"></a>00245 image-><a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=0; <a name="l00246"></a>00246 image-><a class="code" href="structIMG.html#a7f83c746c35583a9fa323b94d7ea5fb5">scanner</a>=0; <a name="l00247"></a>00247 image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>=0; <a name="l00248"></a>00248 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="img_8h.html#acaea665ceb89d40b45e9987366334bb8">MAX_POLARMAP_NUM_RINGS</a>; i++) { <a name="l00249"></a>00249 image-><a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[i]=0; <a name="l00250"></a>00250 image-><a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[i]=0.0; <a name="l00251"></a>00251 image-><a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[i]=0; <a name="l00252"></a>00252 } <a name="l00253"></a>00253 image-><a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>=0; <a name="l00254"></a>00254 image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>=image-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>=image-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>=image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>=0; <a name="l00255"></a>00255 image-><a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>=(<span class="keywordtype">float</span>****)NULL; <a name="l00256"></a>00256 image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00257"></a>00257 image-><a class="code" href="structIMG.html#a0159572be8b2470ec6ada055bb970e9b">pixel</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00258"></a>00258 image-><a class="code" href="structIMG.html#aafa26ff9cee96a0488430af7fe0254ca">column</a>=(<span class="keywordtype">float</span>**)NULL; <a name="l00259"></a>00259 image-><a class="code" href="structIMG.html#a5a5b3d9d71b2072142726fa0c57bdbfe">row</a>=(<span class="keywordtype">float</span>***)NULL; <a name="l00260"></a>00260 image-><a class="code" href="structIMG.html#a898fa520514a631b8afe11d35c2b1093">plane</a>=(<span class="keywordtype">float</span>****)NULL; <a name="l00261"></a>00261 image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>=(<span class="keywordtype">int</span>*)NULL; <a name="l00262"></a>00262 image-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>=image-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>=image-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00263"></a>00263 image-><a class="code" href="structIMG.html#af8f6b963a69d82f9b62a0fcfde538fdf">isWeight</a>=0; <a name="l00264"></a>00264 image-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>=image-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00265"></a>00265 image-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>=(<span class="keywordtype">float</span>*)NULL; <a name="l00266"></a>00266 <span class="comment">/* Set status */</span> <a name="l00267"></a>00267 image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>=<a class="code" href="img_8h.html#a7aeab2fb426b858c78ec515aaa8f0a67">IMG_STATUS_INITIALIZED</a>; <a name="l00268"></a>00268 image-><a class="code" href="structIMG.html#a1674a8df34b0a1b5d10ca415fd93b96a">errstatus</a>=<a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>; <a name="l00269"></a>00269 } <a name="l00270"></a>00270 <span class="comment">/*****************************************************************************/</span> <a name="l00271"></a>00271 <a name="l00272"></a>00272 <span class="comment">/*****************************************************************************/</span> <a name="l00285"></a><a class="code" href="img_8h.html#a9b2670da9c7685e6d53058cdf1db1199">00285</a> <span class="keywordtype">int</span> <a class="code" href="img_8c.html#a9b2670da9c7685e6d53058cdf1db1199">imgAllocate</a>(<a class="code" href="structIMG.html">IMG</a> *image, <span class="keywordtype">int</span> planes, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> columns, <span class="keywordtype">int</span> frames) { <a name="l00286"></a>00286 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <span class="keywordtype">int</span> zi, ri, ci; <a name="l00287"></a>00287 <span class="keywordtype">float</span> ***rptr, **cptr, *pptr; <a name="l00288"></a>00288 <a name="l00289"></a>00289 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) printf(<span class="stringliteral">"imgAllocate(*image, %d, %d, %d, %d)\n"</span>, planes, rows, columns, frames); <a name="l00290"></a>00290 <span class="comment">/* Check arguments */</span> <a name="l00291"></a>00291 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(image, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55baf8f3d89c25483639f6cbce4f6b08c1f8">STATUS_FAULT</a>); <a name="l00292"></a>00292 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>==<a class="code" href="img_8h.html#aaa022c5022b37f3676f2e888f024f848">IMG_STATUS_UNINITIALIZED</a>) <span class="keywordflow">return</span>(1); <a name="l00293"></a>00293 <span class="keywordflow">if</span>(planes<1 || rows<1 || columns<1 || frames<1) <span class="keywordflow">return</span>(2); <a name="l00294"></a>00294 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>>=<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>) <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(image); <a name="l00295"></a>00295 <span class="comment">/* Allocate memory for header data */</span> <a name="l00296"></a>00296 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(image, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55bafbe470f6663c748e405bf509d2bb57bb">STATUS_NOMEMORY</a>); <a name="l00297"></a>00297 image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>=(<span class="keywordtype">float</span>*)calloc(8*frames, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>)); <a name="l00298"></a>00298 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>==NULL) <a name="l00299"></a>00299 <span class="keywordflow">return</span>(3); <a name="l00300"></a>00300 image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>=(<span class="keywordtype">int</span>*)calloc(planes, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)); <a name="l00301"></a>00301 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>==NULL) { <a name="l00302"></a>00302 free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); <span class="keywordflow">return</span>(4);} <a name="l00303"></a>00303 <span class="comment">/* Allocate memory for image data */</span> <a name="l00304"></a>00304 image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>=(<span class="keywordtype">float</span>****)malloc(planes*<span class="keyword">sizeof</span>(<span class="keywordtype">float</span>***)); <a name="l00305"></a>00305 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>==NULL) { <a name="l00306"></a>00306 free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); free(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>); <span class="keywordflow">return</span>(5);} <a name="l00307"></a>00307 image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>=(<span class="keywordtype">float</span>***)malloc(planes*rows*<span class="keyword">sizeof</span>(<span class="keywordtype">float</span>**)); <a name="l00308"></a>00308 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>==NULL) { <a name="l00309"></a>00309 free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); free(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>); free(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>); <span class="keywordflow">return</span>(6);} <a name="l00310"></a>00310 image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>=(<span class="keywordtype">float</span>**)malloc(planes*rows*columns*<span class="keyword">sizeof</span>(<span class="keywordtype">float</span>*)); <a name="l00311"></a>00311 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>==NULL) { <a name="l00312"></a>00312 free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); free(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>); <a name="l00313"></a>00313 free(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>); free(image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>); <span class="keywordflow">return</span>(7); <a name="l00314"></a>00314 } <a name="l00315"></a>00315 image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>=(<span class="keywordtype">float</span>*)calloc(planes*rows*columns*frames, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>)); <a name="l00316"></a>00316 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>==NULL) { <a name="l00317"></a>00317 free(image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>); free(image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>); <a name="l00318"></a>00318 free(image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>); free(image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>); free(image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>); <span class="keywordflow">return</span>(8); <a name="l00319"></a>00319 } <a name="l00320"></a>00320 <span class="comment">/* Set data pointers */</span> <a name="l00321"></a>00321 rptr=image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>; cptr=image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>; pptr=image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>; <a name="l00322"></a>00322 <span class="keywordflow">for</span>(zi=0; zi<planes; zi++) { <a name="l00323"></a>00323 image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>[zi]=rptr; <a name="l00324"></a>00324 <span class="keywordflow">for</span>(ri=0; ri<rows; ri++) { <a name="l00325"></a>00325 *rptr++=cptr; <a name="l00326"></a>00326 <span class="keywordflow">for</span>(ci=0; ci<columns; ci++) { <a name="l00327"></a>00327 *cptr++=pptr; pptr+=frames; <a name="l00328"></a>00328 } <a name="l00329"></a>00329 } <a name="l00330"></a>00330 } <a name="l00331"></a>00331 image-><a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>=image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>; <a name="l00332"></a>00332 image-><a class="code" href="structIMG.html#a898fa520514a631b8afe11d35c2b1093">plane</a>=image-><a class="code" href="structIMG.html#a531146d2b729353968a43d6e2989f38f">_pln</a>; <a name="l00333"></a>00333 image-><a class="code" href="structIMG.html#aafa26ff9cee96a0488430af7fe0254ca">column</a>=image-><a class="code" href="structIMG.html#a4cb51c45459444516ca2c128b751efc9">_col</a>; <a name="l00334"></a>00334 image-><a class="code" href="structIMG.html#a5a5b3d9d71b2072142726fa0c57bdbfe">row</a>=image-><a class="code" href="structIMG.html#a30639cdc9f0742e8faa0231e33f368f6">_row</a>; <a name="l00335"></a>00335 image-><a class="code" href="structIMG.html#a0159572be8b2470ec6ada055bb970e9b">pixel</a>=image-><a class="code" href="structIMG.html#ac95cb8ec816a62441a7aa602e391bbfc">_pxl</a>; <a name="l00336"></a>00336 <span class="comment">/* Set header pointers */</span> <a name="l00337"></a>00337 image-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+0*frames; <a name="l00338"></a>00338 image-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+1*frames; <a name="l00339"></a>00339 image-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+2*frames; <a name="l00340"></a>00340 image-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+3*frames; <a name="l00341"></a>00341 image-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+4*frames; <a name="l00342"></a>00342 image-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+5*frames; <a name="l00343"></a>00343 image-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>= image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+6*frames; <a name="l00344"></a>00344 image-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>=image-><a class="code" href="structIMG.html#a738354772ccd65509064ffac193e8918">_header</a>+7*frames; <a name="l00345"></a>00345 <span class="comment">/* Ok */</span> <a name="l00346"></a>00346 image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>=planes; image-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>=rows; image-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>=columns; image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>=frames; <a name="l00347"></a>00347 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(image, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>); <a name="l00348"></a>00348 image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>=<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>; <a name="l00349"></a>00349 <span class="keywordflow">return</span>(0); <a name="l00350"></a>00350 } <a name="l00351"></a>00351 <span class="comment">/*****************************************************************************/</span> <a name="l00352"></a>00352 <a name="l00353"></a>00353 <span class="comment">/*****************************************************************************/</span> <a name="l00357"></a><a class="code" href="img_8h.html#ac8aa156f794d80cc3883d9f9401f69e1">00357</a> <span class="keywordtype">int</span> <a class="code" href="img_8c.html#ac8aa156f794d80cc3883d9f9401f69e1">imgAllocateWithHeader</a>( <a name="l00359"></a>00359 <a class="code" href="structIMG.html">IMG</a> *image, <a name="l00361"></a>00361 <span class="keywordtype">int</span> planes, <a name="l00363"></a>00363 <span class="keywordtype">int</span> rows, <a name="l00365"></a>00365 <span class="keywordtype">int</span> columns, <a name="l00367"></a>00367 <span class="keywordtype">int</span> frames, <a name="l00369"></a>00369 <a class="code" href="structIMG.html">IMG</a> *image_from <a name="l00370"></a>00370 ) { <a name="l00371"></a>00371 <span class="keywordtype">int</span> ret; <a name="l00372"></a>00372 ret=<a class="code" href="img_8c.html#a9b2670da9c7685e6d53058cdf1db1199">imgAllocate</a>(image, planes, rows, columns, frames); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span> ret; <a name="l00373"></a>00373 ret=<a class="code" href="img_8c.html#abdf374e8364a31f792daa2b0690ba198">imgCopyhdr</a>(image_from, image); <span class="keywordflow">return</span> ret; <a name="l00374"></a>00374 } <a name="l00375"></a>00375 <span class="comment">/*****************************************************************************/</span> <a name="l00376"></a>00376 <a name="l00377"></a>00377 <span class="comment">/*****************************************************************************/</span> <a name="l00384"></a><a class="code" href="img_8h.html#a2af7a83f855fdb5de24325614912ae5e">00384</a> <span class="keywordtype">char</span> *<a class="code" href="img_8c.html#a2af7a83f855fdb5de24325614912ae5e">imgStatus</a>(<span class="keywordtype">int</span> status_index) { <a name="l00385"></a>00385 <span class="keywordtype">int</span> n=0; <a name="l00386"></a>00386 <span class="keywordflow">while</span>(<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[n]!=0) n++; <a name="l00387"></a>00387 <span class="keywordflow">if</span>(status_index<0 || status_index>n-1) <span class="keywordflow">return</span>((<span class="keywordtype">char</span>*)<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[<a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55baf8f3d89c25483639f6cbce4f6b08c1f8">STATUS_FAULT</a>]); <a name="l00388"></a>00388 <span class="keywordflow">else</span> <span class="keywordflow">return</span>((<span class="keywordtype">char</span>*)<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[status_index]); <a name="l00389"></a>00389 } <a name="l00390"></a>00390 <span class="comment">/*****************************************************************************/</span> <a name="l00391"></a>00391 <a name="l00392"></a>00392 <span class="comment">/*****************************************************************************/</span> <a name="l00399"></a><a class="code" href="img_8h.html#ad124d2d496934d677156cc8779a1e567">00399</a> <span class="keywordtype">void</span> <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(<a class="code" href="structIMG.html">IMG</a> *img, <span class="keywordtype">int</span> status_index) { <a name="l00400"></a>00400 <span class="keywordtype">int</span> n=0; <a name="l00401"></a>00401 <span class="keywordflow">while</span>(<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[n]!=0) n++; <a name="l00402"></a>00402 <span class="keywordflow">if</span>(status_index<0 || status_index>n-1) img-><a class="code" href="structIMG.html#a1674a8df34b0a1b5d10ca415fd93b96a">errstatus</a>=<a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55baf8f3d89c25483639f6cbce4f6b08c1f8">STATUS_FAULT</a>; <a name="l00403"></a>00403 <span class="keywordflow">else</span> img-><a class="code" href="structIMG.html#a1674a8df34b0a1b5d10ca415fd93b96a">errstatus</a>=status_index; <a name="l00404"></a>00404 img-><a class="code" href="structIMG.html#ac92254d675eb4771d22cdd4523ccb19c">statmsg</a>=<a class="code" href="img_8c.html#ae84ca27a99438fced18d361d64bbd4c9">imgmsg</a>[img-><a class="code" href="structIMG.html#a1674a8df34b0a1b5d10ca415fd93b96a">errstatus</a>]; <a name="l00405"></a>00405 } <a name="l00406"></a>00406 <span class="comment">/*****************************************************************************/</span> <a name="l00407"></a>00407 <a name="l00408"></a>00408 <span class="comment">/*****************************************************************************/</span> <a name="l00414"></a><a class="code" href="img_8h.html#a32edd1b78039f6cc22b7bbe413aa3a56">00414</a> <span class="keywordtype">void</span> <a class="code" href="img_8c.html#a32edd1b78039f6cc22b7bbe413aa3a56">imgInfo</a>(<a class="code" href="structIMG.html">IMG</a> *image) { <a name="l00415"></a>00415 <span class="keywordtype">int</span> i; <a name="l00416"></a>00416 <span class="keywordtype">char</span> buf[64]; <a name="l00417"></a>00417 <span class="keyword">struct </span>tm *st; <a name="l00418"></a>00418 <a name="l00419"></a>00419 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) printf(<span class="stringliteral">"imgInfo()\n"</span>); <a name="l00420"></a>00420 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a><=<a class="code" href="img_8h.html#aaa022c5022b37f3676f2e888f024f848">IMG_STATUS_UNINITIALIZED</a>) { <a name="l00421"></a>00421 fprintf(stdout, <span class="stringliteral">"image_status := not initialized\n"</span>); <span class="keywordflow">return</span>; <a name="l00422"></a>00422 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>==<a class="code" href="img_8h.html#a7aeab2fb426b858c78ec515aaa8f0a67">IMG_STATUS_INITIALIZED</a>) { <a name="l00423"></a>00423 fprintf(stdout, <span class="stringliteral">"image_status := initialized but empty\n"</span>); <span class="comment">/* return; */</span> <a name="l00424"></a>00424 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>==<a class="code" href="img_8h.html#aed73bfdf4ad84974fe206b683972cb9d">IMG_STATUS_ERROR</a>) { <a name="l00425"></a>00425 fprintf(stdout, <span class="stringliteral">"image_status := error\n"</span>); <a name="l00426"></a>00426 } <a name="l00427"></a>00427 fprintf(stdout, <span class="stringliteral">"image_error_status := %s\n"</span>, image-><a class="code" href="structIMG.html#ac92254d675eb4771d22cdd4523ccb19c">statmsg</a>); <a name="l00428"></a>00428 fprintf(stdout, <span class="stringliteral">"image_type := %d\n"</span>, image-><a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>); <a name="l00429"></a>00429 fprintf(stdout, <span class="stringliteral">"saved_data_type := %d\n"</span>, image-><a class="code" href="structIMG.html#a780bf2ffdee9e977a3a51febb7696701">_dataType</a>); <a name="l00430"></a>00430 fprintf(stdout, <span class="stringliteral">"file_format := %d\n"</span>, image-><a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>); <a name="l00431"></a>00431 fprintf(stdout, <span class="stringliteral">"scanner := %d\n"</span>, image-><a class="code" href="structIMG.html#a7f83c746c35583a9fa323b94d7ea5fb5">scanner</a>); <a name="l00432"></a>00432 fprintf(stdout, <span class="stringliteral">"identification_code := %.*s\n"</span>, MAX_STUDYNR_LEN, image-><a class="code" href="structIMG.html#ad76f79021c93175ec98839613ba4dcd2">studyNr</a>); <a name="l00433"></a>00433 fprintf(stdout, <span class="stringliteral">"data_unit := %s\n"</span>, <a class="code" href="imgunit_8c.html#afdd2838260ccde7ed239666ca05dcf99">imgUnit</a>((<span class="keywordtype">int</span>)image-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>)); <a name="l00434"></a>00434 fprintf(stdout, <span class="stringliteral">"image_zoom := %g\n"</span>, image-><a class="code" href="structIMG.html#ab23da0c2295967727c6d33d0fbdc8c88">zoom</a>); <a name="l00435"></a>00435 fprintf(stdout, <span class="stringliteral">"radiopharmaceutical := %.32s\n"</span>, image-><a class="code" href="structIMG.html#ab8bcc846c896a26e5aac045b118fd5cf">radiopharmaceutical</a>); <a name="l00436"></a>00436 fprintf(stdout, <span class="stringliteral">"isotope_halflife := %e [sec]\n"</span>, image-><a class="code" href="structIMG.html#ac9c048a9dc8205b22518b05486d8030b">isotopeHalflife</a>); <a name="l00437"></a>00437 st=localtime(&image-><a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>); <a name="l00438"></a>00438 <span class="keywordflow">if</span>(st!=NULL) strftime(buf, 64, <span class="stringliteral">"%Y-%m-%d %H:%M:%S"</span>, st); <span class="keywordflow">else</span> strcpy(buf, <span class="stringliteral">"1900-01-01 00:00:00"</span>); <a name="l00439"></a>00439 fprintf(stdout, <span class="stringliteral">"scan_start_time := %s\n"</span>, buf); <a name="l00440"></a>00440 fprintf(stdout, <span class="stringliteral">"patient_orientation := %d\n"</span>, image-><a class="code" href="structIMG.html#aa25ed90a08d249bc43b076a3c5a30544">orientation</a>); <a name="l00441"></a>00441 fprintf(stdout, <span class="stringliteral">"FOV_axial := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#af1d9f4bd7d58988eb4aa9f660a244a64">axialFOV</a>); <a name="l00442"></a>00442 fprintf(stdout, <span class="stringliteral">"FOV_transaxial := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#a4a03c16266c7e7dcd6858aca05e7599f">transaxialFOV</a>); <a name="l00443"></a>00443 fprintf(stdout, <span class="stringliteral">"sample_distance := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#a399dae5b27dda8d5e1b0e96c885513e4">sampleDistance</a>); <a name="l00444"></a>00444 fprintf(stdout, <span class="stringliteral">"pixel_size_x := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#a02cc239e917e7ebf85e34f21448ff080">sizex</a>); <a name="l00445"></a>00445 fprintf(stdout, <span class="stringliteral">"pixel_size_y := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#a80b0609c63f33934bf6e6678c6121cb3">sizey</a>); <a name="l00446"></a>00446 fprintf(stdout, <span class="stringliteral">"pixel_size_z := %g [mm]\n"</span>, image-><a class="code" href="structIMG.html#afc2a1d2417a8a3afe2c500173a05c472">sizez</a>); <a name="l00447"></a>00447 fprintf(stdout, <span class="stringliteral">"dimension_x := %d\n"</span>, image-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>); <a name="l00448"></a>00448 fprintf(stdout, <span class="stringliteral">"dimension_y := %d\n"</span>, image-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>); <a name="l00449"></a>00449 fprintf(stdout, <span class="stringliteral">"dimension_z := %d\n"</span>, image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>); <a name="l00450"></a>00450 fprintf(stdout, <span class="stringliteral">"dimension_t := %d\n"</span>, image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>); <a name="l00451"></a>00451 <span class="comment">/* Polar map */</span> <a name="l00452"></a>00452 fprintf(stdout, <span class="stringliteral">"polarmap_num_rings := %d\n"</span>, image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>); <a name="l00453"></a>00453 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>>0) { <a name="l00454"></a>00454 fprintf(stdout, <span class="stringliteral">"polarmap_sectors_per_ring :="</span>); <a name="l00455"></a>00455 <span class="keywordflow">for</span>(i=0; i<image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>; i++) <a name="l00456"></a>00456 fprintf(stdout, <span class="stringliteral">" %d"</span>, image-><a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[i]); <a name="l00457"></a>00457 fprintf(stdout, <span class="stringliteral">"\n"</span>); <a name="l00458"></a>00458 fprintf(stdout, <span class="stringliteral">"polarmap_ring_position :="</span>); <a name="l00459"></a>00459 <span class="keywordflow">for</span>(i=0; i<image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>; i++) <a name="l00460"></a>00460 fprintf(stdout, <span class="stringliteral">" %g"</span>, image-><a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[i]); <a name="l00461"></a>00461 fprintf(stdout, <span class="stringliteral">"\n"</span>); <a name="l00462"></a>00462 fprintf(stdout, <span class="stringliteral">"polarmap_ring_angle :="</span>); <a name="l00463"></a>00463 <span class="keywordflow">for</span>(i=0; i<image-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>; i++) <a name="l00464"></a>00464 fprintf(stdout, <span class="stringliteral">" %d"</span>, image-><a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[i]); <a name="l00465"></a>00465 fprintf(stdout, <span class="stringliteral">"\n"</span>); <a name="l00466"></a>00466 fprintf(stdout, <span class="stringliteral">"polarmap_start_angle := %d\n"</span>, image-><a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>); <a name="l00467"></a>00467 } <a name="l00468"></a>00468 <span class="comment">/* Check if the rest is available */</span> <a name="l00469"></a>00469 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>==<a class="code" href="img_8h.html#a7aeab2fb426b858c78ec515aaa8f0a67">IMG_STATUS_INITIALIZED</a>) <span class="keywordflow">return</span>; <a name="l00470"></a>00470 <a name="l00471"></a>00471 fprintf(stdout, <span class="stringliteral">"actual_plane_numbers := %d"</span>, image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[0]); <a name="l00472"></a>00472 <span class="keywordflow">for</span>(i=1; i<image-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>; i++) fprintf(stdout, <span class="stringliteral">" %d"</span>, image-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[i]); <a name="l00473"></a>00473 fprintf(stdout, <span class="stringliteral">"\n"</span>); <a name="l00474"></a>00474 fprintf(stdout, <span class="stringliteral">"Frame times (sec):\n"</span>); <a name="l00475"></a>00475 <span class="keywordflow">for</span>(i=0; i<image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>; i++) fprintf(stdout, <span class="stringliteral">" %e %e %e\n"</span>, <a name="l00476"></a>00476 image-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[i], image-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[i], image-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[i]); <a name="l00477"></a>00477 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#af8f6b963a69d82f9b62a0fcfde538fdf">isWeight</a>) fprintf(stdout, <span class="stringliteral">"Frames are weighted.\n"</span>); <a name="l00478"></a>00478 <span class="keywordflow">else</span> fprintf(stdout, <span class="stringliteral">"Frames are not weighted.\n"</span>); <a name="l00479"></a>00479 <span class="keywordflow">if</span>(image-><a class="code" href="structIMG.html#a6ce801dea67ec8224e8cfc9aebb8a909">decayCorrected</a>==1) { <a name="l00480"></a>00480 fprintf(stdout, <span class="stringliteral">"Decay correction factors for each frame:\n"</span>); <a name="l00481"></a>00481 <span class="keywordflow">for</span>(i=0; i<image-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>; i++) <a name="l00482"></a>00482 fprintf(stdout, <span class="stringliteral">"%03i %e\n"</span>, i+1, image-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[i]); <a name="l00483"></a>00483 } <span class="keywordflow">else</span> <a name="l00484"></a>00484 fprintf(stdout, <span class="stringliteral">"Image is not decay corrected.\n"</span>); <a name="l00485"></a>00485 <span class="keywordflow">return</span>; <a name="l00486"></a>00486 } <a name="l00487"></a>00487 <span class="comment">/*****************************************************************************/</span> <a name="l00488"></a>00488 <a name="l00489"></a>00489 <span class="comment">/*****************************************************************************/</span> <a name="l00501"></a><a class="code" href="img_8h.html#abdf374e8364a31f792daa2b0690ba198">00501</a> <span class="keywordtype">int</span> <a class="code" href="img_8c.html#abdf374e8364a31f792daa2b0690ba198">imgCopyhdr</a>(<a class="code" href="structIMG.html">IMG</a> *image1, <a class="code" href="structIMG.html">IMG</a> *image2) { <a name="l00502"></a>00502 <span class="keywordtype">int</span> i; <a name="l00503"></a>00503 <a name="l00504"></a>00504 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) printf(<span class="stringliteral">"imgCopyhdr()\n"</span>); <a name="l00505"></a>00505 <span class="comment">/* check */</span> <a name="l00506"></a>00506 <span class="keywordflow">if</span>(image1==NULL || image2==NULL) <span class="keywordflow">return</span>(1); <a name="l00507"></a>00507 <span class="keywordflow">if</span>(image1==image2) <span class="keywordflow">return</span>(2); <a name="l00508"></a>00508 <span class="comment">/* copy */</span> <a name="l00509"></a>00509 image2-><a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>=image1-><a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>; <a name="l00510"></a>00510 image2-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=image1-><a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>; <a name="l00511"></a>00511 strcpy(image2-><a class="code" href="structIMG.html#ad76f79021c93175ec98839613ba4dcd2">studyNr</a>, image1-><a class="code" href="structIMG.html#ad76f79021c93175ec98839613ba4dcd2">studyNr</a>); <a name="l00512"></a>00512 strcpy(image2-><a class="code" href="structIMG.html#a29013e391052918bd5aa6974eeec811d">patientName</a>, image1-><a class="code" href="structIMG.html#a29013e391052918bd5aa6974eeec811d">patientName</a>); <a name="l00513"></a>00513 strcpy(image2-><a class="code" href="structIMG.html#a7dc9c21dbaf6b609a32e54c708e089c1">patientID</a>, image1-><a class="code" href="structIMG.html#a7dc9c21dbaf6b609a32e54c708e089c1">patientID</a>); <a name="l00514"></a>00514 strcpy(image2-><a class="code" href="structIMG.html#a7743f4bab187593657c7bd4b7e99fe32">userProcessCode</a>, image1-><a class="code" href="structIMG.html#a7743f4bab187593657c7bd4b7e99fe32">userProcessCode</a>); <a name="l00515"></a>00515 strcpy(image2-><a class="code" href="structIMG.html#a3651200fbb19796a635502a7b7d2c2c3">studyDescription</a>, image1-><a class="code" href="structIMG.html#a3651200fbb19796a635502a7b7d2c2c3">studyDescription</a>); <a name="l00516"></a>00516 image2-><a class="code" href="structIMG.html#ab23da0c2295967727c6d33d0fbdc8c88">zoom</a>=image1-><a class="code" href="structIMG.html#ab23da0c2295967727c6d33d0fbdc8c88">zoom</a>; <a name="l00517"></a>00517 strcpy(image2-><a class="code" href="structIMG.html#ab8bcc846c896a26e5aac045b118fd5cf">radiopharmaceutical</a>, image1-><a class="code" href="structIMG.html#ab8bcc846c896a26e5aac045b118fd5cf">radiopharmaceutical</a>); <a name="l00518"></a>00518 image2-><a class="code" href="structIMG.html#ac9c048a9dc8205b22518b05486d8030b">isotopeHalflife</a>=image1-><a class="code" href="structIMG.html#ac9c048a9dc8205b22518b05486d8030b">isotopeHalflife</a>; <a name="l00519"></a>00519 image2-><a class="code" href="structIMG.html#a6ce801dea67ec8224e8cfc9aebb8a909">decayCorrected</a>=image1-><a class="code" href="structIMG.html#a6ce801dea67ec8224e8cfc9aebb8a909">decayCorrected</a>; <a name="l00520"></a>00520 image2-><a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>=image1-><a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>; <a name="l00521"></a>00521 image2-><a class="code" href="structIMG.html#af1d9f4bd7d58988eb4aa9f660a244a64">axialFOV</a>=image1-><a class="code" href="structIMG.html#af1d9f4bd7d58988eb4aa9f660a244a64">axialFOV</a>; <a name="l00522"></a>00522 image2-><a class="code" href="structIMG.html#a4a03c16266c7e7dcd6858aca05e7599f">transaxialFOV</a>=image1-><a class="code" href="structIMG.html#a4a03c16266c7e7dcd6858aca05e7599f">transaxialFOV</a>; <a name="l00523"></a>00523 image2-><a class="code" href="structIMG.html#a399dae5b27dda8d5e1b0e96c885513e4">sampleDistance</a>=image1-><a class="code" href="structIMG.html#a399dae5b27dda8d5e1b0e96c885513e4">sampleDistance</a>; <a name="l00524"></a>00524 image2-><a class="code" href="structIMG.html#a02cc239e917e7ebf85e34f21448ff080">sizex</a>=image1-><a class="code" href="structIMG.html#a02cc239e917e7ebf85e34f21448ff080">sizex</a>; <a name="l00525"></a>00525 image2-><a class="code" href="structIMG.html#a80b0609c63f33934bf6e6678c6121cb3">sizey</a>=image1-><a class="code" href="structIMG.html#a80b0609c63f33934bf6e6678c6121cb3">sizey</a>; <a name="l00526"></a>00526 image2-><a class="code" href="structIMG.html#afc2a1d2417a8a3afe2c500173a05c472">sizez</a>=image1-><a class="code" href="structIMG.html#afc2a1d2417a8a3afe2c500173a05c472">sizez</a>; <a name="l00527"></a>00527 image2-><a class="code" href="structIMG.html#a3fcbe533eed30e6a68f190c4d7e1d575">gapx</a>=image1-><a class="code" href="structIMG.html#a3fcbe533eed30e6a68f190c4d7e1d575">gapx</a>; <a name="l00528"></a>00528 image2-><a class="code" href="structIMG.html#ae3dafc8f2d8b2f8ab3cd9b21660f5f81">gapy</a>=image1-><a class="code" href="structIMG.html#ae3dafc8f2d8b2f8ab3cd9b21660f5f81">gapy</a>; <a name="l00529"></a>00529 image2-><a class="code" href="structIMG.html#aea74d83981ef722603ebd18fcce9b736">gapz</a>=image1-><a class="code" href="structIMG.html#aea74d83981ef722603ebd18fcce9b736">gapz</a>; <a name="l00530"></a>00530 image2-><a class="code" href="structIMG.html#a0e4475f6d2bd9da2f4e35e4eb142ff71">resolutionx</a>=image1-><a class="code" href="structIMG.html#a0e4475f6d2bd9da2f4e35e4eb142ff71">resolutionx</a>; <a name="l00531"></a>00531 image2-><a class="code" href="structIMG.html#a2fa9952c5c950ea93ec64eb8588f7088">resolutiony</a>=image1-><a class="code" href="structIMG.html#a2fa9952c5c950ea93ec64eb8588f7088">resolutiony</a>; <a name="l00532"></a>00532 image2-><a class="code" href="structIMG.html#afe2b3d97e63341cbb408ee64aa20202e">resolutionz</a>=image1-><a class="code" href="structIMG.html#afe2b3d97e63341cbb408ee64aa20202e">resolutionz</a>; <a name="l00533"></a>00533 image2-><a class="code" href="structIMG.html#a780bf2ffdee9e977a3a51febb7696701">_dataType</a>=image1-><a class="code" href="structIMG.html#a780bf2ffdee9e977a3a51febb7696701">_dataType</a>; <a name="l00534"></a>00534 image2-><a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=image1-><a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>; <a name="l00535"></a>00535 image2-><a class="code" href="structIMG.html#aa25ed90a08d249bc43b076a3c5a30544">orientation</a>=image1-><a class="code" href="structIMG.html#aa25ed90a08d249bc43b076a3c5a30544">orientation</a>; <a name="l00536"></a>00536 image2-><a class="code" href="structIMG.html#a7f83c746c35583a9fa323b94d7ea5fb5">scanner</a>=image1-><a class="code" href="structIMG.html#a7f83c746c35583a9fa323b94d7ea5fb5">scanner</a>; <a name="l00537"></a>00537 image2-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>=image1-><a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>; <a name="l00538"></a>00538 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="img_8h.html#acaea665ceb89d40b45e9987366334bb8">MAX_POLARMAP_NUM_RINGS</a>; i++) { <a name="l00539"></a>00539 image2-><a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[i]=image1-><a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[i]; <a name="l00540"></a>00540 image2-><a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[i]=image1-><a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[i]; <a name="l00541"></a>00541 image2-><a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[i]=image1-><a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[i]; <a name="l00542"></a>00542 } <a name="l00543"></a>00543 image2-><a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>=image1-><a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>; <a name="l00544"></a>00544 <span class="keywordflow">if</span>(image1-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>==image2-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>) <span class="keywordflow">for</span>(i=0; i<image1-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>; i++) <a name="l00545"></a>00545 image2-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[i]=image1-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[i]; <a name="l00546"></a>00546 <span class="keywordflow">if</span>(image1-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>==image2-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>) <span class="keywordflow">for</span>(i=0; i<image1-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>; i++) { <a name="l00547"></a>00547 image2-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[i]=image1-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[i]; image2-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[i]=image1-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[i]; <a name="l00548"></a>00548 image2-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[i]=image1-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[i]; <a name="l00549"></a>00549 image2-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>[i]=image1-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>[i]; image2-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>[i]=image1-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>[i]; <a name="l00550"></a>00550 image2-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>[i]=image1-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>[i]; <a name="l00551"></a>00551 image2-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>[i]=image1-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>[i]; <a name="l00552"></a>00552 image2-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[i]=image1-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[i]; <a name="l00553"></a>00553 } <a name="l00554"></a>00554 image2-><a class="code" href="structIMG.html#af8f6b963a69d82f9b62a0fcfde538fdf">isWeight</a>=image1-><a class="code" href="structIMG.html#af8f6b963a69d82f9b62a0fcfde538fdf">isWeight</a>; <a name="l00555"></a>00555 <span class="keywordflow">return</span>(0); <a name="l00556"></a>00556 } <a name="l00557"></a>00557 <span class="comment">/*****************************************************************************/</span> <a name="l00558"></a>00558 <a name="l00559"></a>00559 <span class="comment">/*****************************************************************************/</span> <a name="l00570"></a><a class="code" href="img_8h.html#a597530352352f006345d5f296b59e8da">00570</a> <span class="keywordtype">int</span> <a class="code" href="img_8c.html#a597530352352f006345d5f296b59e8da">imgExtractRange</a>(<a class="code" href="structIMG.html">IMG</a> *img1, <a class="code" href="structIMG__RANGE.html">IMG_RANGE</a> r, <a class="code" href="structIMG.html">IMG</a> *img2) { <a name="l00571"></a>00571 <span class="keywordtype">int</span> zi, yi, xi, fi, zj, yj, xj, fj; <a name="l00572"></a>00572 <a name="l00573"></a>00573 <span class="keywordflow">if</span>(<a class="code" href="img_8h.html#a0d66ed136e5992b7b00ce6f43bad1439">IMG_TEST</a>) { <a name="l00574"></a>00574 printf(<span class="stringliteral">"imgExtractRange(*img1, r, *img2)\n"</span>); <a name="l00575"></a>00575 printf(<span class="stringliteral">" z=[%d,%d] y=[%d,%d] x=[%d,%d] f=[%d,%d]\n"</span>, <a name="l00576"></a>00576 r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a>, r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>, r.<a class="code" href="structIMG__RANGE.html#a7cc08adedcbec28dc8a03245e4d655c4">y1</a>, r.<a class="code" href="structIMG__RANGE.html#af63dbb1a6428cb10ce273684eca6526d">y2</a>, r.<a class="code" href="structIMG__RANGE.html#a73fecb259b7aeadbb4aac6c01da86c95">x1</a>, r.<a class="code" href="structIMG__RANGE.html#a0d9a33e764138bbac831677d9e34d297">x2</a>, r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a>, r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>); <a name="l00577"></a>00577 } <a name="l00578"></a>00578 <span class="comment">/* Check arguments */</span> <a name="l00579"></a>00579 <span class="keywordflow">if</span>(img2==NULL) <span class="keywordflow">return</span>(1); <span class="keywordflow">else</span> <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(img2, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55baf8f3d89c25483639f6cbce4f6b08c1f8">STATUS_FAULT</a>); <a name="l00580"></a>00580 <span class="keywordflow">if</span>(img1-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>!=<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>) <span class="keywordflow">return</span>(1); <a name="l00581"></a>00581 <span class="keywordflow">if</span>(img2-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>==<a class="code" href="img_8h.html#aaa022c5022b37f3676f2e888f024f848">IMG_STATUS_UNINITIALIZED</a>) <span class="keywordflow">return</span>(1); <a name="l00582"></a>00582 <span class="keywordflow">if</span>(r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a><1 || r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>>img1-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a> || r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a>>r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>) <span class="keywordflow">return</span>(1); <a name="l00583"></a>00583 <span class="keywordflow">if</span>(r.<a class="code" href="structIMG__RANGE.html#a7cc08adedcbec28dc8a03245e4d655c4">y1</a><1 || r.<a class="code" href="structIMG__RANGE.html#af63dbb1a6428cb10ce273684eca6526d">y2</a>>img1-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a> || r.<a class="code" href="structIMG__RANGE.html#a7cc08adedcbec28dc8a03245e4d655c4">y1</a>>r.<a class="code" href="structIMG__RANGE.html#af63dbb1a6428cb10ce273684eca6526d">y2</a>) <span class="keywordflow">return</span>(1); <a name="l00584"></a>00584 <span class="keywordflow">if</span>(r.<a class="code" href="structIMG__RANGE.html#a73fecb259b7aeadbb4aac6c01da86c95">x1</a><1 || r.<a class="code" href="structIMG__RANGE.html#a0d9a33e764138bbac831677d9e34d297">x2</a>>img1-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a> || r.<a class="code" href="structIMG__RANGE.html#a73fecb259b7aeadbb4aac6c01da86c95">x1</a>>r.<a class="code" href="structIMG__RANGE.html#a0d9a33e764138bbac831677d9e34d297">x2</a>) <span class="keywordflow">return</span>(1); <a name="l00585"></a>00585 <span class="keywordflow">if</span>(r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a><1 || r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>>img1-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a> || r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a>>r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>) <span class="keywordflow">return</span>(1); <a name="l00586"></a>00586 <a name="l00587"></a>00587 <span class="comment">/* Allocate memory unless the same size was previously allocated */</span> <a name="l00588"></a>00588 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(img2, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55bafbe470f6663c748e405bf509d2bb57bb">STATUS_NOMEMORY</a>); <a name="l00589"></a>00589 zi=r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>-r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a>+1; yi=r.<a class="code" href="structIMG__RANGE.html#af63dbb1a6428cb10ce273684eca6526d">y2</a>-r.<a class="code" href="structIMG__RANGE.html#a7cc08adedcbec28dc8a03245e4d655c4">y1</a>+1; xi=r.<a class="code" href="structIMG__RANGE.html#a0d9a33e764138bbac831677d9e34d297">x2</a>-r.<a class="code" href="structIMG__RANGE.html#a73fecb259b7aeadbb4aac6c01da86c95">x1</a>+1; fi=r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>-r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a>+1; <a name="l00590"></a>00590 <span class="keywordflow">if</span>(img2-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>>=<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>) <a name="l00591"></a>00591 <span class="keywordflow">if</span>(img2-><a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>!=zi || img2-><a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>!=yi || img2-><a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>!=xi || img2-><a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>!=fi) <a name="l00592"></a>00592 <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(img2); <a name="l00593"></a>00593 <span class="keywordflow">if</span>(img2-><a class="code" href="structIMG.html#a5b8bdc61088df4a3c3f89c31895b14a4">status</a>!=<a class="code" href="img_8h.html#a3117b1b0649d3761dcda1395202129e5">IMG_STATUS_OCCUPIED</a>) { <a name="l00594"></a>00594 <span class="keywordflow">if</span>(<a class="code" href="img_8c.html#a9b2670da9c7685e6d53058cdf1db1199">imgAllocate</a>(img2, zi, yi, xi, fi)!=0) <span class="keywordflow">return</span>(2); <a name="l00595"></a>00595 } <a name="l00596"></a>00596 <a name="l00597"></a>00597 <span class="comment">/* Copy data */</span> <a name="l00598"></a>00598 <a class="code" href="img_8c.html#abdf374e8364a31f792daa2b0690ba198">imgCopyhdr</a>(img1, img2); <a name="l00599"></a>00599 <span class="keywordflow">for</span>(fi=r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a>-1, fj=0; fi<r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>; fi++, fj++) { <a name="l00600"></a>00600 img2-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fj]=img1-><a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]; <a name="l00601"></a>00601 img2-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fj]=img1-><a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi]; <a name="l00602"></a>00602 img2-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[fj]=img1-><a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[fi]; <a name="l00603"></a>00603 img2-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>[fj]=img1-><a class="code" href="structIMG.html#a83a19ce550f5d6573db00265d79d9fc4">weight</a>[fi]; <a name="l00604"></a>00604 img2-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>[fj]=img1-><a class="code" href="structIMG.html#a20dddb0372fb5fd5f379faa0538706af">sd</a>[fi]; <a name="l00605"></a>00605 img2-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>[fj]=img1-><a class="code" href="structIMG.html#a76d63a001b8569d9f80ccb325e064be1">prompts</a>[fi]; <a name="l00606"></a>00606 img2-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>[fj]=img1-><a class="code" href="structIMG.html#ae47ebbbdc0c308f473fec801a2df513d">randoms</a>[fi]; <a name="l00607"></a>00607 img2-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[fj]=img1-><a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[fi]; <a name="l00608"></a>00608 } <a name="l00609"></a>00609 <span class="keywordflow">for</span>(zi=r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a>-1, zj=0; zi<r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>; zi++, zj++) <a name="l00610"></a>00610 img2-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[zj]=img1-><a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[zi]; <a name="l00611"></a>00611 <span class="keywordflow">for</span>(zi=r.<a class="code" href="structIMG__RANGE.html#a64c660b68b023bfd931b3b43027c110c">z1</a>-1, zj=0; zi<r.<a class="code" href="structIMG__RANGE.html#af1068f0266e222348fd9329160ad648a">z2</a>; zi++, zj++) <a name="l00612"></a>00612 <span class="keywordflow">for</span>(yi=r.<a class="code" href="structIMG__RANGE.html#a7cc08adedcbec28dc8a03245e4d655c4">y1</a>-1, yj=0; yi<r.<a class="code" href="structIMG__RANGE.html#af63dbb1a6428cb10ce273684eca6526d">y2</a>; yi++, yj++) <a name="l00613"></a>00613 <span class="keywordflow">for</span>(xi=r.<a class="code" href="structIMG__RANGE.html#a73fecb259b7aeadbb4aac6c01da86c95">x1</a>-1, xj=0; xi<r.<a class="code" href="structIMG__RANGE.html#a0d9a33e764138bbac831677d9e34d297">x2</a>; xi++, xj++) <a name="l00614"></a>00614 <span class="keywordflow">for</span>(fi=r.<a class="code" href="structIMG__RANGE.html#ab41b23c5a700fa4a2236238180b32dc1">f1</a>-1, fj=0; fi<r.<a class="code" href="structIMG__RANGE.html#a0080b25abc77d208f06deaefa6dc0f8e">f2</a>; fi++, fj++) <a name="l00615"></a>00615 img2-><a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>[zj][yj][xj][fj]=img1-><a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>[zi][yi][xi][fi]; <a name="l00616"></a>00616 <a name="l00617"></a>00617 <a class="code" href="img_8c.html#ad124d2d496934d677156cc8779a1e567">imgSetStatus</a>(img2, <a class="code" href="img_8h.html#a06fc87d81c62e9abb8790b6e5713c55ba7e4a42e3b6dd63708c64cf3db6f69566">STATUS_OK</a>); <a name="l00618"></a>00618 <span class="keywordflow">return</span>(0); <a name="l00619"></a>00619 } <a name="l00620"></a>00620 <span class="comment">/*****************************************************************************/</span> <a name="l00621"></a>00621 <a name="l00622"></a>00622 <span class="comment">/*****************************************************************************/</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Mon Aug 8 2011 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>