]> Creatis software - clitk.git/blob - common/rtkHndImageIO.h
Remove sonarQube
[clitk.git] / common / rtkHndImageIO.h
1 /*=========================================================================
2  *
3  *  Copyright RTK Consortium
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *         http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *=========================================================================*/
18
19 #ifndef __rtkHndImageIO_h
20 #define __rtkHndImageIO_h
21
22 // itk include
23 #include <itkImageIOBase.h>
24
25 #if defined (_MSC_VER) && (_MSC_VER < 1600)
26 //SR: taken from
27 //#include "msinttypes/stdint.h"
28 #else
29 #include <stdint.h>
30 #endif
31
32 #include "clitkCommon.h"
33
34 namespace rtk {
35
36 /** \class HndImageIO
37  * \brief Class for reading Hnd Image file format
38  *
39  * Reads Hnd files (file format used by Varian for Obi raw data).
40  *
41  * \author Simon Rit
42  *
43  * \ingroup IOFilters
44  */
45 class HndImageIO : public itk::ImageIOBase
46 {
47 public:
48 /** Standard class typedefs. */
49   typedef HndImageIO              Self;
50   typedef itk::ImageIOBase        Superclass;
51   typedef itk::SmartPointer<Self> Pointer;
52   typedef signed short int        PixelType;
53
54   typedef struct hnd_header {
55     char sFileType[32];
56     unsigned int FileLength;
57     char sChecksumSpec[4];
58     unsigned int nCheckSum;
59     char sCreationDate[8];
60     char sCreationTime[8];
61     char sPatientID[16];
62     unsigned int nPatientSer;
63     char sSeriesID[16];
64     unsigned int nSeriesSer;
65     char sSliceID[16];
66     unsigned int nSliceSer;
67     unsigned int SizeX;
68     unsigned int SizeY;
69     double dSliceZPos;
70     char sModality[16];
71     unsigned int nWindow;
72     unsigned int nLevel;
73     unsigned int nPixelOffset;
74     char sImageType[4];
75     double dGantryRtn;
76     double dSAD;
77     double dSFD;
78     double dCollX1;
79     double dCollX2;
80     double dCollY1;
81     double dCollY2;
82     double dCollRtn;
83     double dFieldX;
84     double dFieldY;
85     double dBladeX1;
86     double dBladeX2;
87     double dBladeY1;
88     double dBladeY2;
89     double dIDUPosLng;
90     double dIDUPosLat;
91     double dIDUPosVrt;
92     double dIDUPosRtn;
93     double dPatientSupportAngle;
94     double dTableTopEccentricAngle;
95     double dCouchVrt;
96     double dCouchLng;
97     double dCouchLat;
98     double dIDUResolutionX;
99     double dIDUResolutionY;
100     double dImageResolutionX;
101     double dImageResolutionY;
102     double dEnergy;
103     double dDoseRate;
104     double dXRayKV;
105     double dXRayMA;
106     double dMetersetExposure;
107     double dAcqAdjustment;
108     double dCTProjectionAngle;
109     double dCTNormChamber;
110     double dGatingTimeTag;
111     double dGating4DInfoX;
112     double dGating4DInfoY;
113     double dGating4DInfoZ;
114     double dGating4DInfoTime;
115     } Hnd_header;
116
117   HndImageIO() : Superclass() {}
118
119   /** Method for creation through the object factory. */
120   itkNewMacro(Self);
121
122   /** Run-time type information (and related methods). */
123   itkTypeMacro(HndImageIO, itk::ImageIOBase);
124
125   /*-------- This part of the interface deals with reading data. ------ */
126   virtual void ReadImageInformation() ITK_OVERRIDE;
127
128   virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
129
130   virtual void Read(void * buffer) ITK_OVERRIDE;
131
132   /*-------- This part of the interfaces deals with writing data. ----- */
133   virtual void WriteImageInformation(bool /*keepOfStream*/) { }
134
135   virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
136
137   virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
138
139   virtual void Write(const void* buffer) ITK_OVERRIDE;
140
141 }; // end class HndImageIO
142
143 } // end namespace
144
145 #endif /* end #define __rtkHndImageIO_h */