NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkNiftiImageIO3201.h
Go to the documentation of this file.
1 /**************************************************************************
2  * NifTK Note: This is take from ITK 3.20.1 (hence the name), which was
3  * the version of ITK used within NifTK at the time of writing. The
4  * version 3.20.1 actually signified a patched version of ITK, and
5  * the patched tar file and patch can be seen in:
6  * NifTK/CMake/ExternalProjects/ITK.cmake and
7  * NifTK/CMake/ExternalProjects/PatchITK-3.20.cmake
8  * However, none of this patching affects the Nifti reader, so the base
9  * version of the Nifti reader used for this class is the same as in 3.20.0.
10  *
11  * The changes supplied here are to include the sform in the transformation.
12  **************************************************************************/
13 
14 /*=========================================================================
15 
16  Program: Insight Segmentation & Registration Toolkit
17  Module: itkNiftiImageIO.h
18  Language: C++
19  Date: $Date$
20  Version: $Revision$
21 
22  Copyright (c) Insight Software Consortium. All rights reserved.
23  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
24 
25  This software is distributed WITHOUT ANY WARRANTY; without even
26  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27  PURPOSE. See the above copyright notices for more information.
28 
29 =========================================================================*/
30 
38 #ifndef itkNiftiImageIO3201_h
39 #define itkNiftiImageIO3201_h
40 
41 #ifdef _MSC_VER
42 #pragma warning ( disable : 4786 )
43 #endif
44 
45 #include <fstream>
46 #include <itkImageIOBase.h>
47 #include <nifti1_io.h>
49 
50 namespace itk
51 {
52 
61 class NIFTKITKIO_WINEXPORT ITK_EXPORT NiftiImageIO3201 : public ImageIOBase
62 {
63 public:
66  typedef ImageIOBase Superclass;
67  typedef SmartPointer<Self> Pointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(NiftiImageIO3201, Superclass);
74 
75  /*-------- This part of the interfaces deals with reading data. ----- */
76 
83  virtual bool CanReadFile(const char* FileNameToRead) override;
84 
86  virtual void ReadImageInformation() override;
87 
89  virtual void Read(void* buffer) override;
90 
91  /*-------- This part of the interfaces deals with writing data. ----- */
92 
99  virtual bool CanWriteFile(const char * FileNameToWrite) override;
100 
102  virtual void WriteImageInformation() override;
103 
106  virtual void Write(const void* buffer) override;
107 
110  virtual ImageIORegion
111  GenerateStreamableReadRegionFromRequestedRegion( const ImageIORegion & requestedRegion ) const override;
112 
118  itkSetMacro(LegacyAnalyze75Mode,bool);
119  itkGetConstMacro(LegacyAnalyze75Mode,bool);
120 
125  virtual bool SupportsDimension(unsigned long dim) override;
126 
127 protected:
129  ~NiftiImageIO3201();
130  void PrintSelf(std::ostream& os, Indent indent) const override;
131  virtual bool GetUseLegacyModeForTwoFileWriting(void) const { return false; }
132 private:
133  bool MustRescale();
134  void DefineHeaderObjectDataType();
135  void SetNIfTIOrientationFromImageIO(unsigned short int origdims, unsigned short int dims);
136  void SetImageIOOrientationFromNIfTI(unsigned short int dims);
137  void SetImageIOMetadataFromNIfTI();
138 
139  nifti_image * m_NiftiImage;
140  double m_RescaleSlope;
141  double m_RescaleIntercept;
142  IOComponentType m_OnDiskComponentType;
143  bool m_LegacyAnalyze75Mode;
144 
145  NiftiImageIO3201(const Self&); //purposely not implemented
146  void operator=(const Self&); //purposely not implemented
147 };
148 
149 } // end namespace itk
150 
151 #endif
ImageIOBase Superclass
Definition: itkNiftiImageIO3201.h:66
SmartPointer< Self > Pointer
Definition: itkNiftiImageIO3201.h:67
Definition: niftkITKAffineResampleImage.cxx:74
virtual bool GetUseLegacyModeForTwoFileWriting(void) const
Definition: itkNiftiImageIO3201.h:131
Class that defines how to read Nifti file format. Nifti IMAGE FILE FORMAT - As much information as I ...
Definition: itkNiftiImageIO3201.h:61
NiftiImageIO3201 Self
Definition: itkNiftiImageIO3201.h:65
GLuint buffer
Definition: glew.h:1664
#define NIFTKITKIO_WINEXPORT
Definition: niftkITKIOWin32ExportHeader.h:28