NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkAnalyzeImageIO3160_p.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkAnalyzeImageIO.h,v $
5  Language: C++
6  Date: $Date: 2011-09-08 16:23:32 +0100 (Thu, 08 Sep 2011) $
7  Version: $Revision: 7267 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 /**************************************************************************
19  * NifTK Note: This is take from ITK 3.16.0 (hence the name).
20  * It is a cut and paste with a name change, as the spec changed between
21  * ITK version 3.16.0 and 3.20.0. The version in 3.20.0 additionally checks
22  * fields like the vox_offset, which at the DRC are incorrectly set. This
23  * version taken from ITK version 3.16.0, and the derived subclass called
24  * itkDRCAnalyzeImageIO3160.h were are used, even though it is older.
25  **************************************************************************/
38 #ifndef itkAnalyzeImageIO3160_h
39 #define itkAnalyzeImageIO3160_h
40 
41 #ifdef _MSC_VER
42 #pragma warning ( disable : 4786 )
43 #endif
44 
45 #include <fstream>
46 #include <itkImageIOBase.h>
47 #include "itkAnalyzeDbh_p.h"
48 
49 namespace itk
50 {
102 class AnalyzeImageIO3160 : public ImageIOBase
103 {
104 public:
107  typedef ImageIOBase Superclass;
108  typedef SmartPointer<Self> Pointer;
109 
111  itkNewMacro(Self);
112 
114  itkTypeMacro(AnalyzeImageIO3160, Superclass);
115 
116  /*-------- This part of the interfaces deals with reading data. ----- */
117 
124  virtual bool CanReadFile(const char* FileNameToRead) override;
125 
127  virtual void ReadImageInformation() override;
128 
130  virtual void Read(void* buffer) override;
131 
132  /*-------- This part of the interfaces deals with writing data. ----- */
133 
140  virtual bool CanWriteFile(const char * FileNameToWrite) override;
141 
143  virtual void WriteImageInformation() override;
144 
147  virtual void Write(const void* buffer) override;
148 
150  virtual std::vector<double> GetDirection(unsigned int i) const override;
151 
154  virtual std::vector<double> GetDefaultDirection(unsigned int i) const override;
155 
156 
157 protected:
160  void PrintSelf(std::ostream& os, Indent indent) const override;
161 private:
177  typedef enum
178  {
179  ITK_ANALYZE_ORIENTATION_RPI_TRANSVERSE=0,
180  ITK_ANALYZE_ORIENTATION_RIP_CORONAL =1,
181  ITK_ANALYZE_ORIENTATION_PIR_SAGITTAL =2,
182  ITK_ANALYZE_ORIENTATION_RAI_TRANSVERSE_FLIPPED=3,
183  ITK_ANALYZE_ORIENTATION_RSP_CORONAL_FLIPPED=4,
184  ITK_ANALYZE_ORIENTATION_PIL_SAGITTAL_FLIPPED=5
185  } ValidAnalyzeOrientationFlags;
186 
187 
188 AnalyzeImageIO3160(const Self&); //purposely not implemented
189 void operator=(const Self&); //purposely not implemented
190 void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
197 void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
198 
204 void DefineHeaderObjectDataType(void);
205 #if defined(REORIENT_IMAGES)
206 void ReorientIfNecessary(char *p);
207 struct ipl_dimensions
208  {
209  unsigned int slicestride;
210  unsigned int rowstride;
211  unsigned int componentstride;x
212  unsigned int pixelsize;
213  //
214  // xsize,ysize,zsize == size in each direction in pixesls
215  unsigned int xsize;
216  unsigned int ysize;
217  unsigned int zsize;
218  };
226 void GetAllDimensions(ipl_dimensions &dim);
227 ipl_dimensions m_OldDim,m_NewDim;
228 #endif
229 
235 ImageIOBase::ByteOrder CheckAnalyzeEndian(const struct dsr &temphdr);
236 
238 struct dsr m_Hdr;
239 ImageIOBase::ByteOrder m_MachineByteOrder;
240 
242 static const char *const ANALYZE_ScanNumber;
243 static const char *const ANALYZE_O_MAX;
244 static const char *const ANALYZE_O_MIN;
245 static const char *const ANALYZE_S_MAX;
246 static const char *const ANALYZE_S_MIN;
247 static const char *const ANALYZE_CAL_MAX;
248 static const char *const ANALYZE_CAL_MIN;
249 static const char *const ANALYZE_GLMAX;
250 static const char *const ANALYZE_GLMIN;
251 static const char *const ANALYZE_AUX_FILE_NAME;
252 static const char *const ANALYZE_CALIBRATIONUNITS;
253 
254 };
255 
256 } // end namespace itk
257 
258 #endif
virtual void Read(void *buffer) override
Definition: itkAnalyzeImageIO3160.cxx:653
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkAnalyzeImageIO3160.cxx:512
virtual std::vector< double > GetDefaultDirection(unsigned int i) const override
Definition: itkAnalyzeImageIO3160.cxx:1417
virtual bool CanReadFile(const char *FileNameToRead) override
Definition: itkAnalyzeImageIO3160.cxx:720
~AnalyzeImageIO3160()
Definition: itkAnalyzeImageIO3160.cxx:507
Definition: niftkITKAffineResampleImage.cxx:74
SmartPointer< Self > Pointer
Definition: itkAnalyzeImageIO3160_p.h:108
GLfloat GLfloat p
Definition: glew.h:14169
AnalyzeImageIO3160()
Definition: itkAnalyzeImageIO3160.cxx:379
GLuint buffer
Definition: glew.h:1664
Definition: itkAnalyzeDbh_p.h:384
virtual std::vector< double > GetDirection(unsigned int i) const override
Definition: itkAnalyzeImageIO3160.cxx:1363
virtual void WriteImageInformation() override
Definition: itkAnalyzeImageIO3160.cxx:1129
GLint GLint GLint GLint GLint x
Definition: glew.h:1236
ImageIOBase Superclass
Definition: itkAnalyzeImageIO3160_p.h:107
virtual void ReadImageInformation() override
Definition: itkAnalyzeImageIO3160.cxx:774
virtual void Write(const void *buffer) override
Definition: itkAnalyzeImageIO3160.cxx:1467
AnalyzeImageIO3160 Self
Definition: itkAnalyzeImageIO3160_p.h:106
virtual bool CanWriteFile(const char *FileNameToWrite) override
Definition: itkAnalyzeImageIO3160.cxx:517
Class that defines how to read Analyze file format. Analyze IMAGE FILE FORMAT - As much information a...
Definition: itkAnalyzeImageIO3160_p.h:102