RTK  2.6.0
Reconstruction Toolkit
rtkHndImageIO.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 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 <cstdint>
30 #endif
31 
32 #include "RTKExport.h"
33 #include "rtkMacro.h"
34 namespace rtk
35 {
36 
46 class RTK_EXPORT HndImageIO : public itk::ImageIOBase
47 {
48 public:
50  using Self = HndImageIO;
53  using PixelType = signed short int;
54 
55  typedef struct hnd_header
56  {
57  char sFileType[32];
58  unsigned int FileLength;
59  char sChecksumSpec[4];
60  unsigned int nCheckSum;
61  char sCreationDate[8];
62  char sCreationTime[8];
63  char sPatientID[16];
64  unsigned int nPatientSer;
65  char sSeriesID[16];
66  unsigned int nSeriesSer;
67  char sSliceID[16];
68  unsigned int nSliceSer;
69  unsigned int SizeX;
70  unsigned int SizeY;
71  double dSliceZPos;
72  char sModality[16];
73  unsigned int nWindow;
74  unsigned int nLevel;
75  unsigned int nPixelOffset;
76  char sImageType[4];
77  double dGantryRtn;
78  double dSAD;
79  double dSFD;
80  double dCollX1;
81  double dCollX2;
82  double dCollY1;
83  double dCollY2;
84  double dCollRtn;
85  double dFieldX;
86  double dFieldY;
87  double dBladeX1;
88  double dBladeX2;
89  double dBladeY1;
90  double dBladeY2;
91  double dIDUPosLng;
92  double dIDUPosLat;
93  double dIDUPosVrt;
94  double dIDUPosRtn;
97  double dCouchVrt;
98  double dCouchLng;
99  double dCouchLat;
104  double dEnergy;
105  double dDoseRate;
106  double dXRayKV;
107  double dXRayMA;
117  } Hnd_header;
118 
120  : Superclass()
121  {}
122 
124  itkNewMacro(Self);
125 
127 #ifdef itkOverrideGetNameOfClassMacro
128  itkOverrideGetNameOfClassMacro(HndImageIO);
129 #else
130  itkTypeMacro(HndImageIO, itk::ImageIOBase);
131 #endif
132 
133 
134  /*-------- This part of the interface deals with reading data. ------ */
135  void
136  ReadImageInformation() override;
137 
138  bool
139  CanReadFile(const char * FileNameToRead) override;
140 
141  void
142  Read(void * buffer) override;
143 
144  /*-------- This part of the interfaces deals with writing data. ----- */
145  virtual void
146  WriteImageInformation(bool /*keepOfStream*/)
147  {}
148 
149  void
151  {
152  WriteImageInformation(false);
153  }
154 
155  bool
156  CanWriteFile(const char * filename) override;
157 
158  void
159  Write(const void * buffer) override;
160 
161 }; // end class HndImageIO
162 
163 } // namespace rtk
164 
165 #endif /* end #define rtkHndImageIO_h */
virtual void WriteImageInformation(bool)
Class for reading Hnd Image file format.
Definition: rtkHndImageIO.h:46
void WriteImageInformation() override
signed short int PixelType
Definition: rtkHndImageIO.h:53