Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > ce1f17e7ec5e62f35dbe9f064c5f74d7 > files > 946

libtpcimgio-devel-1.5.10-4.fc15.i686.rpm

<!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>libtpcimgio.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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;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&#160;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">libtpcimgio.c</div>  </div>
</div>
<div class="contents">
<a href="libtpcimgio_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00042"></a>00042 <span class="comment">/*****************************************************************************/</span>
<a name="l00043"></a>00043 
<a name="l00045"></a><a class="code" href="libtpcimgio_8c.html#a6e43beaa714b1bf01ce2271440786e38">00045</a> <span class="preprocessor">#define LIB_NAME &quot;libtpcimgio&quot;</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>
<a name="l00048"></a><a class="code" href="libtpcimgio_8c.html#a4b75e63d1b1c0cfccf7cb67b1bd3473a">00048</a> <span class="preprocessor">#define IMG_IO 1</span>
<a name="l00049"></a><a class="code" href="libtpcimgio_8c.html#aa711c07892c4d12c4cedc049aba6879a">00049</a> <span class="preprocessor"></span><span class="preprocessor">#define POLARMAP_IO 2</span>
<a name="l00050"></a><a class="code" href="libtpcimgio_8c.html#a2c63ae95fe7c6106ae1ec9c283afa486">00050</a> <span class="preprocessor"></span><span class="preprocessor">#define MODULE 3</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 <span class="comment">/*****************************************************************************/</span>
<a name="l00053"></a>00053 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00054"></a>00054 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00056"></a>00056 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00057"></a>00057 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00058"></a>00058 <span class="preprocessor">#include &lt;ctype.h&gt;</span>
<a name="l00059"></a>00059 <span class="comment">/*****************************************************************************/</span>
<a name="l00060"></a>00060 <span class="preprocessor">#include &quot;libtpcmisc.h&quot;</span>
<a name="l00061"></a>00061 <span class="preprocessor">#include &quot;<a class="code" href="imgio_8h.html">include/imgio.h</a>&quot;</span>
<a name="l00062"></a>00062 <span class="comment">/*****************************************************************************/</span>
<a name="l00063"></a>00063 
<a name="l00064"></a><a class="code" href="libtpcimgio_8c.html#ac7129ccaa762fa4c6b07733faa0a16e0">00064</a> <span class="preprocessor">#define MAXVAL 100000;</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="comment">/*****************************************************************************/</span>
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <span class="comment">/* Test function declarations: */</span>
<a name="l00068"></a>00068 <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#ab6d116735b7a9745316016b76c554e33">test_create_img</a>(<a class="code" href="structIMG.html">IMG</a> *img, <span class="keywordtype">int</span> dim_x, <span class="keywordtype">int</span> dim_y, <span class="keywordtype">int</span> dim_z, <span class="keywordtype">int</span> dim_t);
<a name="l00069"></a>00069 <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5b4d1ec2556a3ffaef12dcaaf415a180">test_create_polarmap</a>(<a class="code" href="structIMG.html">IMG</a> *img, <span class="keywordtype">int</span> num_rings, <span class="keywordtype">int</span> *sectors_per_ring, <span class="keywordtype">float</span> *ring_position, <span class="keywordtype">short</span> <span class="keywordtype">int</span> *ring_angle, <span class="keywordtype">short</span> <span class="keywordtype">int</span> start_angle);
<a name="l00070"></a>00070 <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a01a527ea52f46ff680d8cdeeb44b30b6">test_img_io</a>(<a class="code" href="structIMG.html">IMG</a> *img);
<a name="l00071"></a>00071 <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5396e2e228d56b4efb2719be80f23ce1">test_polarmap_io</a>(<a class="code" href="structIMG.html">IMG</a> *img);
<a name="l00072"></a>00072 <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5bacbe3c748e18b113fa41a7ebd4b7f6">test_modules</a>(<a class="code" href="structIMG.html">IMG</a> *img);
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="libtpcimgio_8c.html#ae5ad5cbeccaedc03a48d3c7eaa803e79">print_usage</a>();
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 <span class="comment">/* Verbose mode switch: */</span>
<a name="l00076"></a><a class="code" href="libtpcimgio_8c.html#ab848ce91ba14d3dc5c87d0b42f3a1c0d">00076</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#ab848ce91ba14d3dc5c87d0b42f3a1c0d">VERBOSE</a> = 0;
<a name="l00077"></a>00077 
<a name="l00085"></a><a class="code" href="libtpcimgio_8c.html#a0ddf1224851353fc92bfbff6f499fa97">00085</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[ ]) {
<a name="l00086"></a>00086     <span class="keywordtype">int</span> c;
<a name="l00087"></a>00087     <span class="keywordtype">int</span> errflg=0, functionflag=0, exit_code=0;
<a name="l00088"></a>00088     <span class="keyword">extern</span> <span class="keywordtype">char</span> *optarg;
<a name="l00089"></a>00089     <span class="keyword">extern</span> <span class="keywordtype">int</span> optind, optopt;
<a name="l00090"></a>00090     <a class="code" href="structIMG.html">IMG</a> img, polarmap;
<a name="l00091"></a>00091 
<a name="l00092"></a>00092     <span class="keywordflow">while</span> ((c = getopt(argc, argv, <span class="stringliteral">&quot;vVbBrRhHf:F:&quot;</span>)) != -1) {
<a name="l00093"></a>00093       <span class="keywordflow">switch</span> (c) {
<a name="l00094"></a>00094 
<a name="l00095"></a>00095       <span class="keywordflow">case</span> <span class="charliteral">&#39;V&#39;</span>:
<a name="l00096"></a>00096       <span class="keywordflow">case</span> <span class="charliteral">&#39;v&#39;</span>:
<a name="l00097"></a>00097   <span class="comment">/* Set verbose flag on: */</span>
<a name="l00098"></a>00098   <a class="code" href="libtpcimgio_8c.html#ab848ce91ba14d3dc5c87d0b42f3a1c0d">VERBOSE</a> = 1;
<a name="l00099"></a>00099   <span class="keywordflow">break</span>;
<a name="l00100"></a>00100 
<a name="l00101"></a>00101       <span class="keywordflow">case</span> <span class="charliteral">&#39;B&#39;</span>:
<a name="l00102"></a>00102       <span class="keywordflow">case</span> <span class="charliteral">&#39;b&#39;</span>:
<a name="l00103"></a>00103   <span class="comment">/* Print out the build information: */</span>
<a name="l00104"></a>00104   <a class="code" href="libtpcimgiov_8c.html#a3ee9432f65c33193d153468266bef355">libtpcimgio_print_build</a>(stdout);
<a name="l00105"></a>00105   <span class="keywordflow">return</span>(0);
<a name="l00106"></a>00106 
<a name="l00107"></a>00107       <span class="keywordflow">case</span> <span class="charliteral">&#39;r&#39;</span>:
<a name="l00108"></a>00108   <span class="comment">/* Print out the Readme message: */</span>
<a name="l00109"></a>00109   <a class="code" href="libtpcimgiov_8c.html#a4fc496fbea253de8e22f94f9535554de">libtpcimgio_print_readme</a>(stdout);
<a name="l00110"></a>00110   <span class="keywordflow">return</span>(0);
<a name="l00111"></a>00111       <span class="keywordflow">case</span> <span class="charliteral">&#39;R&#39;</span>:
<a name="l00112"></a>00112   <span class="comment">/* Print out the Readme message with Doxygen tags: */</span>
<a name="l00113"></a>00113   <a class="code" href="libtpcimgiov_8c.html#afa515b684fc8ea2485f7975efb18b3b2">libtpcimgio_print_dreadme</a>(stdout);
<a name="l00114"></a>00114   <span class="keywordflow">return</span>(0);
<a name="l00115"></a>00115 
<a name="l00116"></a>00116       <span class="keywordflow">case</span> <span class="charliteral">&#39;h&#39;</span>:
<a name="l00117"></a>00117   <span class="comment">/* Print out the History message: */</span>
<a name="l00118"></a>00118   <a class="code" href="libtpcimgiov_8c.html#a682fd6f66a0e2f8fc42e41aa018de033">libtpcimgio_print_history</a>(stdout);
<a name="l00119"></a>00119   <span class="keywordflow">return</span>(0);
<a name="l00120"></a>00120       <span class="keywordflow">case</span> <span class="charliteral">&#39;H&#39;</span>:
<a name="l00121"></a>00121   <span class="comment">/* Print out the History message with Doxygen tags: */</span>
<a name="l00122"></a>00122   <a class="code" href="libtpcimgiov_8c.html#a5f7ec7f96ae79f904d9a9ee39547d882">libtpcimgio_print_dhistory</a>(stdout);
<a name="l00123"></a>00123   <span class="keywordflow">return</span>(0);
<a name="l00124"></a>00124 
<a name="l00125"></a>00125       <span class="keywordflow">case</span> <span class="charliteral">&#39;f&#39;</span>:
<a name="l00126"></a>00126       <span class="keywordflow">case</span> <span class="charliteral">&#39;F&#39;</span>:
<a name="l00127"></a>00127   <span class="comment">/* Set function serial number to be tested: */</span>
<a name="l00128"></a>00128   functionflag = atoi(optarg);
<a name="l00129"></a>00129   <span class="keywordflow">break</span>;
<a name="l00130"></a>00130 
<a name="l00131"></a>00131       <span class="keywordflow">case</span> <span class="charliteral">&#39;:&#39;</span>: <span class="comment">/* -f or -z without argument */</span>
<a name="l00132"></a>00132   fprintf(stderr,<span class="stringliteral">&quot;Option -%c requires an argument\n&quot;</span>, optopt);
<a name="l00133"></a>00133   errflg++;
<a name="l00134"></a>00134   <span class="keywordflow">break</span>;
<a name="l00135"></a>00135       <span class="keywordflow">case</span> <span class="charliteral">&#39;?&#39;</span>:
<a name="l00136"></a>00136   fprintf(stderr,<span class="stringliteral">&quot;Unrecognised option: -%c\n&quot;</span>, optopt);
<a name="l00137"></a>00137   errflg++;
<a name="l00138"></a>00138       }
<a name="l00139"></a>00139     }<span class="comment">/* End parsing command line options... */</span>
<a name="l00140"></a>00140 
<a name="l00141"></a>00141     <span class="keywordflow">if</span> (errflg) {
<a name="l00142"></a>00142       <a class="code" href="libtpcimgio_8c.html#ae5ad5cbeccaedc03a48d3c7eaa803e79">print_usage</a>();
<a name="l00143"></a>00143       <span class="keywordflow">return</span>(2);
<a name="l00144"></a>00144     }
<a name="l00145"></a>00145 
<a name="l00146"></a>00146     <span class="keywordflow">if</span>(!functionflag){
<a name="l00147"></a>00147       <a class="code" href="libtpcimgio_8c.html#ae5ad5cbeccaedc03a48d3c7eaa803e79">print_usage</a>();
<a name="l00148"></a>00148       <span class="keywordflow">return</span>(0);
<a name="l00149"></a>00149     }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151     <a class="code" href="libtpcimgiov_8c.html#a3ee9432f65c33193d153468266bef355">libtpcimgio_print_build</a>(stdout);
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     <span class="comment">/* Make a test IMG */</span>
<a name="l00154"></a>00154     <a class="code" href="img_8c.html#af95041292a0f9e4a82a10b49a074a95c">imgInit</a>(&amp;img);
<a name="l00155"></a>00155     <span class="keywordflow">if</span>(<a class="code" href="libtpcimgio_8c.html#ab6d116735b7a9745316016b76c554e33">test_create_img</a>(&amp;img, 3, 4, 2, 5)) {
<a name="l00156"></a>00156       printf(<span class="stringliteral">&quot;cannot create test data.\n&quot;</span>);
<a name="l00157"></a>00157       <span class="keywordflow">return</span>(1);
<a name="l00158"></a>00158     }
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 
<a name="l00161"></a>00161     <span class="comment">/* Choose function(s) to test: */</span>
<a name="l00162"></a>00162     <span class="keywordflow">switch</span>(functionflag){
<a name="l00163"></a>00163     <span class="keywordflow">case</span> <a class="code" href="libtpcimgio_8c.html#a4b75e63d1b1c0cfccf7cb67b1bd3473a">IMG_IO</a>:
<a name="l00164"></a>00164       exit_code = <a class="code" href="libtpcimgio_8c.html#a01a527ea52f46ff680d8cdeeb44b30b6">test_img_io</a>(&amp;img);
<a name="l00165"></a>00165       <span class="keywordflow">break</span>;
<a name="l00166"></a>00166     <span class="keywordflow">case</span> <a class="code" href="libtpcimgio_8c.html#aa711c07892c4d12c4cedc049aba6879a">POLARMAP_IO</a>:
<a name="l00167"></a>00167       {
<a name="l00168"></a>00168       <span class="keywordtype">int</span> num_rings=4;
<a name="l00169"></a>00169       <span class="keywordtype">int</span> sectors_per_ring[]={6,6,4,1};
<a name="l00170"></a>00170       <span class="keywordtype">float</span> ring_position[]={0,0.2,0.4,0.6};
<a name="l00171"></a>00171       <span class="keywordtype">short</span> <span class="keywordtype">int</span> ring_angle[]={90,90,45,0};
<a name="l00172"></a>00172       <span class="keywordtype">short</span> <span class="keywordtype">int</span> start_angle=0;
<a name="l00173"></a>00173       <a class="code" href="img_8c.html#af95041292a0f9e4a82a10b49a074a95c">imgInit</a>(&amp;polarmap);
<a name="l00174"></a>00174       <span class="keywordflow">if</span>(<a class="code" href="libtpcimgio_8c.html#a5b4d1ec2556a3ffaef12dcaaf415a180">test_create_polarmap</a>(&amp;polarmap, num_rings, sectors_per_ring, ring_position, ring_angle, start_angle)) {
<a name="l00175"></a>00175         printf(<span class="stringliteral">&quot;cannot create test data.\n&quot;</span>);
<a name="l00176"></a>00176         <span class="keywordflow">return</span>(1);
<a name="l00177"></a>00177       }
<a name="l00178"></a>00178       exit_code = <a class="code" href="libtpcimgio_8c.html#a5396e2e228d56b4efb2719be80f23ce1">test_polarmap_io</a>(&amp;polarmap);
<a name="l00179"></a>00179       }
<a name="l00180"></a>00180       <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;polarmap);
<a name="l00181"></a>00181       <span class="keywordflow">break</span>;
<a name="l00182"></a>00182     <span class="keywordflow">case</span> <a class="code" href="libtpcimgio_8c.html#a2c63ae95fe7c6106ae1ec9c283afa486">MODULE</a>:
<a name="l00183"></a>00183       exit_code = <a class="code" href="libtpcimgio_8c.html#a5bacbe3c748e18b113fa41a7ebd4b7f6">test_modules</a>(&amp;img);
<a name="l00184"></a>00184       <span class="keywordflow">break</span>;
<a name="l00185"></a>00185     <span class="keywordflow">default</span>:
<a name="l00186"></a>00186       fprintf(stdout,<span class="stringliteral">&quot;\n    NO TEST FUNCTION IMPLEMENTATIONS!\n&quot;</span>);
<a name="l00187"></a>00187       <span class="keywordflow">break</span>;
<a name="l00188"></a>00188     }
<a name="l00189"></a>00189     <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img);
<a name="l00190"></a>00190     printf(<span class="stringliteral">&quot;\n exit_code := %d\n&quot;</span>, exit_code);
<a name="l00191"></a>00191     exit(exit_code);
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 <span class="comment">/******************************************************************************/</span>
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 <span class="comment">/******************************************************************************/</span>
<a name="l00206"></a><a class="code" href="libtpcimgio_8c.html#ab6d116735b7a9745316016b76c554e33">00206</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#ab6d116735b7a9745316016b76c554e33">test_create_img</a>(<a class="code" href="structIMG.html">IMG</a> *img, <span class="keywordtype">int</span> dim_x, <span class="keywordtype">int</span> dim_y, <span class="keywordtype">int</span> dim_z, <span class="keywordtype">int</span> dim_t) {
<a name="l00207"></a>00207   <span class="keywordtype">int</span> zi, xi, yi, fi;
<a name="l00208"></a>00208   <span class="keywordtype">float</span> f=-100.0;
<a name="l00209"></a>00209 
<a name="l00210"></a>00210   <span class="keywordflow">if</span>(img==NULL || img-&gt;<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>(1);
<a name="l00211"></a>00211   <span class="keywordflow">if</span>(<a class="code" href="img_8c.html#a9b2670da9c7685e6d53058cdf1db1199">imgAllocate</a>(img, dim_z, dim_y, dim_x, dim_t)){
<a name="l00212"></a>00212     printf(<span class="stringliteral">&quot;    \nError in image allocation: imgAllocate() @ img.c\n&quot;</span>);
<a name="l00213"></a>00213     <span class="keywordflow">return</span>(1);
<a name="l00214"></a>00214   }
<a name="l00215"></a>00215   img-&gt;<a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>=dim_t; img-&gt;<a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>=dim_x; img-&gt;<a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>=dim_y; img-&gt;<a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>=dim_z;
<a name="l00216"></a>00216   <span class="keywordflow">for</span>(zi=0; zi&lt;img-&gt;<a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>; zi++) img-&gt;<a class="code" href="structIMG.html#a78e3164d578cf4a570e930dceb10fb51">planeNumber</a>[zi]=zi+1;
<a name="l00217"></a>00217   img-&gt;<a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a> = <a class="code" href="img_8h.html#ae8b5bb16b84adcbcd2bba3e10a36d62d">IMG_TYPE_IMAGE</a>;
<a name="l00218"></a>00218   <span class="keywordflow">for</span>(fi=0; fi&lt;dim_t; fi++) {
<a name="l00219"></a>00219     <span class="keywordflow">if</span>(fi==0) img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]=0.0; <span class="keywordflow">else</span> img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]=img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi-1];
<a name="l00220"></a>00220     img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi]=(fi+1)*60.0;
<a name="l00221"></a>00221     img-&gt;<a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[fi]=0.5*(img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]+img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi]);
<a name="l00222"></a>00222     img-&gt;<a class="code" href="structIMG.html#abf0ad6e681d08c3248dbd9837afa9973">decayCorrFactor</a>[fi]=1.0;
<a name="l00223"></a>00223   }
<a name="l00224"></a>00224   <span class="keywordflow">for</span>(zi=0; zi&lt;dim_z; zi++) {
<a name="l00225"></a>00225     f+=(float)(1000*zi);
<a name="l00226"></a>00226     <span class="keywordflow">for</span>(yi=0; yi&lt;dim_y; yi++) {
<a name="l00227"></a>00227       f+=(float)(10*yi);
<a name="l00228"></a>00228       <span class="keywordflow">for</span>(xi=0; xi&lt;dim_x; xi++) {
<a name="l00229"></a>00229         f+=(float)(xi);
<a name="l00230"></a>00230         <span class="keywordflow">for</span>(fi=0; fi&lt;dim_t; fi++) {
<a name="l00231"></a>00231           img-&gt;<a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>[zi][yi][xi][fi]=f*(float)(1+fi);
<a name="l00232"></a>00232         }
<a name="l00233"></a>00233       }
<a name="l00234"></a>00234     }
<a name="l00235"></a>00235   }
<a name="l00236"></a>00236   img-&gt;<a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=<a class="code" href="imgunit_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a537d6b7cc5e3a5d0f577d131114b9cef">IMGUNIT_KBQ_PER_ML</a>;
<a name="l00237"></a>00237 
<a name="l00238"></a>00238   <span class="keywordflow">return</span>(0);
<a name="l00239"></a>00239 }
<a name="l00240"></a>00240 <span class="comment">/******************************************************************************/</span>
<a name="l00252"></a><a class="code" href="libtpcimgio_8c.html#a5b4d1ec2556a3ffaef12dcaaf415a180">00252</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5b4d1ec2556a3ffaef12dcaaf415a180">test_create_polarmap</a>(<a class="code" href="structIMG.html">IMG</a> *img, <span class="keywordtype">int</span> num_rings, <span class="keywordtype">int</span> *sectors_per_ring, <span class="keywordtype">float</span> *ring_position,
<a name="l00253"></a>00253        <span class="keywordtype">short</span> <span class="keywordtype">int</span> *ring_angle, <span class="keywordtype">short</span> <span class="keywordtype">int</span> start_angle) {
<a name="l00254"></a>00254   <span class="keywordtype">int</span> si, fi, xi, dim_x, dim_t=1;
<a name="l00255"></a>00255   <span class="keywordtype">float</span> f=1.0;
<a name="l00256"></a>00256 
<a name="l00257"></a>00257   <span class="keywordflow">if</span>(img==NULL || img-&gt;<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>(1);
<a name="l00258"></a>00258   <span class="keywordflow">for</span>(si=dim_x=0; si&lt;num_rings; si++) dim_x+=sectors_per_ring[si];
<a name="l00259"></a>00259   <span class="keywordflow">if</span>(<a class="code" href="img_8c.html#a9b2670da9c7685e6d53058cdf1db1199">imgAllocate</a>(img, 1, 1, dim_x, dim_t)){
<a name="l00260"></a>00260     printf(<span class="stringliteral">&quot;    \nError in image allocation: imgAllocate() @ img.c\n&quot;</span>);
<a name="l00261"></a>00261     <span class="keywordflow">return</span>(1);
<a name="l00262"></a>00262   }
<a name="l00263"></a>00263   img-&gt;<a class="code" href="structIMG.html#a77605d4aa64b86294590c79e9a761b15">dimt</a>=dim_t; img-&gt;<a class="code" href="structIMG.html#a0818b82059710627a94282a793ff7030">dimx</a>=dim_x; img-&gt;<a class="code" href="structIMG.html#aa17e87812503d3c142f31c08abcbf79d">dimy</a>=1; img-&gt;<a class="code" href="structIMG.html#a9c04780b47e6a627a2b700b76352c3fc">dimz</a>=1;
<a name="l00264"></a>00264   img-&gt;<a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a> = <a class="code" href="img_8h.html#a5f0d986b4c5b2b48d37ad25afdd20c77">IMG_TYPE_POLARMAP</a>;
<a name="l00265"></a>00265   <span class="keywordflow">for</span>(fi=0; fi&lt;dim_t; fi++) {
<a name="l00266"></a>00266     <span class="keywordflow">if</span>(fi==0) img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]=0.0; <span class="keywordflow">else</span> img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]=img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi-1];
<a name="l00267"></a>00267     img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi]=(fi+1)*60.0;
<a name="l00268"></a>00268     img-&gt;<a class="code" href="structIMG.html#af7c69142be89fac081e7f8bc354b14c8">mid</a>[fi]=0.5*(img-&gt;<a class="code" href="structIMG.html#a8ff22fc209b6f44ad14341c8644788d2">start</a>[fi]+img-&gt;<a class="code" href="structIMG.html#aa2b629a51ca62bcafad0a66d32e1ca8b">end</a>[fi]);
<a name="l00269"></a>00269   }
<a name="l00270"></a>00270   <span class="keywordflow">for</span>(xi=0; xi&lt;dim_x; xi++) {
<a name="l00271"></a>00271     f+=(float)(xi);
<a name="l00272"></a>00272     <span class="keywordflow">for</span>(fi=0; fi&lt;dim_t; fi++) {
<a name="l00273"></a>00273       img-&gt;<a class="code" href="structIMG.html#a43e2c98dc0728731601a76abd51bb935">m</a>[0][0][xi][fi]=f*(float)(1+fi);
<a name="l00274"></a>00274     }
<a name="l00275"></a>00275   }
<a name="l00276"></a>00276   img-&gt;<a class="code" href="structIMG.html#a53ee896ca7a94425dcf45c51eaf0a1d3">unit</a>=<a class="code" href="imgunit_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a537d6b7cc5e3a5d0f577d131114b9cef">IMGUNIT_KBQ_PER_ML</a>;
<a name="l00277"></a>00277   img-&gt;<a class="code" href="structIMG.html#a07ae2dcb24730f7c5352f09a98967e16">polarmap_num_rings</a>=num_rings;
<a name="l00278"></a>00278   <span class="keywordflow">for</span>(si=0; si&lt;num_rings; si++) {
<a name="l00279"></a>00279     img-&gt;<a class="code" href="structIMG.html#aa0cf526b49d558db6391a6e60864ec88">polarmap_sectors_per_ring</a>[si]=sectors_per_ring[si];
<a name="l00280"></a>00280     img-&gt;<a class="code" href="structIMG.html#afa091c63e52a3e72a674435104f8a164">polarmap_ring_position</a>[si]=ring_position[si];
<a name="l00281"></a>00281     img-&gt;<a class="code" href="structIMG.html#ad343b587b771b99bd2552f31a835cf73">polarmap_ring_angle</a>[si]=ring_angle[si];
<a name="l00282"></a>00282   }
<a name="l00283"></a>00283   img-&gt;<a class="code" href="structIMG.html#a3cb4c538ca5fdcdbbf259adf57208ca5">polarmap_start_angle</a>=start_angle;
<a name="l00284"></a>00284 
<a name="l00285"></a>00285   <span class="keywordflow">return</span>(0);
<a name="l00286"></a>00286 }
<a name="l00287"></a>00287 <span class="comment">/******************************************************************************/</span>
<a name="l00288"></a>00288 
<a name="l00313"></a><a class="code" href="libtpcimgio_8c.html#a01a527ea52f46ff680d8cdeeb44b30b6">00313</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a01a527ea52f46ff680d8cdeeb44b30b6">test_img_io</a>(<a class="code" href="structIMG.html">IMG</a> *img) {
<a name="l00314"></a>00314   <span class="keywordtype">char</span> *fname=<span class="stringliteral">&quot;test_img_io&quot;</span>, temp[FILENAME_MAX];
<a name="l00315"></a>00315   <span class="keywordtype">int</span> ret;
<a name="l00316"></a>00316   <a class="code" href="structIMG.html">IMG</a> img2;
<a name="l00317"></a>00317   <span class="keywordtype">float</span> minvalue = 0.0f;
<a name="l00318"></a>00318   <span class="keywordtype">float</span> maxvalue = 0.0f;
<a name="l00319"></a>00319   <span class="keywordtype">float</span> maxvalue_old = 0.0f;
<a name="l00320"></a>00320   <span class="keywordtype">float</span> maxvalue_abs_old = 0.0f;
<a name="l00321"></a>00321   <span class="keywordtype">float</span> minvalue_old = 0.0f;
<a name="l00322"></a>00322   <span class="keywordtype">float</span> minvalue_frame_old = 0.0f;
<a name="l00323"></a>00323   <span class="keywordtype">float</span> maxvalue_frame_old = 0.0f;
<a name="l00324"></a>00324 
<a name="l00325"></a>00325   printf(<span class="stringliteral">&quot;\n Testing IMG I/O functions\n&quot;</span>);
<a name="l00326"></a>00326   img-&gt;<a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>=<a class="code" href="img_8h.html#ae8b5bb16b84adcbcd2bba3e10a36d62d">IMG_TYPE_IMAGE</a>;
<a name="l00327"></a>00327   <span class="comment">/*IMG_TEST=2;*/</span>
<a name="l00328"></a>00328   <a class="code" href="img_8c.html#af95041292a0f9e4a82a10b49a074a95c">imgInit</a>(&amp;img2);
<a name="l00329"></a>00329   printf(<span class="stringliteral">&quot;\tfname := %s\n&quot;</span>, fname);
<a name="l00330"></a>00330 
<a name="l00331"></a>00331   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#ac6376848cceb07fb6518fa886fd617da">imgMax</a>(img, &amp;maxvalue_old)) <span class="keywordflow">return</span>(110);
<a name="l00332"></a>00332   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a8b30b11486bc0e17aae81bc54e23cc16">imgAbsMax</a>(img, &amp;maxvalue_abs_old)) <span class="keywordflow">return</span>(111);
<a name="l00333"></a>00333   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a97c48d1ed44d81b2d96ce1a139b99009">imgMinMax</a>(img, &amp;minvalue_old, &amp;maxvalue)) <span class="keywordflow">return</span>(112);
<a name="l00334"></a>00334   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a4230e721a2c8767cfebe73d48c0d910d">imgFrameMinMax</a>(img, 1, &amp;minvalue_frame_old, &amp;maxvalue_frame_old)) <span class="keywordflow">return</span>(113);
<a name="l00335"></a>00335 
<a name="l00336"></a>00336   <span class="comment">/* ECAT7 image write and read */</span>
<a name="l00337"></a>00337   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#a12597eb3c08c3aa66f06d4b15294a644">IMG_E7</a>;
<a name="l00338"></a>00338   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(11);
<a name="l00339"></a>00339   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2);
<a name="l00340"></a>00340   <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(12);
<a name="l00341"></a>00341   <span class="keyword">remove</span>(fname); <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00342"></a>00342   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#a3c7938cecd0e773de01ce1cb6dfaf4f3">IMG_E7_2D</a>;
<a name="l00343"></a>00343   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(13);
<a name="l00344"></a>00344   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(14);
<a name="l00345"></a>00345   <span class="keyword">remove</span>(fname); <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00346"></a>00346 
<a name="l00347"></a>00347   <span class="comment">/* ECAT7 image values write and read testing */</span>
<a name="l00348"></a>00348   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#ac6376848cceb07fb6518fa886fd617da">imgMax</a>(img, &amp;maxvalue)) <span class="keywordflow">return</span>(110);
<a name="l00349"></a>00349   <span class="keywordflow">if</span>(maxvalue != maxvalue_old) <span class="keywordflow">return</span>(110);
<a name="l00350"></a>00350   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a8b30b11486bc0e17aae81bc54e23cc16">imgAbsMax</a>(img, &amp;maxvalue)) <span class="keywordflow">return</span>(111);
<a name="l00351"></a>00351   <span class="keywordflow">if</span>(maxvalue != maxvalue_abs_old) <span class="keywordflow">return</span>(111);
<a name="l00352"></a>00352   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a97c48d1ed44d81b2d96ce1a139b99009">imgMinMax</a>(img, &amp;minvalue, &amp;maxvalue)) <span class="keywordflow">return</span>(112);
<a name="l00353"></a>00353   <span class="keywordflow">if</span>(minvalue != minvalue_old) <span class="keywordflow">return</span>(112);
<a name="l00354"></a>00354   <span class="keywordflow">if</span>(<a class="code" href="imgmax_8c.html#a4230e721a2c8767cfebe73d48c0d910d">imgFrameMinMax</a>(img, 1, &amp;minvalue, &amp;maxvalue)) <span class="keywordflow">return</span>(113);
<a name="l00355"></a>00355   <span class="keywordflow">if</span>(minvalue != minvalue_frame_old) <span class="keywordflow">return</span>(113);
<a name="l00356"></a>00356   <span class="keywordflow">if</span>(maxvalue != maxvalue_frame_old) <span class="keywordflow">return</span>(113);
<a name="l00357"></a>00357 
<a name="l00358"></a>00358   <span class="comment">/* ECAT6 image volume write and read */</span>
<a name="l00359"></a>00359   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#a7d502c1293f35b4392badbb9491ee95e">IMG_E63</a>;
<a name="l00360"></a>00360   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(21);
<a name="l00361"></a>00361   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(22);
<a name="l00362"></a>00362   <span class="keyword">remove</span>(fname); <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00363"></a>00363 
<a name="l00364"></a>00364   <span class="comment">/* Analyze image volume write and read */</span>
<a name="l00365"></a>00365   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#a9145a82aa093b7e52a693ec5c38094ef">IMG_ANA</a>; <span class="comment">/*ANALYZE_TEST=IMG_TEST=4;*/</span>
<a name="l00366"></a>00366   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(31);
<a name="l00367"></a>00367   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(32);
<a name="l00368"></a>00368   sprintf(temp, <span class="stringliteral">&quot;%s.hdr&quot;</span>, fname); <span class="keyword">remove</span>(temp);
<a name="l00369"></a>00369   sprintf(temp, <span class="stringliteral">&quot;%s.img&quot;</span>, fname); <span class="keyword">remove</span>(temp);
<a name="l00370"></a>00370   <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00371"></a>00371   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#a38e113a0101e5e683653263ddabe0fc8">IMG_ANA_L</a>;
<a name="l00372"></a>00372   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(33);
<a name="l00373"></a>00373   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(34);
<a name="l00374"></a>00374   sprintf(temp, <span class="stringliteral">&quot;%s.hdr&quot;</span>, fname); <span class="keyword">remove</span>(temp);
<a name="l00375"></a>00375   sprintf(temp, <span class="stringliteral">&quot;%s.img&quot;</span>, fname); <span class="keyword">remove</span>(temp);
<a name="l00376"></a>00376   <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00377"></a>00377   <span class="keywordflow">return</span>(0);
<a name="l00378"></a>00378 }
<a name="l00379"></a>00379 <span class="comment">/******************************************************************************/</span>
<a name="l00380"></a>00380 
<a name="l00387"></a><a class="code" href="libtpcimgio_8c.html#a5396e2e228d56b4efb2719be80f23ce1">00387</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5396e2e228d56b4efb2719be80f23ce1">test_polarmap_io</a>(<a class="code" href="structIMG.html">IMG</a> *img) {
<a name="l00388"></a>00388   <span class="keywordtype">char</span> *fname=<span class="stringliteral">&quot;test_polarmap_io&quot;</span>;
<a name="l00389"></a>00389   <span class="keywordtype">int</span> ret;
<a name="l00390"></a>00390   <a class="code" href="structIMG.html">IMG</a> img2;
<a name="l00391"></a>00391 
<a name="l00392"></a>00392   printf(<span class="stringliteral">&quot;\n Testing POLARMAP IMG I/O functions\n&quot;</span>);
<a name="l00393"></a>00393   img-&gt;<a class="code" href="structIMG.html#a0d9199e1c3c4bd94d56eb30e421b309c">type</a>=<a class="code" href="img_8h.html#a5f0d986b4c5b2b48d37ad25afdd20c77">IMG_TYPE_POLARMAP</a>;
<a name="l00394"></a>00394   <span class="comment">/*IMG_TEST=2;*/</span>
<a name="l00395"></a>00395   <a class="code" href="img_8c.html#af95041292a0f9e4a82a10b49a074a95c">imgInit</a>(&amp;img2);
<a name="l00396"></a>00396   printf(<span class="stringliteral">&quot;\tfname := %s\n&quot;</span>, fname); 
<a name="l00397"></a>00397 
<a name="l00398"></a>00398   <span class="comment">/* ECAT7 image write and read */</span>
<a name="l00399"></a>00399   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a>=<a class="code" href="img_8h.html#aa0111a4761ce5db222757daff1f48dfe">IMG_POLARMAP</a>;
<a name="l00400"></a>00400   ret=<a class="code" href="imgfile_8c.html#ad8d06e4d0a57aa2db0b30488a0ce9543">imgWrite</a>(fname, img); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(11);
<a name="l00401"></a>00401   ret=<a class="code" href="imgfile_8c.html#a25e72562a72da715d4557ed9728ff6e1">imgRead</a>(fname, &amp;img2); <span class="keywordflow">if</span>(ret) <span class="keywordflow">return</span>(12);
<a name="l00402"></a>00402   <span class="keyword">remove</span>(fname); <a class="code" href="img_8c.html#ada573d4b40da77be4455bb9fab9a3033">imgEmpty</a>(&amp;img2);
<a name="l00403"></a>00403 
<a name="l00404"></a>00404   <span class="keywordflow">return</span>(0);
<a name="l00405"></a>00405 }
<a name="l00406"></a>00406 
<a name="l00407"></a>00407 <span class="comment">/******************************************************************************/</span>
<a name="l00408"></a>00408 
<a name="l00415"></a><a class="code" href="libtpcimgio_8c.html#a5bacbe3c748e18b113fa41a7ebd4b7f6">00415</a> <span class="keywordtype">int</span> <a class="code" href="libtpcimgio_8c.html#a5bacbe3c748e18b113fa41a7ebd4b7f6">test_modules</a>(<a class="code" href="structIMG.html">IMG</a> *img) {
<a name="l00416"></a>00416     <span class="keywordtype">char</span> test_str[256] = {0};
<a name="l00417"></a>00417   <span class="keywordtype">int</span> i = 0;
<a name="l00418"></a>00418 <span class="preprocessor">#ifndef __STRICT_ANSI__</span>
<a name="l00419"></a>00419 <span class="preprocessor"></span>        <a class="code" href="structecat7__mainheader.html">ECAT7_mainheader</a> h;
<a name="l00420"></a>00420     <span class="keyword">struct </span>tm *st;
<a name="l00421"></a>00421   time_t lt;
<a name="l00422"></a>00422 <span class="preprocessor">#endif</span>
<a name="l00423"></a>00423 <span class="preprocessor"></span>
<a name="l00424"></a>00424   <span class="comment">/* testing because of change into ANSI */</span>
<a name="l00425"></a>00425 <span class="preprocessor">  #define TEST_WITH_FILENAME(filename,desired_length,error_value) \</span>
<a name="l00426"></a>00426 <span class="preprocessor">  sprintf(test_str,filename); \</span>
<a name="l00427"></a>00427 <span class="preprocessor">  anaRemoveFNameExtension(test_str); \</span>
<a name="l00428"></a>00428 <span class="preprocessor">  i = 0; \</span>
<a name="l00429"></a>00429 <span class="preprocessor">  while(test_str[i] != 0) i++; \</span>
<a name="l00430"></a>00430 <span class="preprocessor">  if(i != desired_length) return(error_value); \</span>
<a name="l00431"></a>00431 <span class="preprocessor">  memset(test_str,0,256); \</span>
<a name="l00432"></a>00432 <span class="preprocessor">  \</span>
<a name="l00433"></a>00433 <span class="preprocessor"></span>
<a name="l00434"></a>00434 <span class="preprocessor"></span>        <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.img&quot;</span>,8,1)
<a name="l00435"></a>00435   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.hdr&quot;</span>,8,2)
<a name="l00436"></a>00436   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.sif&quot;</span>,8,3)
<a name="l00437"></a>00437   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.img.sif&quot;</span>,12,4)
<a name="l00438"></a>00438   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.img.hdr&quot;</span>,12,5)
<a name="l00439"></a>00439   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.dat&quot;</span>,8,6)
<a name="l00440"></a>00440   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename&quot;</span>,8,7)
<a name="l00441"></a>00441         <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.IMG&quot;</span>,8,8)
<a name="l00442"></a>00442   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.HDR&quot;</span>,8,9)
<a name="l00443"></a>00443   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.SIF&quot;</span>,8,10)
<a name="l00444"></a>00444   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.IMG.SIF&quot;</span>,12,11)
<a name="l00445"></a>00445   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.IMG.HDR&quot;</span>,12,12)
<a name="l00446"></a>00446   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.DAT&quot;</span>,8,13)
<a name="l00447"></a>00447   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename&quot;</span>,8,14)
<a name="l00448"></a>00448   <a class="code" href="libtpcimgio_8c.html#ab42f20ec3af13685562ed55fa78ec56f">TEST_WITH_FILENAME</a>(<span class="stringliteral">&quot;filename.&quot;</span>,8,15)
<a name="l00449"></a>00449 
<a name="l00450"></a>00450   <span class="preprocessor">#define TEST_WITH_FORMAT(filename,desired_format,error_value) \</span>
<a name="l00451"></a>00451 <span class="preprocessor">  img-&gt;_fileFormat = IMG_UNKNOWN; \</span>
<a name="l00452"></a>00452 <span class="preprocessor">        sprintf(test_str,filename); \</span>
<a name="l00453"></a>00453 <span class="preprocessor">  imgFormatFromFName(img, test_str); \</span>
<a name="l00454"></a>00454 <span class="preprocessor">  if(img-&gt;_fileFormat != desired_format) return(error_value); \</span>
<a name="l00455"></a>00455 <span class="preprocessor">  memset(test_str,0,256); \</span>
<a name="l00456"></a>00456 <span class="preprocessor">  \</span>
<a name="l00457"></a>00457 <span class="preprocessor"></span>
<a name="l00458"></a>00458 <span class="preprocessor"></span>  <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.img&quot;</span>,<a class="code" href="img_8h.html#a7d502c1293f35b4392badbb9491ee95e">IMG_E63</a>,16)
<a name="l00459"></a>00459   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.scn&quot;</span>,<a class="code" href="img_8h.html#a7d502c1293f35b4392badbb9491ee95e">IMG_E63</a>,17)
<a name="l00460"></a>00460   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.nrm&quot;</span>,<a class="code" href="img_8h.html#a7d502c1293f35b4392badbb9491ee95e">IMG_E63</a>,18)
<a name="l00461"></a>00461   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.atn&quot;</span>,<a class="code" href="img_8h.html#a7d502c1293f35b4392badbb9491ee95e">IMG_E63</a>,19)
<a name="l00462"></a>00462   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.hdr&quot;</span>,<a class="code" href="img_8h.html#a9145a82aa093b7e52a693ec5c38094ef">IMG_ANA</a>,20)
<a name="l00463"></a>00463   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.img.hdr&quot;</span>,<a class="code" href="img_8h.html#a9145a82aa093b7e52a693ec5c38094ef">IMG_ANA</a>,21)
<a name="l00464"></a>00464   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.polmap&quot;</span>,<a class="code" href="img_8h.html#aa0111a4761ce5db222757daff1f48dfe">IMG_POLARMAP</a>,22)
<a name="l00465"></a>00465   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.img.polmap&quot;</span>,<a class="code" href="img_8h.html#aa0111a4761ce5db222757daff1f48dfe">IMG_POLARMAP</a>,23)
<a name="l00466"></a>00466   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename&quot;</span>,<a class="code" href="img_8h.html#a9145a82aa093b7e52a693ec5c38094ef">IMG_ANA</a>,24)
<a name="l00467"></a>00467   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.v&quot;</span>,<a class="code" href="img_8h.html#a12597eb3c08c3aa66f06d4b15294a644">IMG_E7</a>,25)
<a name="l00468"></a>00468   <a class="code" href="libtpcimgio_8c.html#a16df5312f2ac87531396bbd9a04d6391">TEST_WITH_FORMAT</a>(<span class="stringliteral">&quot;filename.dat&quot;</span>,<a class="code" href="img_8h.html#a12597eb3c08c3aa66f06d4b15294a644">IMG_E7</a>,26)
<a name="l00469"></a>00469   img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a> = -1;
<a name="l00470"></a>00470   sprintf(test_str,<span class="stringliteral">&quot;filename.dat&quot;</span>); \
<a name="l00471"></a>00471         <a class="code" href="imgfile_8c.html#abe83b47e7d8d600d579c581b6e7209bd">imgFormatFromFName</a>(img, test_str);
<a name="l00472"></a>00472         <span class="keywordflow">if</span>(img-&gt;<a class="code" href="structIMG.html#a5e25c84c23270f974f1eb7c32a01bac7">_fileFormat</a> != <a class="code" href="img_8h.html#a12597eb3c08c3aa66f06d4b15294a644">IMG_E7</a>) <span class="keywordflow">return</span>(27);
<a name="l00473"></a>00473 
<a name="l00474"></a>00474 <span class="preprocessor">#ifndef __STRICT_ANSI__</span>
<a name="l00475"></a>00475 <span class="preprocessor"></span>  <span class="comment">/* test that time converts properly should be 1.1.1970 00:00:00</span>
<a name="l00476"></a>00476 <span class="comment">   *</span>
<a name="l00477"></a>00477 <span class="comment">   * This test should be run with different timezone settings at</span>
<a name="l00478"></a>00478 <span class="comment">   * operating system</span>
<a name="l00479"></a>00479 <span class="comment">   */</span>
<a name="l00480"></a>00480   h.<a class="code" href="structecat7__mainheader.html#a1ad956ffc4f0dc8e9bd473bfa20e6b81">scan_start_time</a> = 0;
<a name="l00481"></a>00481   <a class="code" href="img__e7_8c.html#a13c42900c44b97ed1b759d7ca6348ab6">imgGetEcat7MHeader</a>(img, &amp;h);
<a name="l00482"></a>00482         lt = (time_t)img-&gt;<a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>;
<a name="l00483"></a>00483         st = localtime(&amp;lt);
<a name="l00484"></a>00484   <span class="keywordflow">if</span>(st-&gt;tm_hour != 0) {
<a name="l00485"></a>00485     printf(<span class="stringliteral">&quot;hour:%d\n&quot;</span>,st-&gt;tm_hour);
<a name="l00486"></a>00486     <span class="keywordflow">return</span>(28);
<a name="l00487"></a>00487   }
<a name="l00488"></a>00488   <span class="comment">/* test that value is 1.2.1999 12:23:35 stays as it was */</span>
<a name="l00489"></a>00489         st-&gt;tm_year = 99;
<a name="l00490"></a>00490   st-&gt;tm_mon = 2;
<a name="l00491"></a>00491   st-&gt;tm_mday = 1;
<a name="l00492"></a>00492   st-&gt;tm_hour = 12;
<a name="l00493"></a>00493   st-&gt;tm_min = 23;
<a name="l00494"></a>00494   st-&gt;tm_sec = 35;
<a name="l00495"></a>00495   lt = mktime(st);
<a name="l00496"></a>00496   h.<a class="code" href="structecat7__mainheader.html#a1ad956ffc4f0dc8e9bd473bfa20e6b81">scan_start_time</a> = lt;
<a name="l00497"></a>00497         <a class="code" href="img__e7_8c.html#a13c42900c44b97ed1b759d7ca6348ab6">imgGetEcat7MHeader</a>(img, &amp;h);
<a name="l00498"></a>00498         lt = (time_t)img-&gt;<a class="code" href="structIMG.html#a5db78f8b423fc42b80bba42e27c7b2c3">scanStart</a>;
<a name="l00499"></a>00499         st = localtime(&amp;lt);
<a name="l00500"></a>00500   <span class="keywordflow">if</span>(st-&gt;tm_year != 99 || st-&gt;tm_mon  !=  2 ||
<a name="l00501"></a>00501      st-&gt;tm_mday !=  1 || st-&gt;tm_hour != 12 ||
<a name="l00502"></a>00502      st-&gt;tm_min  != 23 || st-&gt;tm_sec  != 35) {
<a name="l00503"></a>00503     <span class="keywordflow">return</span>(29);
<a name="l00504"></a>00504   }
<a name="l00505"></a>00505 <span class="preprocessor">#endif</span>
<a name="l00506"></a>00506 <span class="preprocessor"></span>    <span class="keywordflow">return</span> 0;
<a name="l00507"></a>00507 }
<a name="l00508"></a>00508 
<a name="l00509"></a>00509 <span class="comment">/******************************************************************************/</span>
<a name="l00513"></a><a class="code" href="libtpcimgio_8c.html#ae5ad5cbeccaedc03a48d3c7eaa803e79">00513</a> <span class="keywordtype">void</span> <a class="code" href="libtpcimgio_8c.html#ae5ad5cbeccaedc03a48d3c7eaa803e79">print_usage</a>(){
<a name="l00514"></a>00514 
<a name="l00515"></a>00515   <a class="code" href="libtpcimgiov_8c.html#a3ee9432f65c33193d153468266bef355">libtpcimgio_print_build</a>(stdout);
<a name="l00516"></a>00516 
<a name="l00517"></a>00517   puts(<span class="stringliteral">&quot;\n&quot;</span>
<a name="l00518"></a>00518        <span class="stringliteral">&quot;   Methods for testing functions in the library &quot;</span><a class="code" href="libtpcimgio_8c.html#a6e43beaa714b1bf01ce2271440786e38">LIB_NAME</a><span class="stringliteral">&quot;\n&quot;</span>
<a name="l00519"></a>00519        <span class="stringliteral">&quot;   and for printing out associated information, such as Readme,\n&quot;</span>
<a name="l00520"></a>00520        <span class="stringliteral">&quot;   History and build information. \n&quot;</span>
<a name="l00521"></a>00521        <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00522"></a>00522        <span class="stringliteral">&quot;   Usage: &quot;</span><a class="code" href="libtpcimgio_8c.html#a6e43beaa714b1bf01ce2271440786e38">LIB_NAME</a><span class="stringliteral">&quot; [-Options]\n&quot;</span>
<a name="l00523"></a>00523        <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00524"></a>00524        <span class="stringliteral">&quot;   Options:\n&quot;</span>
<a name="l00525"></a>00525        <span class="stringliteral">&quot;   -h | H \n&quot;</span>
<a name="l00526"></a>00526        <span class="stringliteral">&quot;       Print out the &quot;</span><a class="code" href="libtpcimgio_8c.html#a6e43beaa714b1bf01ce2271440786e38">LIB_NAME</a><span class="stringliteral">&quot; History message. Include Doxygen style tags\n&quot;</span>
<a name="l00527"></a>00527        <span class="stringliteral">&quot;       by using option &#39;-H&#39;.\n&quot;</span>
<a name="l00528"></a>00528        <span class="stringliteral">&quot;   -r | R \n&quot;</span>
<a name="l00529"></a>00529        <span class="stringliteral">&quot;       Print out the &quot;</span><a class="code" href="libtpcimgio_8c.html#a6e43beaa714b1bf01ce2271440786e38">LIB_NAME</a><span class="stringliteral">&quot; Readme message. Include Doxygen style tags\n&quot;</span>
<a name="l00530"></a>00530        <span class="stringliteral">&quot;       by using option &#39;-R&#39;.\n&quot;</span>
<a name="l00531"></a>00531        <span class="stringliteral">&quot;   -b\n&quot;</span>);
<a name="l00532"></a>00532   puts(<span class="stringliteral">&quot;       Print out the &quot;</span>LIB_NAME<span class="stringliteral">&quot; build information.\n&quot;</span>
<a name="l00533"></a>00533        <span class="stringliteral">&quot;   -f &lt;function serial number&gt;\n&quot;</span>
<a name="l00534"></a>00534        <span class="stringliteral">&quot;       Runs test procedures for the functions corresponding to given\n&quot;</span>
<a name="l00535"></a>00535        <span class="stringliteral">&quot;       &#39;function serial number&#39;. Serial numbers are defined in file\n&quot;</span>
<a name="l00536"></a>00536        <span class="stringliteral">&quot;       libtpcimgio.c.\n&quot;</span>
<a name="l00537"></a>00537        <span class="stringliteral">&quot;   -v\n&quot;</span>
<a name="l00538"></a>00538        <span class="stringliteral">&quot;       Run in verbose mode.\n&quot;</span>
<a name="l00539"></a>00539        <span class="stringliteral">&quot;\n&quot;</span>
<a name="l00540"></a>00540        <span class="stringliteral">&quot;   E.g.: &quot;</span>LIB_NAME<span class="stringliteral">&quot; -h\n&quot;</span>
<a name="l00541"></a>00541        <span class="stringliteral">&quot;         &quot;</span>LIB_NAME<span class="stringliteral">&quot; -v -f 1 \n&quot;</span>
<a name="l00542"></a>00542        <span class="stringliteral">&quot;         &quot;</span>LIB_NAME<span class="stringliteral">&quot; -v -f ${IMGTRANSFORM} -z 4 \n&quot;</span>
<a name="l00543"></a>00543        <span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00544"></a>00544 
<a name="l00545"></a>00545   fflush(stdout);
<a name="l00546"></a>00546 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Aug 8 2011 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>