Sophie

Sophie

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

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>ecat63p.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">ecat63p.c</div>  </div>
</div>
<div class="contents">
<a href="ecat63p_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) 2003-2008 Turku PET Centre</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">  Library:     ecat63p.c</span>
<a name="l00006"></a>00006 <span class="comment">  Description: Procedures for printing ECAT 6.3 header contents.</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">  2003-07-21 Vesa Oikonen</span>
<a name="l00027"></a>00027 <span class="comment">    Contents separated from ecat63.c.</span>
<a name="l00028"></a>00028 <span class="comment">  2004-02-08 VO</span>
<a name="l00029"></a>00029 <span class="comment">    ecat63PrintMainheader() prints also sw_version.</span>
<a name="l00030"></a>00030 <span class="comment">  2004-09-20 VO</span>
<a name="l00031"></a>00031 <span class="comment">    Doxygen style comments.</span>
<a name="l00032"></a>00032 <span class="comment">  2007-03-12 VO</span>
<a name="l00033"></a>00033 <span class="comment">    Header print functions changed: file pointer is required as second</span>
<a name="l00034"></a>00034 <span class="comment">    argument, set to stdout to make it work as before;</span>
<a name="l00035"></a>00035 <span class="comment">    header contents are now printed one value per line.</span>
<a name="l00036"></a>00036 <span class="comment">  2008-07-24 VO</span>
<a name="l00037"></a>00037 <span class="comment">    Added ecat63PrintSubheader().</span>
<a name="l00038"></a>00038 <span class="comment"></span>
<a name="l00039"></a>00039 <span class="comment"></span>
<a name="l00040"></a>00040 <span class="comment">******************************************************************************/</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;math.h&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &lt;ctype.h&gt;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00048"></a>00048 <span class="comment">/*****************************************************************************/</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &quot;swap.h&quot;</span>
<a name="l00050"></a>00050 <span class="preprocessor">#include &quot;<a class="code" href="ecat63_8h.html">include/ecat63.h</a>&quot;</span>
<a name="l00051"></a>00051 <span class="comment">/*****************************************************************************/</span>
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 <span class="comment">/*****************************************************************************/</span>
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 <span class="comment">/*****************************************************************************/</span>
<a name="l00062"></a><a class="code" href="ecat63_8h.html#a129d5f8c3d6135b9934cebc54d27bc47">00062</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#a129d5f8c3d6135b9934cebc54d27bc47">ecat63PrintMainheader</a>(<a class="code" href="structecat63__mainheader.html">ECAT63_mainheader</a> *h, FILE *fp) {
<a name="l00063"></a>00063   <span class="keywordtype">char</span> tmp[32];
<a name="l00064"></a>00064 
<a name="l00065"></a>00065   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>) fprintf(stdout, <span class="stringliteral">&quot;ecat63PrintMainheader()\n&quot;</span>);
<a name="l00066"></a>00066   fprintf(fp, <span class="stringliteral">&quot;original_file_name := %.20s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a935ae0ef7f06681f8c5be4b271241a71">original_file_name</a>);
<a name="l00067"></a>00067   fprintf(fp, <span class="stringliteral">&quot;data_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a727d6abe8019b32f33965c76ca19a9ee">data_type</a>, <a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(h-&gt;<a class="code" href="structecat63__mainheader.html#a727d6abe8019b32f33965c76ca19a9ee">data_type</a>));
<a name="l00068"></a>00068   fprintf(fp, <span class="stringliteral">&quot;system_type := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a90a0ac55f8a40ddcf53446ee30e2aa7a">system_type</a>);
<a name="l00069"></a>00069   <span class="keywordflow">if</span>(h-&gt;<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==1) strcpy(tmp, <span class="stringliteral">&quot;sinogram&quot;</span>);
<a name="l00070"></a>00070   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(h-&gt;<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==2) strcpy(tmp, <span class="stringliteral">&quot;image&quot;</span>);
<a name="l00071"></a>00071   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(h-&gt;<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==3) strcpy(tmp, <span class="stringliteral">&quot;attenuation&quot;</span>);
<a name="l00072"></a>00072   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(h-&gt;<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==4) strcpy(tmp, <span class="stringliteral">&quot;normalization&quot;</span>);
<a name="l00073"></a>00073   <span class="keywordflow">else</span> strcpy(tmp, <span class="stringliteral">&quot;unknown&quot;</span>);
<a name="l00074"></a>00074   fprintf(fp, <span class="stringliteral">&quot;file_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>, tmp);
<a name="l00075"></a>00075   fprintf(fp, <span class="stringliteral">&quot;sw_version := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a433a5fddd8c83644a9f081001815c6e6">sw_version</a>);
<a name="l00076"></a>00076   fprintf(fp, <span class="stringliteral">&quot;scan start := %02d.%02d.%04d %02d:%02d:%02d\n&quot;</span>,
<a name="l00077"></a>00077     h-&gt;<a class="code" href="structecat63__mainheader.html#a2d2676e349d9446fba65f1185b22b6c9">scan_start_day</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#accef159de133ceecb8712a22b9aaa261">scan_start_month</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#ac50ce9695fe8b410dc42d611a9c3bff7">scan_start_year</a>,
<a name="l00078"></a>00078     h-&gt;<a class="code" href="structecat63__mainheader.html#a1f67ed153d99b8f1e5edf24850312275">scan_start_hour</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#a152db2ee622ee372c1a0691ef9eea5a5">scan_start_minute</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#ae5de61076a9b1bfd13c22bea60c6b933">scan_start_second</a>);
<a name="l00079"></a>00079   fprintf(fp, <span class="stringliteral">&quot;isotope_code := %.8s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ad5e1bd9b72bdc5e5cc820bf25231bef5">isotope_code</a>);
<a name="l00080"></a>00080   fprintf(fp, <span class="stringliteral">&quot;isotope_halflife := %E sec\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#aa80e2c3fda2047135338e9525b48fb17">isotope_halflife</a>);
<a name="l00081"></a>00081   fprintf(fp, <span class="stringliteral">&quot;radiopharmaceutical := %.32s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a51129743a09356f7b83e11fa0865d17d">radiopharmaceutical</a>);
<a name="l00082"></a>00082   fprintf(fp, <span class="stringliteral">&quot;gantry_tilt := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a38e8f748203bf3de942564a0d3aab35a">gantry_tilt</a>);
<a name="l00083"></a>00083   fprintf(fp, <span class="stringliteral">&quot;gantry_rotation := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a32ea34339fa4cc9512ef5b2f7ce46827">gantry_rotation</a>);
<a name="l00084"></a>00084   fprintf(fp, <span class="stringliteral">&quot;bed_elevation := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a6de93fb04de87b775340ee78426e2df2">bed_elevation</a>);
<a name="l00085"></a>00085   fprintf(fp, <span class="stringliteral">&quot;axial_fov := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#acfb971c6cfaffd74900fb23da894bef2">axial_fov</a>);
<a name="l00086"></a>00086   fprintf(fp, <span class="stringliteral">&quot;transaxial_fov := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a3545e9b7344313ca3f5c0e9f817d1fc4">transaxial_fov</a>);
<a name="l00087"></a>00087   fprintf(fp, <span class="stringliteral">&quot;calibration_factor := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ab8dd149fc8b61f8ccd115799e419f7e1">calibration_factor</a>);
<a name="l00088"></a>00088   fprintf(fp, <span class="stringliteral">&quot;calibration_units := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ad8b7b38c78851f5724f8e2095d850271">calibration_units</a>, <a class="code" href="ecat63p_8c.html#a55610f5a3e461ebcd23a9a9496470c56">ecat63Unit</a>(h-&gt;<a class="code" href="structecat63__mainheader.html#ad8b7b38c78851f5724f8e2095d850271">calibration_units</a>));
<a name="l00089"></a>00089   fprintf(fp, <span class="stringliteral">&quot;study_name := %.12s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ae42d92d4f2b85a68511f266f7cddfc8c">study_name</a>);
<a name="l00090"></a>00090   fprintf(fp, <span class="stringliteral">&quot;patient_id := %.32s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ac0ca7836b26f3bcc824110278ecb6508">patient_id</a>);
<a name="l00091"></a>00091   fprintf(fp, <span class="stringliteral">&quot;patient_name := %.32s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a7c66591db9e9dd727d6707ea1051df88">patient_name</a>);
<a name="l00092"></a>00092   fprintf(fp, <span class="stringliteral">&quot;sex := %c\nage := %.10s\nheight := %.10s\nweigth := %.10s\ndexterity := %c\n&quot;</span>,
<a name="l00093"></a>00093     h-&gt;<a class="code" href="structecat63__mainheader.html#a44b07fa3efe28762d2ade58833788168">patient_sex</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#a33db620324b99d80ca7b8b106ef520ba">patient_age</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#ad28e6cdce6b92758d74d22eac1be292b">patient_height</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#a35febd9319d39da8ae89316b99521101">patient_weight</a>,
<a name="l00094"></a>00094     h-&gt;<a class="code" href="structecat63__mainheader.html#aabd34d2a124d86226a292cbfec77e7d8">patient_dexterity</a>);
<a name="l00095"></a>00095   fprintf(fp, <span class="stringliteral">&quot;physician_name := %.32s\noperator_name := %.32s\n&quot;</span>,
<a name="l00096"></a>00096     h-&gt;<a class="code" href="structecat63__mainheader.html#a910f5c488748b19dbb94fa1aec78f705">physician_name</a>, h-&gt;<a class="code" href="structecat63__mainheader.html#abd8730336b30375e6727da5bc96200b7">operator_name</a>);
<a name="l00097"></a>00097   fprintf(fp, <span class="stringliteral">&quot;study_description := %.32s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a6322ecb4779f20b48b19360b605127e7">study_description</a>);
<a name="l00098"></a>00098   fprintf(fp, <span class="stringliteral">&quot;num_planes := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#aec1a2e31ad9fa2e9d03220565bc3cfa0">num_planes</a>);
<a name="l00099"></a>00099   fprintf(fp, <span class="stringliteral">&quot;num_frames := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a01ad1f4be366fb3ad82da61022e9761c">num_frames</a>);
<a name="l00100"></a>00100   fprintf(fp, <span class="stringliteral">&quot;num_gates := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a5038021b6504d93e304931a95af64746">num_gates</a>);
<a name="l00101"></a>00101   fprintf(fp, <span class="stringliteral">&quot;num_bed_pos := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#ad8cbcc286f61bd37eb2a6f196b88a4bb">num_bed_pos</a>);
<a name="l00102"></a>00102   fprintf(fp, <span class="stringliteral">&quot;init_bed_position := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#a918cf8249e510ed1ea646eb2950f8917">init_bed_position</a>);
<a name="l00103"></a>00103   fprintf(fp, <span class="stringliteral">&quot;plane_separation := %g cm\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#afa9b56b592ebcc6a0c8a499c7b74562a">plane_separation</a>);
<a name="l00104"></a>00104   fprintf(fp, <span class="stringliteral">&quot;user_process_code := %.10s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__mainheader.html#aeae1e01c587128f945503d87cb6d3ada">user_process_code</a>);
<a name="l00105"></a>00105 }
<a name="l00106"></a>00106 <span class="comment">/*****************************************************************************/</span>
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="comment">/*****************************************************************************/</span>
<a name="l00115"></a><a class="code" href="ecat63_8h.html#a5f3ba1102f964d98b4de5a93c3d9fd36">00115</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#a5f3ba1102f964d98b4de5a93c3d9fd36">ecat63PrintImageheader</a>(<a class="code" href="structecat63__imageheader.html">ECAT63_imageheader</a> *h, FILE *fp) {
<a name="l00116"></a>00116   <span class="keywordtype">int</span> i;
<a name="l00117"></a>00117 
<a name="l00118"></a>00118   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>) printf(<span class="stringliteral">&quot;ecat63PrintImageheader()\n&quot;</span>);
<a name="l00119"></a>00119   fprintf(fp, <span class="stringliteral">&quot;data_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#a00da8baaaefa0ca83e0c12636b298196">data_type</a>, <a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(h-&gt;<a class="code" href="structecat63__imageheader.html#a00da8baaaefa0ca83e0c12636b298196">data_type</a>));
<a name="l00120"></a>00120   fprintf(fp, <span class="stringliteral">&quot;dimension_1 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#a86aae28e4de4b65fa5de745aab0bf082">dimension_1</a>);
<a name="l00121"></a>00121   fprintf(fp, <span class="stringliteral">&quot;dimension_2 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#ad53dbc60f5f5a34b7327abbf0d609d5d">dimension_2</a>);
<a name="l00122"></a>00122   fprintf(fp, <span class="stringliteral">&quot;x_origin := %g\ny_origin := %g\nrecon_scale := %g\n&quot;</span>,
<a name="l00123"></a>00123     h-&gt;<a class="code" href="structecat63__imageheader.html#a9fea37402b9dfb18edbaba6b2afd3bab">x_origin</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a0ffe63c2a805cb90643870800e01b1ff">y_origin</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a9a0fd8c173273797330c7c67effdffd6">recon_scale</a>);
<a name="l00124"></a>00124   fprintf(fp, <span class="stringliteral">&quot;quant_scale := %g\nimage_min := %d\nimage_max := %d\n&quot;</span>,
<a name="l00125"></a>00125     h-&gt;<a class="code" href="structecat63__imageheader.html#ac4ff92a4d0a9b55e3647bfb45af9d381">quant_scale</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#ad9ae22f6f465f3872ad5dbc66f0a171b">image_min</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a7020d45c4b35dd0c72ce4b87028ed9b9">image_max</a>);
<a name="l00126"></a>00126   fprintf(fp, <span class="stringliteral">&quot;slice_width := %g\npixel_size := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#ac2b4f461866cfcbe8bf33939d461becc">slice_width</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a749a7dfb6443194317be2260fc7b5b7b">pixel_size</a>);
<a name="l00127"></a>00127   fprintf(fp, <span class="stringliteral">&quot;frame_start_time := %d\nframe_duration := %d\n&quot;</span>,
<a name="l00128"></a>00128     h-&gt;<a class="code" href="structecat63__imageheader.html#a14bdbc2c5ce62d9ed0c57514b02f8f0e">frame_start_time</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#ae4fba67f8fb4e7f72f4d74b215b39058">frame_duration</a> );
<a name="l00129"></a>00129   fprintf(fp, <span class="stringliteral">&quot;reconstruction_start := %02d.%02d.%04d %02d:%02d:%02d\n&quot;</span>,
<a name="l00130"></a>00130     h-&gt;<a class="code" href="structecat63__imageheader.html#a0f9df554b4dd1694ae38c207efcec372">recon_start_day</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a88c4c57b18c0350780971f7be380752a">recon_start_month</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#aee97d9526938759b161038f6e8252a75">recon_start_year</a>,
<a name="l00131"></a>00131     h-&gt;<a class="code" href="structecat63__imageheader.html#add9fadfc6afa697b50b6a84e360cf71c">recon_start_hour</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#aefab8b0646f7233d6c7f08a0328a984e">recon_start_min</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#ae69b914674635a9da4c600e78703051e">recon_start_sec</a>);
<a name="l00132"></a>00132   fprintf(fp, <span class="stringliteral">&quot;filter_code := %d\nimage_rotation := %g\nintrinsic_tilt := %g\n&quot;</span>,
<a name="l00133"></a>00133     h-&gt;<a class="code" href="structecat63__imageheader.html#adcb3ed305ba54f4b8a9a741c3d6057d5">filter_code</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a74e01096c6d9daad3aabf5eaa50dd7a1">image_rotation</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#aeb7e92ca7928577171eb2649879f0ea6">intrinsic_tilt</a>);
<a name="l00134"></a>00134   fprintf(fp, <span class="stringliteral">&quot;filter_params :=&quot;</span>);
<a name="l00135"></a>00135   <span class="keywordflow">for</span>(i=0; i&lt;6; i++) fprintf(fp, <span class="stringliteral">&quot; %g&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#af215d79c43ac183c8d871f4cae77719b">filter_params</a>[i]); fprintf(fp, <span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00136"></a>00136   fprintf(fp, <span class="stringliteral">&quot;plane_eff_corr_fctr := %g\ndecay_corr_fctr := %g\nloss_corr_fctr := %g\n&quot;</span>,
<a name="l00137"></a>00137     h-&gt;<a class="code" href="structecat63__imageheader.html#a7c53b9df3c138cf5b9d5b2986d003377">plane_eff_corr_fctr</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a46ec10bffd9ad4bd54271b68022bd41c">decay_corr_fctr</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#ab7fe2e08a8afa0b40c4fb9cf5a434ac1">loss_corr_fctr</a>);
<a name="l00138"></a>00138   fprintf(fp, <span class="stringliteral">&quot;quant_units := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#a38136ac931d35627e8644ccc71d97aec">quant_units</a>, <a class="code" href="ecat63p_8c.html#a55610f5a3e461ebcd23a9a9496470c56">ecat63Unit</a>(h-&gt;<a class="code" href="structecat63__imageheader.html#a38136ac931d35627e8644ccc71d97aec">quant_units</a>));
<a name="l00139"></a>00139   fprintf(fp, <span class="stringliteral">&quot;ecat_calibration_fctr := %g\nwell_counter_cal_fctr := %g\n&quot;</span>,
<a name="l00140"></a>00140     h-&gt;<a class="code" href="structecat63__imageheader.html#aa50b6a76225241de1056e26de450fb1c">ecat_calibration_fctr</a>, h-&gt;<a class="code" href="structecat63__imageheader.html#a6338eb4b7fdcb624ac0673260d16db42">well_counter_cal_fctr</a>);
<a name="l00141"></a>00141   fprintf(fp, <span class="stringliteral">&quot;annotation := %.40s\n&quot;</span>, h-&gt;<a class="code" href="structecat63__imageheader.html#a773755a2de4e065ae28f0d52f6de101d">annotation</a>);
<a name="l00142"></a>00142 }
<a name="l00143"></a>00143 <span class="comment">/*****************************************************************************/</span>
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="comment">/*****************************************************************************/</span>
<a name="l00152"></a><a class="code" href="ecat63_8h.html#a67a369196200471d7954b4788de262a6">00152</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#a67a369196200471d7954b4788de262a6">ecat63PrintScanheader</a>(<a class="code" href="structecat63__scanheader.html">ECAT63_scanheader</a> *h, FILE *fp) {
<a name="l00153"></a>00153   <span class="keywordtype">int</span> i;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>) printf(<span class="stringliteral">&quot;ecat63PrintScanheader()\n&quot;</span>);
<a name="l00156"></a>00156   fprintf(fp, <span class="stringliteral">&quot;data_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#ad1ee12caf8404e9237c9b14d95711109">data_type</a>, <a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(h-&gt;<a class="code" href="structecat63__scanheader.html#ad1ee12caf8404e9237c9b14d95711109">data_type</a>));
<a name="l00157"></a>00157   fprintf(fp, <span class="stringliteral">&quot;dimension_1 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#adee5ad20def49d6f13da7efde9da4e3e">dimension_1</a>);
<a name="l00158"></a>00158   fprintf(fp, <span class="stringliteral">&quot;dimension_2 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#a87c12560397fa7408d95ad30d1800f92">dimension_2</a>);
<a name="l00159"></a>00159   fprintf(fp, <span class="stringliteral">&quot;sample_distance := %g cm\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#acb676ed22b052fbaa07bd044263ac279">sample_distance</a>);
<a name="l00160"></a>00160   fprintf(fp, <span class="stringliteral">&quot;isotope_halflife := %g sec\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#a3310fbd6ef8bb0062d44b8dcb0315726">isotope_halflife</a>);
<a name="l00161"></a>00161   fprintf(fp, <span class="stringliteral">&quot;gate_duration := %d\nr_wave_offset := %d\n&quot;</span>,
<a name="l00162"></a>00162     h-&gt;<a class="code" href="structecat63__scanheader.html#abf1ed74916f2296dbdc73246f0ac7e26">gate_duration</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#a7507738b6d21d0b5145bc66e0baefcd1">r_wave_offset</a>);
<a name="l00163"></a>00163   fprintf(fp, <span class="stringliteral">&quot;scale_factor := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#acfabab41eaa593a0625a43057bd9b558">scale_factor</a>);
<a name="l00164"></a>00164   fprintf(fp, <span class="stringliteral">&quot;scan_min := %d\nscan_max := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#abeeb6fea3c31b83464be7afcdff37219">scan_min</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#a87fc09622afe7e2372588f650e7e6afd">scan_max</a>);
<a name="l00165"></a>00165   fprintf(fp, <span class="stringliteral">&quot;prompts := %d\ndelayed := %d\nmultiples := %d\nnet_trues := %d\n&quot;</span>,
<a name="l00166"></a>00166     h-&gt;<a class="code" href="structecat63__scanheader.html#a28b007d345ada719bb886fd7a2683d76">prompts</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#ad0a2468779aec56e8d45ca685834eb16">delayed</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#a8100b3eed008502c7817e0b629de155e">multiples</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#a8acda07cbdfaba46a41cdb735e6ff222">net_trues</a>);
<a name="l00167"></a>00167   fprintf(fp, <span class="stringliteral">&quot;cor_singles :=&quot;</span>);
<a name="l00168"></a>00168   <span class="keywordflow">for</span>(i=0; i&lt;16; i++) fprintf(fp, <span class="stringliteral">&quot; %8.0f&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#a0620862723c58710a4510ffcb184f4cd">cor_singles</a>[i]); printf(<span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00169"></a>00169   fprintf(fp, <span class="stringliteral">&quot;uncor_singles :=&quot;</span>);
<a name="l00170"></a>00170   <span class="keywordflow">for</span>(i=0; i&lt;16; i++) fprintf(fp, <span class="stringliteral">&quot; %8.0f&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#a1ccfde8610fb4974ce32c3dd6f252480">uncor_singles</a>[i]); printf(<span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00171"></a>00171   fprintf(fp, <span class="stringliteral">&quot;tot_avg_cor := %g\ntot_avg_uncor := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#afcbe607c1cd9a432f6aac5dabc9a77ea">tot_avg_cor</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#af8563b96c975f59dec8ff89fe4ce46b4">tot_avg_uncor</a>);
<a name="l00172"></a>00172   fprintf(fp, <span class="stringliteral">&quot;total_coin_rate := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#ada524bc7b4273bd533cc1a1071fb71f0">total_coin_rate</a>);
<a name="l00173"></a>00173   fprintf(fp, <span class="stringliteral">&quot;frame_start_time := %d\nframe_duration := %d\n&quot;</span>,
<a name="l00174"></a>00174     h-&gt;<a class="code" href="structecat63__scanheader.html#aa7214f91108a9d7a5bec6f0edbe3493d">frame_start_time</a>, h-&gt;<a class="code" href="structecat63__scanheader.html#a253426410960e4047acfb591c24e179b">frame_duration</a>);
<a name="l00175"></a>00175   fprintf(fp, <span class="stringliteral">&quot;loss_correction_fctr := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__scanheader.html#a3077aca1fa9f9b64c57f4b6eb19780fb">loss_correction_fctr</a>);
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 <span class="comment">/*****************************************************************************/</span>
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 <span class="comment">/*****************************************************************************/</span>
<a name="l00186"></a><a class="code" href="ecat63_8h.html#ac13fb1d4ef04db1275a076bef59ee991">00186</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#ac13fb1d4ef04db1275a076bef59ee991">ecat63PrintAttnheader</a>(<a class="code" href="structecat63__attnheader.html">ECAT63_attnheader</a> *h,  FILE *fp) {
<a name="l00187"></a>00187   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>) printf(<span class="stringliteral">&quot;ecat63PrintAttnheader()\n&quot;</span>);
<a name="l00188"></a>00188   fprintf(fp, <span class="stringliteral">&quot;data_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#ac5bea9d6b3dae0b4c87d5e66a0d2006e">data_type</a>, <a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(h-&gt;<a class="code" href="structecat63__attnheader.html#ac5bea9d6b3dae0b4c87d5e66a0d2006e">data_type</a>));
<a name="l00189"></a>00189   fprintf(fp, <span class="stringliteral">&quot;dimension_1 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#acbea9636493630fc7bdc3de4fcd4cfa2">dimension_1</a>);
<a name="l00190"></a>00190   fprintf(fp, <span class="stringliteral">&quot;dimension_2 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#af9fa1e4491aa3321b4ce99f54e5ebb6e">dimension_2</a>);
<a name="l00191"></a>00191   fprintf(fp, <span class="stringliteral">&quot;sample_distance := %g cm\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#a8637550d8495fed5a5f5e59701f8d428">sample_distance</a>);
<a name="l00192"></a>00192   fprintf(fp, <span class="stringliteral">&quot;attenuation_type := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#afddf2ebc3902db6517580be3dfbe8d5e">attenuation_type</a>);
<a name="l00193"></a>00193   fprintf(fp, <span class="stringliteral">&quot;scale_factor := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__attnheader.html#a649891350c3b30214f43ca2d640a0e47">scale_factor</a>);
<a name="l00194"></a>00194   fprintf(fp, <span class="stringliteral">&quot;x_origin := %g\ny_origin := %g\nx_radius := %g\ny_radius := %g\n&quot;</span>,
<a name="l00195"></a>00195     h-&gt;<a class="code" href="structecat63__attnheader.html#a392054bdf86e477fa5cf6da7cca40ce5">x_origin</a>, h-&gt;<a class="code" href="structecat63__attnheader.html#a625b116f6858b728a3a83d9312c914d2">y_origin</a>, h-&gt;<a class="code" href="structecat63__attnheader.html#a525063ffc32765f26d039e3bcba1996c">x_radius</a>, h-&gt;<a class="code" href="structecat63__attnheader.html#ab85f3c502080d57c3b01db2a4ff17096">y_radius</a>);
<a name="l00196"></a>00196   fprintf(fp, <span class="stringliteral">&quot;tilt_angle := %g\nattenuation_coeff := %g\n&quot;</span>,
<a name="l00197"></a>00197     h-&gt;<a class="code" href="structecat63__attnheader.html#a28abaa374db45b1b6be743117cd269eb">tilt_angle</a>, h-&gt;<a class="code" href="structecat63__attnheader.html#a2cb849370c0300e6e88f8668cfae4bce">attenuation_coeff</a>);
<a name="l00198"></a>00198 }
<a name="l00199"></a>00199 <span class="comment">/*****************************************************************************/</span>
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 <span class="comment">/*****************************************************************************/</span>
<a name="l00208"></a><a class="code" href="ecat63_8h.html#a6e83e2fee3eadec5df6cc74d3bb770ef">00208</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#a6e83e2fee3eadec5df6cc74d3bb770ef">ecat63PrintNormheader</a>(<a class="code" href="structecat63__normheader.html">ECAT63_normheader</a> *h, FILE *fp) {
<a name="l00209"></a>00209   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>) printf(<span class="stringliteral">&quot;ecat63PrintNormheader()\n&quot;</span>);
<a name="l00210"></a>00210   fprintf(fp, <span class="stringliteral">&quot;data_type := %d (%s)\n&quot;</span>, h-&gt;<a class="code" href="structecat63__normheader.html#ae7d4136070d36e9edbe684a80e39b942">data_type</a>, <a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(h-&gt;<a class="code" href="structecat63__normheader.html#ae7d4136070d36e9edbe684a80e39b942">data_type</a>));
<a name="l00211"></a>00211   fprintf(fp, <span class="stringliteral">&quot;dimension_1 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__normheader.html#a546d6d89d6df87d2de51c1588884d5b5">dimension_1</a>);
<a name="l00212"></a>00212   fprintf(fp, <span class="stringliteral">&quot;dimension_2 := %d\n&quot;</span>, h-&gt;<a class="code" href="structecat63__normheader.html#aa49aa059f33fad5d960b044da8076fe7">dimension_2</a>);
<a name="l00213"></a>00213   fprintf(fp, <span class="stringliteral">&quot;scale_factor := %g\n&quot;</span>, h-&gt;<a class="code" href="structecat63__normheader.html#a914977ee68c14326a4551abae57fc9ab">scale_factor</a>);
<a name="l00214"></a>00214   fprintf(fp, <span class="stringliteral">&quot;norm time := %02d.%02d.%04d %02d:%02d:%02d\n&quot;</span>,
<a name="l00215"></a>00215     h-&gt;<a class="code" href="structecat63__normheader.html#af2594e900754a91cfd91ae9c0abb4189">norm_day</a>, h-&gt;<a class="code" href="structecat63__normheader.html#a07ca626ae6c4ccebc0259e4938b788a6">norm_month</a>, h-&gt;<a class="code" href="structecat63__normheader.html#a50b35e9ff630f374ff9699073a40f118">norm_year</a>,
<a name="l00216"></a>00216     h-&gt;<a class="code" href="structecat63__normheader.html#a89973101e53a28f7ea189da834d833f5">norm_hour</a>, h-&gt;<a class="code" href="structecat63__normheader.html#aa23c1f37bfc67d61ac6c23ad47e0ef3f">norm_minute</a>, h-&gt;<a class="code" href="structecat63__normheader.html#a3b5598a2aec2cf470d28704984ba8abe">norm_second</a>);
<a name="l00217"></a>00217 }
<a name="l00218"></a>00218 <span class="comment">/*****************************************************************************/</span>
<a name="l00219"></a>00219 
<a name="l00220"></a>00220 <span class="comment">/*****************************************************************************/</span>
<a name="l00227"></a><a class="code" href="ecat63_8h.html#a98732743aed846f22cee299b5588cdac">00227</a> <span class="keywordtype">char</span> *<a class="code" href="ecat63p_8c.html#a98732743aed846f22cee299b5588cdac">ecat63Datatype</a>(<span class="keywordtype">short</span> <span class="keywordtype">int</span> dtype) {
<a name="l00228"></a>00228   <span class="keyword">static</span> <span class="keywordtype">char</span> *ecat63_datatype[]={
<a name="l00229"></a>00229   <span class="comment">/*  0 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>,
<a name="l00230"></a>00230   <span class="comment">/*  1 */</span>  <span class="stringliteral">&quot;BYTE_TYPE&quot;</span>,
<a name="l00231"></a>00231   <span class="comment">/*  2 */</span>  <span class="stringliteral">&quot;VAX_I2&quot;</span>,
<a name="l00232"></a>00232   <span class="comment">/*  3 */</span>  <span class="stringliteral">&quot;VAX_I4&quot;</span>,
<a name="l00233"></a>00233   <span class="comment">/*  4 */</span>  <span class="stringliteral">&quot;VAX_R4&quot;</span>,
<a name="l00234"></a>00234   <span class="comment">/*  5 */</span>  <span class="stringliteral">&quot;IEEE_R4&quot;</span>,
<a name="l00235"></a>00235   <span class="comment">/*  6 */</span>  <span class="stringliteral">&quot;SUN_I2&quot;</span>,
<a name="l00236"></a>00236   <span class="comment">/*  7 */</span>  <span class="stringliteral">&quot;SUN_I4&quot;</span>,
<a name="l00237"></a>00237   <span class="comment">/*  8 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>,
<a name="l00238"></a>00238   <span class="comment">/*  9 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>
<a name="l00239"></a>00239   };
<a name="l00240"></a>00240   <span class="keywordflow">if</span>(dtype&gt;=0 &amp;&amp; dtype&lt;10) <span class="keywordflow">return</span>(ecat63_datatype[dtype]);
<a name="l00241"></a>00241   <span class="keywordflow">else</span> <span class="keywordflow">return</span>(ecat63_datatype[0]);
<a name="l00242"></a>00242 }
<a name="l00243"></a>00243 
<a name="l00250"></a><a class="code" href="ecat63_8h.html#a55610f5a3e461ebcd23a9a9496470c56">00250</a> <span class="keywordtype">char</span> *<a class="code" href="ecat63p_8c.html#a55610f5a3e461ebcd23a9a9496470c56">ecat63Unit</a>(<span class="keywordtype">short</span> <span class="keywordtype">int</span> dunit) {
<a name="l00251"></a>00251   <span class="keyword">static</span> <span class="keywordtype">char</span> *ecat63_unit[]={
<a name="l00252"></a>00252   <span class="comment">/*  0 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>,
<a name="l00253"></a>00253   <span class="comment">/*  1 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>,
<a name="l00254"></a>00254   <span class="comment">/*  2 */</span>  <span class="stringliteral">&quot;ECAT counts&quot;</span>,
<a name="l00255"></a>00255   <span class="comment">/*  3 */</span>  <span class="stringliteral">&quot;uCi/ml&quot;</span>,
<a name="l00256"></a>00256   <span class="comment">/*  4 */</span>  <span class="stringliteral">&quot;LMRGlu&quot;</span>,
<a name="l00257"></a>00257   <span class="comment">/*  5 */</span>  <span class="stringliteral">&quot;LMRUGlu umol/min/100g&quot;</span>,
<a name="l00258"></a>00258   <span class="comment">/*  6 */</span>  <span class="stringliteral">&quot;LMRUGlu mg/min/100g&quot;</span>,
<a name="l00259"></a>00259   <span class="comment">/*  7 */</span>  <span class="stringliteral">&quot;nCi/mL&quot;</span>,
<a name="l00260"></a>00260   <span class="comment">/*  8 */</span>  <span class="stringliteral">&quot;Well counts&quot;</span>,
<a name="l00261"></a>00261   <span class="comment">/*  9 */</span>  <span class="stringliteral">&quot;Becquerels&quot;</span>,
<a name="l00262"></a>00262   <span class="comment">/* 10 */</span>  <span class="stringliteral">&quot;kBq/mL&quot;</span>,
<a name="l00263"></a>00263   <span class="comment">/* 11 */</span>  <span class="stringliteral">&quot;1/min&quot;</span>,
<a name="l00264"></a>00264   <span class="comment">/* 12 */</span>  <span class="stringliteral">&quot;mL/min/100g&quot;</span>,
<a name="l00265"></a>00265   <span class="comment">/* 13 */</span>  <span class="stringliteral">&quot;sec*kBq/mL&quot;</span>,
<a name="l00266"></a>00266   <span class="comment">/* 14 */</span>  <span class="stringliteral">&quot;sec*nCi/mL&quot;</span>,
<a name="l00267"></a>00267   <span class="comment">/* 15 */</span>  <span class="stringliteral">&quot;1/sec&quot;</span>,
<a name="l00268"></a>00268   <span class="comment">/* 16 */</span>  <span class="stringliteral">&quot;Unitless&quot;</span>,
<a name="l00269"></a>00269   <span class="comment">/* 17 */</span>  <span class="stringliteral">&quot;Unknown&quot;</span>
<a name="l00270"></a>00270   };
<a name="l00271"></a>00271   <span class="keywordflow">if</span>(dunit&gt;=0 &amp;&amp; dunit&lt;18) <span class="keywordflow">return</span>(ecat63_unit[dunit]);
<a name="l00272"></a>00272   <span class="keywordflow">else</span> <span class="keywordflow">return</span>(ecat63_unit[0]);
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 <span class="comment">/*****************************************************************************/</span>
<a name="l00282"></a><a class="code" href="ecat63_8h.html#a86dced4c2ed95c8e4a39e89a15d41bc8">00282</a> <span class="keywordtype">void</span> <a class="code" href="ecat63p_8c.html#a86dced4c2ed95c8e4a39e89a15d41bc8">float2parts</a>(<span class="keywordtype">float</span> *buf) {
<a name="l00283"></a>00283   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> u, exp, mantissa;
<a name="l00284"></a>00284   <span class="keywordtype">char</span> sign;
<a name="l00285"></a>00285 
<a name="l00286"></a>00286   memcpy(&amp;u, buf, 4); <span class="keywordflow">if</span>(u &amp; 1L&lt;&lt;31) sign=<span class="charliteral">&#39;-&#39;</span>; <span class="keywordflow">else</span> sign=<span class="charliteral">&#39;+&#39;</span>;
<a name="l00287"></a>00287   exp=u&lt;&lt;1; exp=exp&gt;&gt;24; mantissa=u&lt;&lt;9; mantissa=mantissa&gt;&gt;9;
<a name="l00288"></a>00288   printf(<span class="stringliteral">&quot;%e = %c (%u/8388608 + 1)*2^(%u-127)\n&quot;</span>, *buf, sign, mantissa, exp);
<a name="l00289"></a>00289 }
<a name="l00290"></a>00290 <span class="comment">/*****************************************************************************/</span>
<a name="l00291"></a>00291 
<a name="l00292"></a>00292 <span class="comment">/*****************************************************************************/</span>
<a name="l00296"></a><a class="code" href="ecat63_8h.html#acf1af8815f707d51a8263891fb82b261">00296</a> <span class="keywordtype">int</span> <a class="code" href="ecat63p_8c.html#acf1af8815f707d51a8263891fb82b261">ecat6PrintSubheader</a>(
<a name="l00298"></a>00298   <a class="code" href="structecat63__mainheader.html">ECAT63_mainheader</a> mh,
<a name="l00300"></a>00300   FILE *fp,
<a name="l00302"></a>00302   <span class="keywordtype">int</span> plane,
<a name="l00304"></a>00304   <span class="keywordtype">int</span> frame,
<a name="l00306"></a>00306   FILE *ofp
<a name="l00307"></a>00307 ) {
<a name="l00308"></a>00308   <span class="keywordtype">int</span>                 mi, ret, nr=0;
<a name="l00309"></a>00309   <span class="keyword">static</span> <a class="code" href="structMATRIXLIST.html">MATRIXLIST</a>   mlist;
<a name="l00310"></a>00310   <a class="code" href="structecat63__imageheader.html">ECAT63_imageheader</a>  image_header;
<a name="l00311"></a>00311   <a class="code" href="structecat63__scanheader.html">ECAT63_scanheader</a>   scan_header;
<a name="l00312"></a>00312   <a class="code" href="structecat63__attnheader.html">ECAT63_attnheader</a>   attn_header;
<a name="l00313"></a>00313   <a class="code" href="structecat63__normheader.html">ECAT63_normheader</a>   norm_header;
<a name="l00314"></a>00314   <a class="code" href="structMatval.html">Matval</a>              matval;
<a name="l00315"></a>00315 
<a name="l00316"></a>00316 
<a name="l00317"></a>00317   <span class="comment">/*  Read matrix list and nr */</span>
<a name="l00318"></a>00318   <a class="code" href="ecat63ml_8c.html#a2477fe69c32ce33b443b9c0eaedae423">ecat63InitMatlist</a>(&amp;mlist);
<a name="l00319"></a>00319   ret=<a class="code" href="ecat63ml_8c.html#a6cce9d0e541e82d56c9d162f16202179">ecat63ReadMatlist</a>(fp, &amp;mlist);
<a name="l00320"></a>00320   <span class="keywordflow">if</span>(ret) {
<a name="l00321"></a>00321     fprintf(stderr, <span class="stringliteral">&quot;Error (%d): cannot read matrix list.\n&quot;</span>, ret);
<a name="l00322"></a>00322     <span class="keywordflow">return</span> 2;
<a name="l00323"></a>00323   }
<a name="l00324"></a>00324   <span class="keywordflow">if</span>(mlist.<a class="code" href="structMATRIXLIST.html#a7fcfb983a42851d8562084ddde1f9fcd">matrixNr</a>&lt;=0) {
<a name="l00325"></a>00325     fprintf(stderr, <span class="stringliteral">&quot;Error: matrix list is empty.\n&quot;</span>);
<a name="l00326"></a>00326     <span class="keywordflow">return</span> 2;
<a name="l00327"></a>00327   }
<a name="l00328"></a>00328   <span class="keywordflow">if</span>(<a class="code" href="ecat63_8h.html#a31112b67a89269c5bed48d48ce2957ed">ECAT63_TEST</a>&gt;1) <a class="code" href="ecat63ml_8c.html#aabc712142bcbc9e27d79a840e80212ae">ecat63PrintMatlist</a>(&amp;mlist);
<a name="l00329"></a>00329 
<a name="l00330"></a>00330   <span class="comment">/*</span>
<a name="l00331"></a>00331 <span class="comment">   *  Read and print subheaders one at a time</span>
<a name="l00332"></a>00332 <span class="comment">   */</span>
<a name="l00333"></a>00333   <span class="keywordflow">for</span>(mi=nr=0; mi&lt;mlist.<a class="code" href="structMATRIXLIST.html#a7fcfb983a42851d8562084ddde1f9fcd">matrixNr</a>; mi++) {
<a name="l00334"></a>00334     <span class="comment">/* Get plane and frame nr */</span>
<a name="l00335"></a>00335     <a class="code" href="ecat63ml_8c.html#af566384e63f743897f71d8ee41b3b292">mat_numdoc</a>(mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#aeb0291ec1f5ac237c1e587ed3d23b1bb">matnum</a>, &amp;matval);
<a name="l00336"></a>00336     <span class="comment">/* Check if this is supposed to be listed or not */</span>
<a name="l00337"></a>00337     <span class="keywordflow">if</span>(frame&gt;=0 &amp;&amp; frame!=matval.<a class="code" href="structMatval.html#a514081d81e26c20a377de4e945499446">frame</a>) <span class="keywordflow">continue</span>;
<a name="l00338"></a>00338     <span class="keywordflow">if</span>(plane&gt;=0 &amp;&amp; plane!=matval.<a class="code" href="structMatval.html#ac87d088d281d918936f987cd19148069">plane</a>) <span class="keywordflow">continue</span>;
<a name="l00339"></a>00339     <span class="comment">/* Read subheader */</span>
<a name="l00340"></a>00340     <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#aaf5f1adfda44941c4bf4de3e71219e4a">IMAGE_DATA</a>)
<a name="l00341"></a>00341       ret=<a class="code" href="ecat63r_8c.html#adc36293804c18dd15771c61500841b7c">ecat63ReadImageheader</a>(fp, mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#af91ca45aca86269901b03480b5b6d741">strtblk</a>, &amp;image_header);
<a name="l00342"></a>00342     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a7140d943b6f40ad3c4bdab5a2073c2f6">RAW_DATA</a>)
<a name="l00343"></a>00343       ret=<a class="code" href="ecat63r_8c.html#a811c9c52c52f1c749ee6cb0f7a51f884">ecat63ReadScanheader</a>(fp, mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#af91ca45aca86269901b03480b5b6d741">strtblk</a>, &amp;scan_header);
<a name="l00344"></a>00344     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a23271440af335f92b16c81abdff7818a">ATTN_DATA</a>)
<a name="l00345"></a>00345       ret=<a class="code" href="ecat63r_8c.html#ac9c08bd1e03ddc4f4a8c83a5ea198e05">ecat63ReadAttnheader</a>(fp, mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#af91ca45aca86269901b03480b5b6d741">strtblk</a>, &amp;attn_header);
<a name="l00346"></a>00346     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a978e691d4d6416577705c5c654096e02">NORM_DATA</a>)
<a name="l00347"></a>00347       ret=<a class="code" href="ecat63r_8c.html#a6a169297491f0f8a734247467cfb2b89">ecat63ReadNormheader</a>(fp, mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#af91ca45aca86269901b03480b5b6d741">strtblk</a>, &amp;norm_header);
<a name="l00348"></a>00348     <span class="keywordflow">if</span>(ret) {
<a name="l00349"></a>00349       fprintf(stderr, <span class="stringliteral">&quot;Error: cannot read matrix %u subheader.\n&quot;</span>,
<a name="l00350"></a>00350          mlist.<a class="code" href="structMATRIXLIST.html#a42676745379d69392b07b5c29626f6f9">matdir</a>[mi].<a class="code" href="structMatDir.html#aeb0291ec1f5ac237c1e587ed3d23b1bb">matnum</a>);
<a name="l00351"></a>00351       <a class="code" href="ecat63ml_8c.html#a2d931d7e3d4e21159731b7c480c209b9">ecat63EmptyMatlist</a>(&amp;mlist); <span class="keywordflow">return</span> 4;
<a name="l00352"></a>00352     }
<a name="l00353"></a>00353     <span class="comment">/* Print subheader */</span>
<a name="l00354"></a>00354     fprintf(fp, <span class="stringliteral">&quot;Matrix: plane %d frame %d gate %d bed %d\n&quot;</span>,
<a name="l00355"></a>00355       matval.<a class="code" href="structMatval.html#ac87d088d281d918936f987cd19148069">plane</a>, matval.<a class="code" href="structMatval.html#a514081d81e26c20a377de4e945499446">frame</a>, matval.<a class="code" href="structMatval.html#ab317865439d3423f362a3094dd65fc18">gate</a>, matval.<a class="code" href="structMatval.html#a10e3bc89856eedcc00d72ba1a3086299">bed</a>);
<a name="l00356"></a>00356     <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#aaf5f1adfda44941c4bf4de3e71219e4a">IMAGE_DATA</a>)
<a name="l00357"></a>00357       <a class="code" href="ecat63p_8c.html#a5f3ba1102f964d98b4de5a93c3d9fd36">ecat63PrintImageheader</a>(&amp;image_header, ofp);
<a name="l00358"></a>00358     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a7140d943b6f40ad3c4bdab5a2073c2f6">RAW_DATA</a>)
<a name="l00359"></a>00359       <a class="code" href="ecat63p_8c.html#a67a369196200471d7954b4788de262a6">ecat63PrintScanheader</a>(&amp;scan_header, ofp);
<a name="l00360"></a>00360     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a23271440af335f92b16c81abdff7818a">ATTN_DATA</a>)
<a name="l00361"></a>00361       <a class="code" href="ecat63p_8c.html#ac13fb1d4ef04db1275a076bef59ee991">ecat63PrintAttnheader</a>(&amp;attn_header, ofp);
<a name="l00362"></a>00362     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mh.<a class="code" href="structecat63__mainheader.html#aeb7fd4a6b107a810dcff5d82b6f58440">file_type</a>==<a class="code" href="ecat63_8h.html#a978e691d4d6416577705c5c654096e02">NORM_DATA</a>)
<a name="l00363"></a>00363       <a class="code" href="ecat63p_8c.html#a6e83e2fee3eadec5df6cc74d3bb770ef">ecat63PrintNormheader</a>(&amp;norm_header, ofp);
<a name="l00364"></a>00364     nr++; <span class="comment">// counter</span>
<a name="l00365"></a>00365   } <span class="comment">/* next matrix */</span>
<a name="l00366"></a>00366   <a class="code" href="ecat63ml_8c.html#a2d931d7e3d4e21159731b7c480c209b9">ecat63EmptyMatlist</a>(&amp;mlist);
<a name="l00367"></a>00367   
<a name="l00368"></a>00368   <span class="keywordflow">if</span>(nr==0 &amp;&amp; (plane&gt;=0 || frame&gt;=0)) {
<a name="l00369"></a>00369     fprintf(stderr, <span class="stringliteral">&quot;Error: specified matrices not found.\n&quot;</span>);
<a name="l00370"></a>00370     <span class="keywordflow">return</span>(11);
<a name="l00371"></a>00371   }
<a name="l00372"></a>00372 
<a name="l00373"></a>00373   <span class="keywordflow">return</span>(0);
<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="l00378"></a>00378 
</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>