1 /*=========================================================================
3 * Copyright RTK Consortium
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
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
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.
17 *=========================================================================*/
19 #ifndef __rtkHndImageIO_h
20 #define __rtkHndImageIO_h
23 #include <itkImageIOBase.h>
25 #if defined (_MSC_VER) && (_MSC_VER < 1600)
27 //#include "msinttypes/stdint.h"
32 #include "clitkCommon.h"
37 * \brief Class for reading Hnd Image file format
39 * Reads Hnd files (file format used by Varian for Obi raw data).
45 class HndImageIO : public itk::ImageIOBase
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;
54 typedef struct hnd_header {
56 unsigned int FileLength;
57 char sChecksumSpec[4];
58 unsigned int nCheckSum;
59 char sCreationDate[8];
60 char sCreationTime[8];
62 unsigned int nPatientSer;
64 unsigned int nSeriesSer;
66 unsigned int nSliceSer;
73 unsigned int nPixelOffset;
93 double dPatientSupportAngle;
94 double dTableTopEccentricAngle;
98 double dIDUResolutionX;
99 double dIDUResolutionY;
100 double dImageResolutionX;
101 double dImageResolutionY;
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;
117 HndImageIO() : Superclass() {}
119 /** Method for creation through the object factory. */
122 /** Run-time type information (and related methods). */
123 itkTypeMacro(HndImageIO, itk::ImageIOBase);
125 /*-------- This part of the interface deals with reading data. ------ */
126 virtual void ReadImageInformation() ITK_OVERRIDE;
128 virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
130 virtual void Read(void * buffer) ITK_OVERRIDE;
132 /*-------- This part of the interfaces deals with writing data. ----- */
133 virtual void WriteImageInformation(bool /*keepOfStream*/) { }
135 virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
137 virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
139 virtual void Write(const void* buffer) ITK_OVERRIDE;
141 }; // end class HndImageIO
145 #endif /* end #define __rtkHndImageIO_h */