Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > ecbd8c5b7568e331fe6ea5b9a07a78a0 > files > 201

CCfits-docs-2.2-2.fc13.noarch.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>CCfits: Reading an Image</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.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="readimage">Reading an Image </a></h1><p>Image reading calls are made very simple: the FITS object is created with the readDataFlag set to true, and reading is done on construction. The following call</p>
<p>image.read(contents)</p>
<p>calls</p>
<p>PHDU::read(std::valarray&lt;S&gt;&amp; image).</p>
<p>This copies the entire image from the FITS object into the std::valarray object contents, sizing it as necessary. PHDU::read() and ExtHDU::read() [for image extensions] take a range of arguments that support (a) reading the entire image - as in this example; (b) sections of an image starting from a given pixel; (c) rectangular subsets. See the class references for PHDU and ExtHDU for details.</p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">int</span> readImage()
 {
        std::auto_ptr&lt;FITS&gt; pInfile(<span class="keyword">new</span> FITS(<span class="stringliteral">&quot;atestfil.fit&quot;</span>,Read,<span class="keyword">true</span>));
        
        PHDU&amp; image = pInfile-&gt;pHDU(); 
        
        std::valarray&lt;unsigned long&gt;  contents;
        
        <span class="comment">// read all user-specifed, coordinate, and checksum keys in the image</span>
        image.readAllKeys();
        
        image.read(contents);
        
        <span class="comment">// this doesn&apos;t print the data, just header info.</span>
        std::cout &lt;&lt; image &lt;&lt; std::endl;
        
        <span class="keywordtype">long</span> ax1(image.axis(0));
        <span class="keywordtype">long</span> ax2(image.axis(1));
        
        <span class="keywordflow">for</span> (<span class="keywordtype">long</span> j = 0; j &lt; ax2; j+=10)
        {
                std::ostream_iterator&lt;short&gt; c(std::cout,<span class="stringliteral">&quot;\t&quot;</span>);
                std::copy(&amp;contents[j*ax1],&amp;contents[(j+1)*ax1-1],c);
                std::cout &lt;&lt; <span class="charliteral">&apos;\n&apos;</span>;       
        }
           
        std::cout &lt;&lt; std::endl;
        <span class="keywordflow">return</span> 0;   
 }
</pre></div> </div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Wed Sep 9 11:59:41 2009 for CCfits by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>