]> Creatis software - clitk.git/blob - common/clitkHndImageIO.h
Added Varian OBI file format
[clitk.git] / common / clitkHndImageIO.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef CLITKHNDIMAGEIO_H
19 #define CLITKHNDIMAGEIO_H
20
21 // itk include
22 #include "itkImageIOBase.h"
23
24 #if defined (_MSC_VER) && (_MSC_VER < 1600)
25 #include "msinttypes/stdint.h"
26 #else
27 #include <stdint.h>
28 #endif
29
30 namespace clitk {
31   
32   //====================================================================
33   // Class for reading Hnd Image file format
34   class HndImageIO: public itk::ImageIOBase
35   {
36   public: 
37         /** Standard class typedefs. */
38   typedef HndImageIO              Self;
39         typedef itk::ImageIOBase        Superclass;
40         typedef itk::SmartPointer<Self> Pointer;        
41         typedef signed short int        PixelType;
42         
43   typedef struct hnd_header {
44       char sFileType[32];
45       uint32_t FileLength;
46       char sChecksumSpec[4];
47       uint32_t nCheckSum;
48       char sCreationDate[8];
49       char sCreationTime[8];
50       char sPatientID[16];
51       uint32_t nPatientSer;
52       char sSeriesID[16];
53       uint32_t nSeriesSer;
54       char sSliceID[16];
55       uint32_t nSliceSer;
56       uint32_t SizeX;
57       uint32_t SizeY;
58       double dSliceZPos;
59       char sModality[16];
60       uint32_t nWindow;
61       uint32_t nLevel;
62       uint32_t nPixelOffset;
63       char sImageType[4];
64       double dGantryRtn;
65       double dSAD;
66       double dSFD;
67       double dCollX1;
68       double dCollX2;
69       double dCollY1;
70       double dCollY2;
71       double dCollRtn;
72       double dFieldX;
73       double dFieldY;
74       double dBladeX1;
75       double dBladeX2;
76       double dBladeY1;
77       double dBladeY2;
78       double dIDUPosLng;
79       double dIDUPosLat;
80       double dIDUPosVrt;
81       double dIDUPosRtn;
82       double dPatientSupportAngle;
83       double dTableTopEccentricAngle;
84       double dCouchVrt;
85       double dCouchLng;
86       double dCouchLat;
87       double dIDUResolutionX;
88       double dIDUResolutionY;
89       double dImageResolutionX;
90       double dImageResolutionY;
91       double dEnergy;
92       double dDoseRate;
93       double dXRayKV;
94       double dXRayMA;
95       double dMetersetExposure;
96       double dAcqAdjustment;
97       double dCTProjectionAngle;
98       double dCTNormChamber;
99       double dGatingTimeTag;
100       double dGating4DInfoX;
101       double dGating4DInfoY;
102       double dGating4DInfoZ;
103       double dGating4DInfoTime;
104   } Hnd_header;
105
106   HndImageIO():Superclass() {;}
107
108         /** Method for creation through the object factory. */
109         itkNewMacro(Self);
110         
111         /** Run-time type information (and related methods). */
112   itkTypeMacro(HndImageIO, ImageIOBase);
113         
114         /*-------- This part of the interface deals with reading data. ------ */
115         virtual void ReadImageInformation();
116         virtual bool CanReadFile( const char* FileNameToRead );
117         virtual void Read(void * buffer);
118
119         /*-------- This part of the interfaces deals with writing data. ----- */
120         virtual void WriteImageInformation(bool keepOfStream) { ; }
121         virtual void WriteImageInformation() { WriteImageInformation(false); }
122         virtual bool CanWriteFile(const char* filename);
123         virtual void Write(const void* buffer);
124         
125   protected:
126         int m_HeaderSize;
127
128   }; // end class HndImageIO
129 } // end namespace
130
131 // explicit template instantiation
132 //template class itk::CreateObjectFunction<clitk::HndImageIO>;
133
134 #endif /* end #define CLITKHNDIMAGEIO_H */
135