RTK  2.5.0
Reconstruction Toolkit
rtkHncImageIO.h
Go to the documentation of this file.
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  * https://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 rtkHncImageIO_h
20 #define rtkHncImageIO_h
21 
22 // itk include
23 #include <itkImageIOBase.h>
24 #include "itksys/SystemTools.hxx"
25 
26 #if defined(_MSC_VER) && (_MSC_VER < 1600)
27 // SR: taken from
28 //#include "msinttypes/stdint.h"
29 #else
30 # include <cstdint>
31 #endif
32 
33 #include "RTKExport.h"
34 #include "rtkMacro.h"
35 
36 namespace rtk
37 {
38 
47 class RTK_EXPORT HncImageIO : public itk::ImageIOBase
48 {
49 public:
51  using Self = HncImageIO;
54  using PixelType = unsigned short int;
55 
56  typedef struct hnc_header
57  {
58  char sFileType[32];
59  unsigned int FileLength;
60  char sChecksumSpec[4];
61  unsigned int nCheckSum;
62  char sCreationDate[8];
63  char sCreationTime[8];
64  char sPatientID[16];
65  unsigned int nPatientSer;
66  char sSeriesID[16];
67  unsigned int nSeriesSer;
68  char sSliceID[16];
69  unsigned int nSliceSer;
70  unsigned int SizeX;
71  unsigned int SizeY;
72  double dSliceZPos;
73  char sModality[16];
74  unsigned int nWindow;
75  unsigned int nLevel;
76  unsigned int nPixelOffset;
77  char sImageType[4];
78  double dGantryRtn;
79  double dSAD;
80  double dSFD;
81  double dCollX1;
82  double dCollX2;
83  double dCollY1;
84  double dCollY2;
85  double dCollRtn;
86  double dFieldX;
87  double dFieldY;
88  double dBladeX1;
89  double dBladeX2;
90  double dBladeY1;
91  double dBladeY2;
92  double dIDUPosLng;
93  double dIDUPosLat;
94  double dIDUPosVrt;
95  double dIDUPosRtn;
98  double dCouchVrt;
99  double dCouchLng;
100  double dCouchLat;
105  double dEnergy;
106  double dDoseRate;
107  double dXRayKV;
108  double dXRayMA;
118  } Hnc_header;
119 
121  : Superclass()
122  {}
123 
125  itkNewMacro(Self);
126 
128 #ifdef itkOverrideGetNameOfClassMacro
129  itkOverrideGetNameOfClassMacro(HncImageIO);
130 #else
131  itkTypeMacro(HncImageIO, itk::ImageIOBase);
132 #endif
133 
134 
135  /*-------- This part of the interface deals with reading data. ------ */
136  void
137  ReadImageInformation() override;
138 
139  bool
140  CanReadFile(const char * FileNameToRead) override;
141 
142  void
143  Read(void * buffer) override;
144 
145  /*-------- This part of the interfaces deals with writing data. ----- */
146  virtual void
147  WriteImageInformation(bool /*keepOfStream*/)
148  {}
149 
150  void
152  {
153  WriteImageInformation(false);
154  }
155 
156  bool
157  CanWriteFile(const char * filename) override;
158 
159  void
160  Write(const void * buffer) override;
161 
162 }; // end class HncImageIO
163 
164 } // namespace rtk
165 
166 #endif /* end #define rtkHncImageIO_h */
void WriteImageInformation() override
unsigned short int PixelType
Definition: rtkHncImageIO.h:54
virtual void WriteImageInformation(bool)