ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMINCImageIO.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  *=========================================================================*/
27 #ifndef itkMINCImageIO_h
28 #define itkMINCImageIO_h
29 
30 #include "itkImageIOBase.h"
31 
32 #include "itkMatrix.h"
33 
34 #include "ITKIOMINCExport.h"
35 
36 namespace itk
37 {
38 
39 // Structure for "Pointer to Implementation" or "Private
40 // Implementation" to hide MINC data from the ITK interface.
41 struct ITKIOMINC_HIDDEN MINCImageIOPImpl;
42 
67 class ITKIOMINC_EXPORT MINCImageIO : public ImageIOBase
68 {
69 public:
71  typedef MINCImageIO Self;
75 
77  itkNewMacro(Self);
78 
80  itkTypeMacro(MINCImageIO, Superclass);
81 
83  virtual bool SupportsDimension(unsigned long dim) ITK_OVERRIDE
84  {
85  return dim<4;
86  }
87 
90  void SetCompressionLevel(int level);
91  int GetCompressionLevel() const;
93 
94  /*-------- This part of the interface deals with reading data. ------ */
95 
98  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
99 
101  virtual void ReadImageInformation() ITK_OVERRIDE;
102 
104  virtual void Read(void *buffer) ITK_OVERRIDE;
105 
106  /*-------- This part of the interfaces deals with writing data. ----- */
107 
110  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
111 
114  virtual void WriteImageInformation() ITK_OVERRIDE;
115 
118  virtual void Write(const void *buffer) ITK_OVERRIDE;
119 
120 protected:
121  MINCImageIO();
122  ~MINCImageIO() ITK_OVERRIDE;
123 
124  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
125 
126  void WriteSlice(std::string & fileName, const void *buffer);
127 
128  // will assign m_NDims and allocate all internal buffers to hold the
129  // information
130  void AllocateDimensions(int nDims);
131 
132  // cleanup internal buffers
133  void CleanupDimensions();
134 
135  // close existing volume, cleanup internal structures
136  void CloseVolume();
137 
138 private:
139 
140  MINCImageIOPImpl *m_MINCPImpl;
141 
142  MatrixType m_DirectionCosines;
143 
144  // complex type images, composed of complex numbers
145  //int m_Complex;
146 
147  ITK_DISALLOW_COPY_AND_ASSIGN(MINCImageIO);
148 
149 };
150 } // end namespace itk
151 
152 #endif // itkMINCImageIO_h
Light weight base class for most itk classes.
Abstract superclass defines image IO interface.
SmartPointer< Self > Pointer
Class that defines how to read MINC file format.
Matrix< float, 3, 3 > MatrixType
virtual bool SupportsDimension(unsigned long dim) override
ImageIOBase Superclass
struct ITKIOMINC_HIDDEN MINCImageIOPImpl
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MINCImageIO Self
Base class for most ITK classes.
Definition: itkObject.h:59