ITK  5.4.0
Insight Toolkit
itkMRCImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 : public StreamingImageIOBase
59 {
60 public:
61  ITK_DISALLOW_COPY_AND_MOVE(MRCImageIO);
62 
64  using Self = MRCImageIO;
67 
69  itkNewMacro(Self);
70 
72  itkOverrideGetNameOfClassMacro(MRCImageIO);
73 
74  // we don't use this method
75  void
77  {}
78 
79  //-------- This part of the interface deals with reading data. ------
80 
81  // See super class for documentation
82  bool
83  CanReadFile(const char *) override;
84 
85  // See super class for documentation
86  void
87  ReadImageInformation() override;
88 
89  // See super class for documentation
90  void
91  Read(void * buffer) override;
92 
93  // -------- This part of the interfaces deals with writing data. -----
94 
101  bool
102  CanWriteFile(const char *) override;
103 
104  // see super class for documentation
105  void
106  Write(const void * buffer) override;
107 
112  static const char * m_MetaDataHeaderName;
113 
114 protected:
115  MRCImageIO();
116  // ~MRCImageIO(); // default works
117  void
118  PrintSelf(std::ostream & os, Indent indent) const override;
119 
124  SizeType
125  GetHeaderSize() const override;
126 
127 private:
128  // internal methods to update the min and max in the header based on
129  // the data, in the image buffer to be written
130  template <typename TPixelType>
131  void
132  UpdateHeaderWithMinMaxMean(const TPixelType * bufferBegin);
133 
134  void
135  UpdateHeaderWithMinMaxMean(const void * bufferBegin);
136 
137  // internal methods to update the header object from the ImageIO's
138  // set member variables
139  void
140  UpdateHeaderFromImageIO();
141 
142  // reimplemented
143  void
144  InternalReadImageInformation(std::ifstream & file);
145 
146  virtual void
147  WriteImageInformation(const void * buffer);
148 
150 };
151 } // namespace itk
152 
153 #endif
itk::MRCImageIO::WriteImageInformation
void WriteImageInformation() override
Definition: itkMRCImageIO.h:76
itkStreamingImageIOBase.h
itk::StreamingImageIOBase
A base class for specific ImageIO file formats which support streaming.
Definition: itkStreamingImageIOBase.h:52
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::MRCImageIO::m_MetaDataHeaderName
static const char * m_MetaDataHeaderName
Definition: itkMRCImageIO.h:112
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageIOBase::SizeType
itk::intmax_t SizeType
Definition: itkImageIOBase.h:395
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itkMRCHeaderObject.h
itk::MRCImageIO
An ImageIO class to read the MRC file format. The MRC file format frequently has the extension "....
Definition: itkMRCImageIO.h:58