ITK  4.10.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 <itk_minc2.h>
35 
36 #include "ITKIOMINCExport.h"
37 
38 namespace itk
39 {
64 class ITKIOMINC_EXPORT MINCImageIO : public ImageIOBase
65 {
66 public:
68  typedef MINCImageIO Self;
72 
74  itkNewMacro(Self);
75 
77  itkTypeMacro(MINCImageIO, Superclass);
78 
80  virtual bool SupportsDimension(unsigned long dim) ITK_OVERRIDE
81  {
82  return dim<4;
83  }
84 
87  itkSetMacro(CompressionLevel, int);
88  itkGetConstMacro(CompressionLevel, int);
90 
91  /*-------- This part of the interface deals with reading data. ------ */
92 
95  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
96 
98  virtual void ReadImageInformation() ITK_OVERRIDE;
99 
101  virtual void Read(void *buffer) ITK_OVERRIDE;
102 
103  /*-------- This part of the interfaces deals with writing data. ----- */
104 
107  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
108 
111  virtual void WriteImageInformation() ITK_OVERRIDE;
112 
115  virtual void Write(const void *buffer) ITK_OVERRIDE;
116 
117 protected:
118  MINCImageIO();
119  ~MINCImageIO();
120  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
121 
122  void WriteSlice(std::string & fileName, const void *buffer);
123 
124  int m_NDims; /*Number of dimensions*/
125 
126  // dimension size and start and step, in FILE ORDER!
127 
129  misize_t *m_DimensionSize;
132  int m_DimensionIndices[5];
133  midimhandle_t *m_MincFileDims;
134  midimhandle_t *m_MincApparentDims;
135  mitype_t m_Volume_type;
136  miclass_t m_Volume_class;
138 
139  // MINC2 volume handle , currently opened
140  mihandle_t m_Volume;
141 
142  MatrixType m_DirectionCosines;
143  // complex type images, composed of complex numbers
144  //int m_Complex;
145 
146  // will assign m_NDims and allocate all internal buffers to hold the
147  // information
148  void AllocateDimensions(int nDims);
149 
150  // cleanup internal buffers
151  void CleanupDimensions();
152 
153  // close existing volume, cleanup internal structures
154  void CloseVolume();
155 
156 private:
157  MINCImageIO(const Self &) ITK_DELETE_FUNCTION;
158  void operator=(const Self &) ITK_DELETE_FUNCTION;
159 
160 };
161 } // end namespace itk
162 
163 #endif // itkMINCImageIO_h
double * m_DimensionStep
Abstract superclass defines image IO interface.
SmartPointer< Self > Pointer
Class that defines how to read MINC file format.
midimhandle_t * m_MincApparentDims
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
Definition: itkArray.h:30
Matrix< float, 3, 3 > MatrixType
virtual bool SupportsDimension(unsigned long dim) override
MatrixType m_DirectionCosines
ImageIOBase Superclass
double * m_DimensionStart
mitype_t m_Volume_type
Control indentation during Print() invocation.
Definition: itkIndent.h:49
mihandle_t m_Volume
MINCImageIO Self
midimhandle_t * m_MincFileDims
miclass_t m_Volume_class
misize_t * m_DimensionSize