ITK  5.2.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  * 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 {
59 class ITKIOMRC_EXPORT MRCImageIO : public StreamingImageIOBase
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
78  {}
79 
80  //-------- This part of the interface deals with reading data. ------
81 
82  // See super class for documentation
83  bool
84  CanReadFile(const char *) override;
85 
86  // See super class for documentation
87  void
88  ReadImageInformation() override;
89 
90  // See super class for documentation
91  void
92  Read(void * buffer) override;
93 
94  // -------- This part of the interfaces deals with writing data. -----
95 
102  bool
103  CanWriteFile(const char *) override;
104 
105  // see super class for documentation
106  void
107  Write(const void * buffer) override;
108 
113  static const char * m_MetaDataHeaderName;
114 
115 protected:
116  MRCImageIO();
117  // ~MRCImageIO(); // default works
118  void
119  PrintSelf(std::ostream & os, Indent indent) const override;
120 
125  SizeType
126  GetHeaderSize() const override;
127 
128 private:
129  // internal methods to update the min and max in the header based on
130  // the data, in the image buffer to be written
131  template <typename TPixelType>
132  void
133  UpdateHeaderWithMinMaxMean(const TPixelType * bufferBegin);
134 
135  void
136  UpdateHeaderWithMinMaxMean(const void * bufferBegin);
137 
138  // internal methods to update the header object from the ImageIO's
139  // set member variables
140  void
141  UpdateHeaderFromImageIO();
142 
143  // reimplemented
144  void
145  InternalReadImageInformation(std::ifstream & is);
146 
147  virtual void
148  WriteImageInformation(const void * bufferBegin);
149 
151 };
152 } // namespace itk
153 
154 #endif
itk::MRCImageIO::WriteImageInformation
void WriteImageInformation() override
Definition: itkMRCImageIO.h:77
itkStreamingImageIOBase.h
itk::StreamingImageIOBase
A base class for specific ImageIO file formats which support streaming.
Definition: itkStreamingImageIOBase.h:52
itk::MRCImageIO::m_MRCHeader
MRCHeaderObject::Pointer m_MRCHeader
Definition: itkMRCImageIO.h:150
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:59
itk::MRCImageIO::m_MetaDataHeaderName
static const char * m_MetaDataHeaderName
Definition: itkMRCImageIO.h:113
itk::ImageIOBase::SizeType
::itk::intmax_t SizeType
Definition: itkImageIOBase.h:393
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itkMRCHeaderObject.h
itk::MRCImageIO
An ImageIO class to read the MRC file format. The MRC file format frequently has the extension "....
Definition: itkMRCImageIO.h:59