ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkMRCImageIO.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 #ifndef __itkMRCImageIO_h
19 #define __itkMRCImageIO_h
20 #include "ITKIOMRCExport.h"
22 #include "itkMRCHeaderObject.h"
23 #include <numeric>
24 
25 namespace itk
26 {
58 class ITKIOMRC_EXPORT MRCImageIO :
60 {
61 public:
63  typedef MRCImageIO Self;
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(MRCImageIO, StreamingImageIOBase);
72 
73  // we don't use this method
74  virtual void WriteImageInformation(void) ITK_OVERRIDE {}
75 
76  //-------- This part of the interface deals with reading data. ------
77 
78  // See super class for documentation
79  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
80 
81  // See super class for documentation
82  virtual void ReadImageInformation() ITK_OVERRIDE;
83 
84  // See super class for documentation
85  virtual void Read(void *buffer) ITK_OVERRIDE;
86 
87  // -------- This part of the interfaces deals with writing data. -----
88 
95  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
96 
97  // see super class for documentation
98  virtual void Write(const void *buffer) ITK_OVERRIDE;
99 
104  static const char *m_MetaDataHeaderName;
105 
106 protected:
107  MRCImageIO();
108  // ~MRCImageIO(); // default works
109  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
110 
115  virtual SizeType GetHeaderSize(void) const ITK_OVERRIDE;
116 
117 private:
118 
119  MRCImageIO(const Self &); //purposely not implemented
120  void operator=(const Self &); //purposely not implemented
121 
122  // internal methods to update the min and max in the header based on
123  // the data, in the image buffer to be written
124  template< typename TPixelType >
125  void UpdateHeaderWithMinMaxMean(const TPixelType *bufferBegin);
126 
127  void UpdateHeaderWithMinMaxMean(const void *bufferBegin);
128 
129  // internal methods to update the header object from the ImageIO's
130  // set member variables
131  void UpdateHeaderFromImageIO(void);
132 
133  // reimplemented
134  void InternalReadImageInformation(std::ifstream & is);
135 
136  virtual void WriteImageInformation(const void *bufferBegin);
137 
138  MRCHeaderObject::Pointer m_MRCHeader;
139 };
140 } // namespace itk
141 
142 #endif
Light weight base class for most itk classes.
A base class for specific ImageIO file formats which support streaming.
StreamingImageIOBase Superclass
Definition: itkMRCImageIO.h:64
SmartPointer< Self > Pointer
Definition: itkMRCImageIO.h:65
::itk::intmax_t SizeType
This class is a light wrapper for a couple of plain old data structures, so that they can be utilized...
An ImageIO class to read the MRC file format. The MRC file format frequently has the extension &quot;...
Definition: itkMRCImageIO.h:58
virtual void WriteImageInformation(void) ITK_OVERRIDE
Definition: itkMRCImageIO.h:74
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MRCImageIO Self
Definition: itkMRCImageIO.h:63