]> Creatis software - clitk.git/blob - common/clitkHndImageIO.h
changes in license header
[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://www.centreleonberard.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 //SR: taken from
26 //#include "msinttypes/stdint.h"
27 typedef unsigned int uint32_t;
28 #else
29 #include <stdint.h>
30 #endif
31
32 namespace clitk {
33   
34   //====================================================================
35   // Class for reading Hnd Image file format
36   class HndImageIO: public itk::ImageIOBase
37   {
38   public: 
39         /** Standard class typedefs. */
40   typedef HndImageIO              Self;
41         typedef itk::ImageIOBase        Superclass;
42         typedef itk::SmartPointer<Self> Pointer;        
43         typedef signed short int        PixelType;
44         
45   typedef struct hnd_header {
46       char sFileType[32];
47       uint32_t FileLength;
48       char sChecksumSpec[4];
49       uint32_t nCheckSum;
50       char sCreationDate[8];
51       char sCreationTime[8];
52       char sPatientID[16];
53       uint32_t nPatientSer;
54       char sSeriesID[16];
55       uint32_t nSeriesSer;
56       char sSliceID[16];
57       uint32_t nSliceSer;
58       uint32_t SizeX;
59       uint32_t SizeY;
60       double dSliceZPos;
61       char sModality[16];
62       uint32_t nWindow;
63       uint32_t nLevel;
64       uint32_t nPixelOffset;
65       char sImageType[4];
66       double dGantryRtn;
67       double dSAD;
68       double dSFD;
69       double dCollX1;
70       double dCollX2;
71       double dCollY1;
72       double dCollY2;
73       double dCollRtn;
74       double dFieldX;
75       double dFieldY;
76       double dBladeX1;
77       double dBladeX2;
78       double dBladeY1;
79       double dBladeY2;
80       double dIDUPosLng;
81       double dIDUPosLat;
82       double dIDUPosVrt;
83       double dIDUPosRtn;
84       double dPatientSupportAngle;
85       double dTableTopEccentricAngle;
86       double dCouchVrt;
87       double dCouchLng;
88       double dCouchLat;
89       double dIDUResolutionX;
90       double dIDUResolutionY;
91       double dImageResolutionX;
92       double dImageResolutionY;
93       double dEnergy;
94       double dDoseRate;
95       double dXRayKV;
96       double dXRayMA;
97       double dMetersetExposure;
98       double dAcqAdjustment;
99       double dCTProjectionAngle;
100       double dCTNormChamber;
101       double dGatingTimeTag;
102       double dGating4DInfoX;
103       double dGating4DInfoY;
104       double dGating4DInfoZ;
105       double dGating4DInfoTime;
106   } Hnd_header;
107
108   HndImageIO():Superclass() {;}
109
110         /** Method for creation through the object factory. */
111         itkNewMacro(Self);
112         
113         /** Run-time type information (and related methods). */
114   itkTypeMacro(HndImageIO, ImageIOBase);
115         
116         /*-------- This part of the interface deals with reading data. ------ */
117         virtual void ReadImageInformation();
118         virtual bool CanReadFile( const char* FileNameToRead );
119         virtual void Read(void * buffer);
120
121         /*-------- This part of the interfaces deals with writing data. ----- */
122         virtual void WriteImageInformation(bool keepOfStream) { ; }
123         virtual void WriteImageInformation() { WriteImageInformation(false); }
124         virtual bool CanWriteFile(const char* filename);
125         virtual void Write(const void* buffer);
126         
127   protected:
128         int m_HeaderSize;
129
130   }; // end class HndImageIO
131 } // end namespace
132
133 // explicit template instantiation
134 //template class itk::CreateObjectFunction<clitk::HndImageIO>;
135
136 #endif /* end #define CLITKHNDIMAGEIO_H */
137