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"
35 * \brief Class for reading Hnd Image file format
37 * Reads Hnd files (file format used by Varian for Obi raw data).
43 class HndImageIO : public itk::ImageIOBase
46 /** Standard class typedefs. */
47 typedef HndImageIO Self;
48 typedef itk::ImageIOBase Superclass;
49 typedef itk::SmartPointer<Self> Pointer;
50 typedef signed short int PixelType;
52 typedef struct hnd_header {
54 unsigned int FileLength;
55 char sChecksumSpec[4];
56 unsigned int nCheckSum;
57 char sCreationDate[8];
58 char sCreationTime[8];
60 unsigned int nPatientSer;
62 unsigned int nSeriesSer;
64 unsigned int nSliceSer;
71 unsigned int nPixelOffset;
91 double dPatientSupportAngle;
92 double dTableTopEccentricAngle;
96 double dIDUResolutionX;
97 double dIDUResolutionY;
98 double dImageResolutionX;
99 double dImageResolutionY;
104 double dMetersetExposure;
105 double dAcqAdjustment;
106 double dCTProjectionAngle;
107 double dCTNormChamber;
108 double dGatingTimeTag;
109 double dGating4DInfoX;
110 double dGating4DInfoY;
111 double dGating4DInfoZ;
112 double dGating4DInfoTime;
115 HndImageIO() : Superclass() {}
117 /** Method for creation through the object factory. */
120 /** Run-time type information (and related methods). */
121 itkTypeMacro(HndImageIO, itk::ImageIOBase);
123 /*-------- This part of the interface deals with reading data. ------ */
124 virtual void ReadImageInformation();
126 virtual bool CanReadFile( const char* FileNameToRead );
128 virtual void Read(void * buffer);
130 /*-------- This part of the interfaces deals with writing data. ----- */
131 virtual void WriteImageInformation(bool /*keepOfStream*/) { }
133 virtual void WriteImageInformation() { WriteImageInformation(false); }
135 virtual bool CanWriteFile(const char* filename);
137 virtual void Write(const void* buffer);
139 }; // end class HndImageIO
143 #endif /* end #define __rtkHndImageIO_h */