ITK  5.4.0
Insight Toolkit
itkMINCImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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  *=========================================================================*/
27 #ifndef itkMINCImageIO_h
28 #define itkMINCImageIO_h
29 
30 #include "itkImageIOBase.h"
31 
32 #include "itkMatrix.h"
33 
34 #include "ITKIOMINCExport.h"
35 #include <memory> // For unique_ptr.
36 
37 namespace itk
38 {
39 
40 // Structure for "Pointer to Implementation" or "Private
41 // Implementation" to hide MINC data from the ITK interface.
42 struct ITKIOMINC_HIDDEN MINCImageIOPImpl;
43 
71 class ITKIOMINC_EXPORT MINCImageIO : public ImageIOBase
72 {
73 public:
74  ITK_DISALLOW_COPY_AND_MOVE(MINCImageIO);
75 
77  using Self = MINCImageIO;
81 
83  itkNewMacro(Self);
84 
86  itkOverrideGetNameOfClassMacro(MINCImageIO);
87 
89  bool
90  SupportsDimension(unsigned long dim) override
91  {
92  return dim < 4;
93  }
94 
95  /*-------- This part of the interface deals with reading data. ------ */
96 
99  bool
100  CanReadFile(const char *) override;
101 
103  void
104  ReadImageInformation() override;
105 
107  void
108  Read(void * buffer) override;
109 
110  /*-------- This part of the interfaces deals with writing data. ----- */
111 
114  bool
115  CanWriteFile(const char *) override;
116 
119  void
120  WriteImageInformation() override;
121 
124  void
125  Write(const void * buffer) override;
126 
127 protected:
128  MINCImageIO();
129  ~MINCImageIO() override;
130 
131  void
132  PrintSelf(std::ostream & os, Indent indent) const override;
133 
134  void
135  WriteSlice(std::string & fileName, const void * buffer);
136 
139  void
140  AllocateDimensions(int nDims);
141 
143  void
144  CleanupDimensions();
145 
147  void
148  CloseVolume();
149 
150 private:
151  const std::unique_ptr<MINCImageIOPImpl> m_MINCPImpl;
152 
153  MatrixType m_DirectionCosines{};
154 
155  // complex type images, composed of complex numbers
156  // int m_Complex;
157 };
158 } // end namespace itk
159 
160 #endif // itkMINCImageIO_h
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itkMatrix.h
itk::MINCImageIO::m_MINCPImpl
const std::unique_ptr< MINCImageIOPImpl > m_MINCPImpl
Definition: itkMINCImageIO.h:151
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MINCImageIOPImpl
struct ITKIOMINC_HIDDEN MINCImageIOPImpl
Definition: itkMINCImageIO.h:42
itk::MINCImageIO::SupportsDimension
bool SupportsDimension(unsigned long dim) override
Definition: itkMINCImageIO.h:90
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::MINCImageIO
Class that defines how to read MINC file format.
Definition: itkMINCImageIO.h:71
itkImageIOBase.h
itk::Matrix< float, 3, 3 >
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61