<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ITK: itkRawImageIO.h Source File</title> <link href="DoxygenStyle.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 --> <center> <a href="index.html" class="qindex">Main Page</a> <a href="modules.html" class="qindex">Groups</a> <a href="namespaces.html" class="qindex">Namespace List</a> <a href="hierarchy.html" class="qindex">Class Hierarchy</a> <a href="classes.html" class="qindex">Alphabetical List</a> <a href="annotated.html" class="qindex">Compound List</a> <a href="files.html" class="qindex">File List</a> <a href="namespacemembers.html" class="qindex">Namespace Members</a> <a href="functions.html" class="qindex">Compound Members</a> <a href="globals.html" class="qindex">File Members</a> <a href="pages.html" class="qindex">Concepts</a></center> <!-- Generated by Doxygen 1.5.9 --> <div class="navpath"><a class="el" href="dir_02e23d841c198393a6e961e9a0678fff.html">Code</a> » <a class="el" href="dir_1ee1ddeef2dd172ba0b5030f5ec71db5.html">IO</a> </div> <div class="contents"> <h1>itkRawImageIO.h</h1><a href="itkRawImageIO_8h.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"> Program: Insight Segmentation & Registration Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: itkRawImageIO.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2007-03-22 14:28:52 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.33 $</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> Copyright (c) Insight Software Consortium. All rights reserved.</span> <a name="l00010"></a>00010 <span class="comment"> See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even </span> <a name="l00013"></a>00013 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span> <a name="l00014"></a>00014 <span class="comment"> PURPOSE. See the above copyright notices for more information.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment">=========================================================================*/</span> <a name="l00017"></a>00017 <span class="preprocessor">#ifndef __itkRawImageIO_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkRawImageIO_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <fstream></span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkImageIOBase_8h.html">itkImageIOBase.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkIndex_8h.html">itkIndex.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkImageRegion_8h.html">itkImageRegion.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "itkPixelTraits.h"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="itkByteSwapper_8h.html">itkByteSwapper.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="itkVersion_8h.html">itkVersion.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include <string></span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="keyword">namespace </span>itk <a name="l00031"></a>00031 { <a name="l00032"></a>00032 <a name="l00048"></a>00048 <span class="keyword">template</span> <<span class="keyword">class</span> TPixel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VImageDimension=2> <a name="l00049"></a><a class="code" href="classitk_1_1RawImageIO.html">00049</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ImageIOBase.html" title="Abstract superclass defines image IO interface.">ImageIOBase</a> <a name="l00050"></a>00050 { <a name="l00051"></a>00051 <span class="keyword">public</span>: <a name="l00053"></a><a class="code" href="classitk_1_1RawImageIO.html#4211fe9444bae01cf48eeab170135076">00053</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00054"></a><a class="code" href="classitk_1_1RawImageIO.html#f7408bb9310e7335e7f03bc57fa3fb53">00054</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageIOBase.html" title="Abstract superclass defines image IO interface.">ImageIOBase</a> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Superclass</a>; <a name="l00055"></a><a class="code" href="classitk_1_1RawImageIO.html#4a121e1a6a98c4e9041866fdbfefc68b">00055</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<Self></a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a>; <a name="l00056"></a>00056 <a name="l00058"></a>00058 <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>(<a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>); <a name="l00059"></a>00059 <a name="l00061"></a><a class="code" href="classitk_1_1RawImageIO.html#e075656d1c31b1955be3e0bd867e8ed0">00061</a> <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a>, <a class="code" href="classitk_1_1ImageIOBase.html" title="Abstract superclass defines image IO interface.">ImageIOBase</a>); <a name="l00062"></a>00062 <a name="l00065"></a>00065 <span class="keyword">typedef</span> TPixel PixelType; <a name="l00066"></a>00066 <a name="l00068"></a><a class="code" href="classitk_1_1RawImageIO.html#b55dd176812aa4ea2355043ce369a70e">00068</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> PixelTraits<PixelType>::ValueType ComponentType; <a name="l00069"></a>00069 <a name="l00071"></a><a class="code" href="classitk_1_1RawImageIO.html#39edeecd5a702280217b5939ceea72b8">00071</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ByteSwapper.html" title="Perform machine dependent byte swapping.">ByteSwapper<ComponentType></a> <a class="code" href="classitk_1_1ByteSwapper.html" title="Perform machine dependent byte swapping.">ByteSwapperType</a>; <a name="l00072"></a>00072 <a name="l00073"></a>00073 <a name="l00076"></a>00076 <span class="keywordtype">void</span> SetHeaderSize(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size); <a name="l00077"></a>00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetHeaderSize(); <a name="l00079"></a>00079 <a name="l00083"></a>00083 <a class="code" href="itkMacro_8h.html#7ebdd33cc5e7d74720ced9099c034faa">itkSetMacro</a>(FileDimensionality, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>); <a name="l00084"></a>00084 <a class="code" href="itkMacro_8h.html#1600305bb01e39e87c472d8bf29bd1cf">itkGetMacro</a>(FileDimensionality, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>); <a name="l00086"></a>00086 <a name="l00092"></a><a class="code" href="classitk_1_1RawImageIO.html#110334f92c2ed6dd65695398a46a6661">00092</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> SupportsDimension(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dim) <a name="l00093"></a>00093 {<span class="keywordflow">return</span> (dim == m_FileDimensionality);} <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="comment">/*-------- This part of the interface deals with reading data. ------ */</span> <a name="l00096"></a>00096 <a name="l00100"></a><a class="code" href="classitk_1_1RawImageIO.html#07080c1bccb3e06ea65bb56c00856518">00100</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1RawImageIO.html#07080c1bccb3e06ea65bb56c00856518">CanReadFile</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>*) {<span class="keywordflow">return</span> <span class="keyword">false</span>;} <a name="l00101"></a>00101 <a name="l00104"></a><a class="code" href="classitk_1_1RawImageIO.html#effd9c07427bb7beeaa0331f2075e0bb">00104</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1RawImageIO.html#effd9c07427bb7beeaa0331f2075e0bb">ReadImageInformation</a>() {<span class="keywordflow">return</span>;} <a name="l00105"></a>00105 <a name="l00107"></a>00107 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Read(<span class="keywordtype">void</span>* buffer); <a name="l00108"></a>00108 <a name="l00110"></a>00110 <a class="code" href="itkMacro_8h.html#7d989c13a1a213168db99ae0f84185d4">itkGetConstReferenceMacro</a>(ImageMask,<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>); <a name="l00111"></a><a class="code" href="classitk_1_1RawImageIO.html#53f550e8f66f69553fb9009732dfa304">00111</a> <span class="keywordtype">void</span> SetImageMask(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> val) <a name="l00112"></a>00112 { <a name="l00113"></a>00113 <span class="keywordflow">if</span> (val == m_ImageMask) { <span class="keywordflow">return</span>; } <a name="l00114"></a>00114 m_ImageMask = ((<span class="keywordtype">unsigned</span> short)(val)); <a name="l00115"></a>00115 this->Modified(); <a name="l00116"></a>00116 } <a name="l00118"></a>00118 <a name="l00120"></a><a class="code" href="classitk_1_1RawImageIO.html#5657dd37d4b289419edf6784972599cf">00120</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1RawImageIO.html#5657dd37d4b289419edf6784972599cf">ReadHeader</a> (<span class="keyword">const</span> std::string = std::string()) {} <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="comment">/*-------- This part of the interfaces deals with writing data. ----- */</span> <a name="l00123"></a>00123 <a name="l00127"></a>00127 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CanWriteFile(<span class="keyword">const</span> <span class="keywordtype">char</span>*); <a name="l00128"></a>00128 <a name="l00130"></a><a class="code" href="classitk_1_1RawImageIO.html#3a314d2ad4fba63553d766663b0ee572">00130</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1RawImageIO.html#3a314d2ad4fba63553d766663b0ee572">WriteImageInformation</a>(<span class="keywordtype">void</span>) {<span class="keywordflow">return</span>;} <a name="l00131"></a>00131 <a name="l00132"></a>00132 <a name="l00134"></a>00134 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Write(<span class="keyword">const</span> <span class="keywordtype">void</span>* buffer); <a name="l00135"></a>00135 <a name="l00136"></a>00136 <span class="keyword">protected</span>: <a name="l00137"></a>00137 <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a>(); <a name="l00138"></a>00138 ~<a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a>(); <a name="l00139"></a>00139 <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#920ae03048a5ad715d803ca2e92b52de">PrintSelf</a>(std::ostream& os, <a class="code" href="classitk_1_1Indent.html" title="Control indentation during Print() invocation.">Indent</a> indent) <span class="keyword">const</span>; <a name="l00140"></a>00140 <a name="l00141"></a>00141 <span class="comment">//void ComputeInternalFileName(unsigned long slice);</span> <a name="l00142"></a>00142 <span class="keywordtype">void</span> OpenFileForReading(std::ifstream& is); <a name="l00143"></a>00143 <span class="keywordtype">void</span> OpenFileForWriting(std::ofstream& os); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="keyword">private</span>: <a name="l00146"></a>00146 <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO</a>(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00147"></a>00147 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00148"></a>00148 <a name="l00149"></a>00149 std::string m_InternalFileName; <a name="l00150"></a>00150 <a name="l00151"></a>00151 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_FileDimensionality; <a name="l00152"></a>00152 <span class="keywordtype">bool</span> m_ManualHeaderSize; <a name="l00153"></a>00153 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_HeaderSize; <a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> m_ImageMask; <a name="l00155"></a>00155 }; <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="keyword">template</span> <<span class="keyword">class</span> TPixel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VImageDimension> <a name="l00158"></a><a class="code" href="classitk_1_1RawImageIOFactory.html">00158</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1RawImageIOFactory.html">RawImageIOFactory</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1ObjectFactoryBase.html" title="Create instances of classes using an object factory.">ObjectFactoryBase</a> <a name="l00159"></a>00159 { <a name="l00160"></a>00160 <span class="keyword">public</span>: <a name="l00162"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#21e243ca352618d257601c759c4ec88c">00162</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1RawImageIOFactory.html">RawImageIOFactory<TPixel,VImageDimension></a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00163"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#7e75f152df6e966a6c4f1b57960960c0">00163</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ObjectFactoryBase.html" title="Create instances of classes using an object factory.">ObjectFactoryBase</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00164"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#292981f871b231fff6190773e7be6ed1">00164</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<Self></a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a>; <a name="l00165"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#19bb10e77aa456ad67e8a032ea75089a">00165</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<const Self></a> <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a>; <a name="l00166"></a>00166 <a name="l00168"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#25dc40b83aaa5c813d511d501539449f">00168</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* GetITKSourceVersion(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00169"></a>00169 <span class="keyword"> </span>{ <a name="l00170"></a>00170 <span class="keywordflow">return</span> <a class="code" href="itkVersion_8h.html#84ea37b9af378ee6ee36485588f8ee80">ITK_SOURCE_VERSION</a>; <a name="l00171"></a>00171 } <a name="l00172"></a>00172 <a name="l00173"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#3b020e1e63a70dd80ae90f2fe2e9b8e5">00173</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* GetDescription(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00174"></a>00174 <span class="keyword"> </span>{ <a name="l00175"></a>00175 <span class="keywordflow">return</span> <span class="stringliteral">"Raw ImageIO Factory, allows the loading of Raw images into insight"</span>; <a name="l00176"></a>00176 } <a name="l00177"></a>00177 <a name="l00179"></a>00179 <a class="code" href="itkMacro_8h.html#bb621d7a64b1e616887022f6cac9b8e1">itkFactorylessNewMacro</a>(<a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>); <a name="l00180"></a>00180 <a name="l00182"></a>00182 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1RawImageIOFactory.html">RawImageIOFactory</a>, <a class="code" href="classitk_1_1ObjectFactoryBase.html" title="Create instances of classes using an object factory.">ObjectFactoryBase</a>); <a name="l00183"></a>00183 <a name="l00185"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#df47318fae8a62b64b6651ac4b6af7af">00185</a> <span class="keyword">static</span> <span class="keywordtype">void</span> RegisterOneFactory(<span class="keywordtype">void</span>) <a name="l00186"></a>00186 { <a name="l00187"></a>00187 <a class="code" href="classitk_1_1ObjectFactoryBase.html#7363fa21f9e4504948f3141057f03a9f">ObjectFactoryBase::RegisterFactory</a>( <a class="code" href="namespaceHardConnectedComponentImageFilter.html#870262f145e0b45206db74df8053b59c">Self::New</a>() ); <a name="l00188"></a>00188 } <a name="l00189"></a>00189 <a name="l00190"></a>00190 <span class="keyword">protected</span>: <a name="l00191"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#1fdd042064e0abe8c211ce8c03f5cd60">00191</a> <a class="code" href="classitk_1_1RawImageIOFactory.html#1fdd042064e0abe8c211ce8c03f5cd60">RawImageIOFactory</a>() {}; <a name="l00192"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#2d166f6d30dd373f0e647b8f0ba3c0ec">00192</a> <a class="code" href="classitk_1_1RawImageIOFactory.html#2d166f6d30dd373f0e647b8f0ba3c0ec">~RawImageIOFactory</a>() {}; <a name="l00193"></a>00193 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">RawImageIO<TPixel,VImageDimension></a> myProductType; <a name="l00194"></a><a class="code" href="classitk_1_1RawImageIOFactory.html#0bff0cb75a174213f09bab4bd332b8b6">00194</a> <span class="keyword">const</span> <a class="code" href="classitk_1_1RawImageIO.html" title="Read and write raw binary images.">myProductType</a>* m_MyProduct; <a name="l00195"></a>00195 <a name="l00196"></a>00196 <span class="keyword">private</span>: <a name="l00197"></a>00197 <a class="code" href="classitk_1_1RawImageIOFactory.html">RawImageIOFactory</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00198"></a>00198 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00199"></a>00199 <a name="l00200"></a>00200 }; <a name="l00201"></a>00201 <a name="l00202"></a>00202 } <span class="comment">// namespace itk</span> <a name="l00203"></a>00203 <a name="l00204"></a>00204 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00205"></a>00205 <span class="preprocessor"></span><span class="preprocessor">#include "itkRawImageIO.txx"</span> <a name="l00206"></a>00206 <span class="preprocessor">#endif</span> <a name="l00207"></a>00207 <span class="preprocessor"></span> <a name="l00208"></a>00208 <span class="preprocessor">#endif</span> <a name="l00209"></a>00209 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:59:07 2009 for ITK by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53> </a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>