ITK  5.0.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:
62  ITK_DISALLOW_COPY_AND_ASSIGN(MRCImageIO);
63 
65  using Self = MRCImageIO;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(MRCImageIO, StreamingImageIOBase);
74 
75  // we don't use this method
76  void WriteImageInformation() override {}
77 
78  //-------- This part of the interface deals with reading data. ------
79 
80  // See super class for documentation
81  bool CanReadFile(const char *) override;
82 
83  // See super class for documentation
84  void ReadImageInformation() override;
85 
86  // See super class for documentation
87  void Read(void *buffer) override;
88 
89  // -------- This part of the interfaces deals with writing data. -----
90 
97  bool CanWriteFile(const char *) override;
98 
99  // see super class for documentation
100  void Write(const void *buffer) override;
101 
106  static const char *m_MetaDataHeaderName;
107 
108 protected:
109  MRCImageIO();
110  // ~MRCImageIO(); // default works
111  void PrintSelf(std::ostream & os, Indent indent) const override;
112 
117  SizeType GetHeaderSize() const override;
118 
119 private:
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 
138 };
139 } // namespace itk
140 
141 #endif
Light weight base class for most itk classes.
MRCHeaderObject::Pointer m_MRCHeader
A base class for specific ImageIO file formats which support streaming.
static const char * m_MetaDataHeaderName
::itk::intmax_t SizeType
An ImageIO class to read the MRC file format. The MRC file format frequently has the extension &quot;...
Definition: itkMRCImageIO.h:58
void WriteImageInformation() override
Definition: itkMRCImageIO.h:76
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60