RTK  2.1.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  * 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 <cstdint>
30 #endif
31 
32 #include "rtkMacro.h"
33 
34 namespace rtk
35 {
36 
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  itkTypeMacro(HndImageIO, itk::ImageIOBase);
128 
129  /*-------- This part of the interface deals with reading data. ------ */
130  void
131  ReadImageInformation() override;
132 
133  bool
134  CanReadFile(const char * FileNameToRead) override;
135 
136  void
137  Read(void * buffer) override;
138 
139  /*-------- This part of the interfaces deals with writing data. ----- */
140  virtual void
141  WriteImageInformation(bool /*keepOfStream*/)
142  {}
143 
144  void
146  {
147  WriteImageInformation(false);
148  }
149 
150  bool
151  CanWriteFile(const char * filename) override;
152 
153  void
154  Write(const void * buffer) override;
155 
156 }; // end class HndImageIO
157 
158 } // namespace rtk
159 
160 #endif /* end #define rtkHndImageIO_h */
virtual void WriteImageInformation(bool)
bool CanWriteFile(const char *filename) override
void Read(void *buffer) override
Class for reading Hnd Image file format.
Definition: rtkHndImageIO.h:46
void WriteImageInformation() override
signed short int PixelType
Definition: rtkHndImageIO.h:53
void ReadImageInformation() override
void Write(const void *buffer) override
HndImageIO Self
Definition: rtkHndImageIO.h:50
struct rtk::HndImageIO::hnd_header Hnd_header
bool CanReadFile(const char *FileNameToRead) override