<!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: itkIPLCommonImageIO.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>itkIPLCommonImageIO.h</h1><a href="itkIPLCommonImageIO_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: itkIPLCommonImageIO.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-12-15 13:55:14 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.22 $</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 <a name="l00031"></a>00031 <span class="preprocessor">#ifndef __itkIPLCommonImageIO_h</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define __itkIPLCommonImageIO_h</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="itkImageIOBase_8h.html">itkImageIOBase.h</a>"</span> <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="itkIPLFileNameList_8h.html">itkIPLFileNameList.h</a>"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="itkGEImageHeader_8h.html">itkGEImageHeader.h</a>"</span> <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">namespace </span>itk <a name="l00039"></a>00039 { <a name="l00047"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html">00047</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</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="l00048"></a>00048 { <a name="l00049"></a>00049 <span class="keyword">public</span>: <a name="l00051"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#e7ee93a633062f3001807169045014b1">00051</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00052"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#d34151bde55bd78b2c874a8b8716470a">00052</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="l00053"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#3b8a2932d5a4ea1be86367c5fc492cb3">00053</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="l00054"></a>00054 <a name="l00055"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#43d9ffcb2e73d1ccb66f1ed9e252354d">00055</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> U8; <a name="l00056"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#8f43becd2721b12f60659d46350a6f04">00056</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">char</span> S8; <a name="l00057"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#0d3fdaaaf25c1852f601814b421c31e4">00057</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> U16; <a name="l00058"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#7dc278e7fe0aa89fb10f35492dd1c951">00058</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">short</span> S16; <a name="l00059"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#2e8c2d266b141492cbd3d6ae34539d72">00059</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> U32; <a name="l00060"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#32e5d973122c54fb0571891c1ee99826">00060</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">int</span> S32; <a name="l00061"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#223d950dd1b3d81604656166e86d6285">00061</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> U64; <a name="l00062"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#af2f1107c064e5e4b9757b02e9183a3c">00062</a> <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">long</span> S64; <a name="l00063"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#5d195179e107bbe9dc9709771b745938">00063</a> <span class="keyword">typedef</span> <span class="keywordtype">float</span> F32; <a name="l00064"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#e4684bde0d0b46b22387540112fa4eff">00064</a> <span class="keyword">typedef</span> <span class="keywordtype">double</span> F64; <a name="l00065"></a>00065 <a name="l00067"></a>00067 <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="l00068"></a>00068 <a name="l00070"></a>00070 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</a>, <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Superclass</a>); <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="comment">/*-------- This part of the interfaces deals with reading data. ----- */</span> <a name="l00073"></a>00073 <a name="l00080"></a>00080 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CanReadFile(<span class="keyword">const</span> <span class="keywordtype">char</span>* FileNameToRead); <a name="l00081"></a>00081 <a name="l00083"></a>00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> ReadImageInformation(); <a name="l00084"></a>00084 <a name="l00086"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#bc7b700f7b3bff666111e399b3b964e6">00086</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1IPLCommonImageIO.html#bc7b700f7b3bff666111e399b3b964e6">ModifyImageInformation</a>() {}; <a name="l00087"></a>00087 <a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keyword">const</span> std::type_info& GetPixelTypeInfo() <span class="keyword">const</span>; <a name="l00090"></a>00090 <a name="l00092"></a>00092 <span class="keyword">virtual</span> <span class="keyword">const</span> std::type_info& GetComponentTypeInfo() <span class="keyword">const</span>; <a name="l00093"></a>00093 <a name="l00095"></a>00095 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Read(<span class="keywordtype">void</span>* buffer); <a name="l00096"></a>00096 <a name="l00100"></a>00100 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetComponentSize() <span class="keyword">const</span>; <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">/*-------- This part of the interfaces deals with writing data. ----- */</span> <a name="l00103"></a>00103 <a name="l00110"></a>00110 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> CanWriteFile(<span class="keyword">const</span> <span class="keywordtype">char</span> * FileNameToWrite); <a name="l00111"></a>00111 <a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> WriteImageInformation(); <a name="l00114"></a>00114 <a name="l00117"></a>00117 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Write(<span class="keyword">const</span> <span class="keywordtype">void</span>* buffer); <a name="l00118"></a>00118 <a name="l00120"></a>00120 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SortImageListByNameAscend(); <a name="l00121"></a>00121 <a name="l00123"></a>00123 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SortImageListByNameDescend(); <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">protected</span>: <a name="l00127"></a>00127 <a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</a>(); <a name="l00128"></a>00128 ~<a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</a>(); <a name="l00129"></a>00129 <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="l00130"></a>00130 <a name="l00131"></a>00131 <span class="keywordtype">int</span> AddElementToList(<span class="keywordtype">char</span> <span class="keyword">const</span> * <span class="keyword">const</span> filename, <a name="l00132"></a>00132 <span class="keyword">const</span> <span class="keywordtype">float</span> sliceLocation, <a name="l00133"></a>00133 <span class="keyword">const</span> <span class="keywordtype">int</span> offset, <a name="l00134"></a>00134 <span class="keyword">const</span> <span class="keywordtype">int</span> XDim, <a name="l00135"></a>00135 <span class="keyword">const</span> <span class="keywordtype">int</span> YDim, <a name="l00136"></a>00136 <span class="keyword">const</span> <span class="keywordtype">int</span> Key1, <a name="l00137"></a>00137 <span class="keyword">const</span> <span class="keywordtype">int</span> Key2 ); <a name="l00138"></a>00138 <span class="keywordtype">void</span> sortImageListAscend (); <a name="l00139"></a>00139 <span class="keywordtype">void</span> sortImageListDescend (); <a name="l00140"></a>00140 <span class="keywordtype">int</span> statTimeToAscii (<span class="keywordtype">void</span> *clock, <span class="keywordtype">char</span> *timeString); <a name="l00141"></a>00141 <span class="keyword">virtual</span> <a class="code" href="structGEImageHeader.html">GEImageHeader</a> *ReadHeader(<span class="keyword">const</span> <span class="keywordtype">char</span> *FileNameToRead); <a name="l00142"></a>00142 <span class="comment">//</span> <a name="l00143"></a>00143 <span class="comment">// data members</span> <a name="l00144"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#4d5781dbeaeb29fedd5175887869e914">00144</a> <a class="code" href="structGEImageHeader.html">GEImageHeader</a> *m_ImageHeader; <a name="l00145"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#6d15f79faa395932d525402a2862710a">00145</a> <a class="code" href="classitk_1_1ImageIOBase.html#6d12fffc2c01ac3aabb4d5cca6255a7e">ImageIOBase::ByteOrder</a> m_SystemByteOrder; <a name="l00146"></a><a class="code" href="classitk_1_1IPLCommonImageIO.html#96282d07e877aee05f6a1c92d53b693e">00146</a> <a class="code" href="classitk_1_1IPLFileNameList.html" title="-- stores filename+info to be enumerated for IPLCommonImageIO">IPLFileNameList</a> *m_FilenameList; <a name="l00147"></a>00147 <span class="comment">//</span> <a name="l00148"></a>00148 <span class="comment">// return 0 on success, -1 on failure</span> <a name="l00149"></a>00149 <span class="keywordtype">int</span> GetStringAt(std::ifstream &f,std::streamoff <a class="code" href="classitk_1_1Offset.html" title="Represent the offset between two n-dimensional indexes in a n-dimensional image.">Offset</a>,<span class="keywordtype">char</span> *buf, <a name="l00150"></a>00150 <span class="keywordtype">size_t</span> amount, <span class="keywordtype">bool</span> throw_exception = <span class="keyword">true</span>); <a name="l00151"></a>00151 <span class="keywordtype">int</span> GetIntAt(std::ifstream &f,std::streamoff <a class="code" href="classitk_1_1Offset.html" title="Represent the offset between two n-dimensional indexes in a n-dimensional image.">Offset</a>,<span class="keywordtype">int</span> *ip, <a name="l00152"></a>00152 <span class="keywordtype">bool</span> throw_exception = <span class="keyword">true</span>); <a name="l00153"></a>00153 <span class="keywordtype">int</span> GetShortAt(std::ifstream &f,std::streamoff <a class="code" href="classitk_1_1Offset.html" title="Represent the offset between two n-dimensional indexes in a n-dimensional image.">Offset</a>,<span class="keywordtype">short</span> *ip, <a name="l00154"></a>00154 <span class="keywordtype">bool</span> throw_exception = <span class="keyword">true</span>); <a name="l00155"></a>00155 <span class="keywordtype">int</span> GetFloatAt(std::ifstream &f,std::streamoff <a class="code" href="classitk_1_1Offset.html" title="Represent the offset between two n-dimensional indexes in a n-dimensional image.">Offset</a>,<span class="keywordtype">float</span> *ip, <a name="l00156"></a>00156 <span class="keywordtype">bool</span> throw_exception = <span class="keyword">true</span>); <a name="l00157"></a>00157 <span class="keywordtype">int</span> GetDoubleAt(std::ifstream &f,std::streamoff <a class="code" href="classitk_1_1Offset.html" title="Represent the offset between two n-dimensional indexes in a n-dimensional image.">Offset</a>,<span class="keywordtype">double</span> *ip, <a name="l00158"></a>00158 <span class="keywordtype">bool</span> throw_exception = <span class="keyword">true</span>); <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="keywordtype">short</span> hdr2Short(<span class="keywordtype">char</span> *hdr); <a name="l00161"></a>00161 <span class="keywordtype">int</span> hdr2Int(<span class="keywordtype">char</span> *hdr); <a name="l00162"></a>00162 <span class="keywordtype">float</span> hdr2Float(<span class="keywordtype">char</span> *hdr); <a name="l00163"></a>00163 <span class="keywordtype">double</span> hdr2Double(<span class="keywordtype">char</span> *hdr); <a name="l00164"></a>00164 <span class="keyword">private</span>: <a name="l00165"></a>00165 <a class="code" href="classitk_1_1IPLCommonImageIO.html" title="Class that defines how to read GE4 file format.">IPLCommonImageIO</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="l00166"></a>00166 <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="l00167"></a>00167 }; <a name="l00168"></a>00168 <a name="l00169"></a>00169 } <span class="comment">// end namespace itk</span> <a name="l00170"></a><a class="code" href="itkIPLCommonImageIO_8h.html#0ec754575a952bf4a7d784da9284b243">00170</a> <span class="preprocessor">#define RAISE_EXCEPTION() \</span> <a name="l00171"></a>00171 <span class="preprocessor"> { ExceptionObject exception(__FILE__, __LINE__); \</span> <a name="l00172"></a>00172 <span class="preprocessor"> exception.SetDescription("File cannot be read"); \</span> <a name="l00173"></a>00173 <span class="preprocessor"> throw exception; }</span> <a name="l00174"></a>00174 <span class="preprocessor"></span> <a name="l00175"></a><a class="code" href="itkIPLCommonImageIO_8h.html#515c39264c597060208a3155c5f0a22e">00175</a> <span class="preprocessor">#define IOCHECK() \</span> <a name="l00176"></a>00176 <span class="preprocessor"> if(f.fail()) \</span> <a name="l00177"></a>00177 <span class="preprocessor"> { \</span> <a name="l00178"></a>00178 <span class="preprocessor"> if(f.is_open()) \</span> <a name="l00179"></a>00179 <span class="preprocessor"> f.close(); \</span> <a name="l00180"></a>00180 <span class="preprocessor"> RAISE_EXCEPTION(); \</span> <a name="l00181"></a>00181 <span class="preprocessor"> }</span> <a name="l00182"></a>00182 <span class="preprocessor"></span> <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="preprocessor">#endif // __itkAnalyzeImageIO_h</span> <a name="l00185"></a>00185 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:19:24 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>