ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkNiftiImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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 __itkNiftiImageIO_h
20 #define __itkNiftiImageIO_h
21 #include "ITKIONIFTIExport.h"
22 
23 
24 #include <fstream>
25 #include "itkImageIOBase.h"
26 #include <nifti1_io.h>
27 
28 namespace itk
29 {
42 class ITKIONIFTI_EXPORT NiftiImageIO:public ImageIOBase
43 {
44 public:
46  typedef NiftiImageIO Self;
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(NiftiImageIO, Superclass);
55 
56  //-------- This part of the interfaces deals with reading data. -----
57 
64  virtual bool CanReadFile(const char *FileNameToRead) ITK_OVERRIDE;
65 
67  virtual void ReadImageInformation() ITK_OVERRIDE;
68 
70  virtual void Read(void *buffer) ITK_OVERRIDE;
71 
72  //-------- This part of the interfaces deals with writing data. -----
73 
80  virtual bool CanWriteFile(const char *FileNameToWrite) ITK_OVERRIDE;
81 
87  virtual void WriteImageInformation() ITK_OVERRIDE;
88 
91  virtual void Write(const void *buffer) ITK_OVERRIDE;
92 
95  virtual ImageIORegion
96  GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requestedRegion) const ITK_OVERRIDE;
97 
103  itkSetMacro(LegacyAnalyze75Mode, bool);
104  itkGetConstMacro(LegacyAnalyze75Mode, bool);
106 
107 protected:
108  NiftiImageIO();
109  ~NiftiImageIO();
110  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
111 
112  virtual bool GetUseLegacyModeForTwoFileWriting(void) const { return false; }
113 
114 private:
115  bool MustRescale();
116 
117  void DefineHeaderObjectDataType();
118 
119  void SetNIfTIOrientationFromImageIO(unsigned short int origdims, unsigned short int dims);
120 
121  void SetImageIOOrientationFromNIfTI(unsigned short int dims);
122 
123  void SetImageIOMetadataFromNIfTI();
124 
125  nifti_image *m_NiftiImage;
126 
129 
131 
133 
134  NiftiImageIO(const Self &); //purposely not implemented
135  void operator=(const Self &); //purposely not implemented
136 };
137 } // end namespace itk
138 
139 #endif // __itkNiftiImageIO_h
Light weight base class for most itk classes.
An ImageIORegion represents a structured region of data.
Abstract superclass defines image IO interface.
NiftiImageIO Self
Class that defines how to read Nifti file format. Nifti IMAGE FILE FORMAT - As much information as I ...
nifti_image * m_NiftiImage
IOComponentType m_OnDiskComponentType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageIOBase Superclass
Base class for most ITK classes.
Definition: itkObject.h:57
SmartPointer< Self > Pointer