ITK  4.13.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  ITK_DISALLOW_COPY_AND_ASSIGN(MRCImageIO);
120 
121  // internal methods to update the min and max in the header based on
122  // the data, in the image buffer to be written
123  template< typename TPixelType >
124  void UpdateHeaderWithMinMaxMean(const TPixelType *bufferBegin);
125 
126  void UpdateHeaderWithMinMaxMean(const void *bufferBegin);
127 
128  // internal methods to update the header object from the ImageIO's
129  // set member variables
130  void UpdateHeaderFromImageIO();
131 
132  // reimplemented
133  void InternalReadImageInformation(std::ifstream & is);
134 
135  virtual void WriteImageInformation(const void *bufferBegin);
136 
137  MRCHeaderObject::Pointer m_MRCHeader;
138 };
139 } // namespace itk
140 
141 #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
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MRCImageIO Self
Definition: itkMRCImageIO.h:63
virtual void WriteImageInformation(void) override
Definition: itkMRCImageIO.h:74