ITK  6.0.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
25namespace itk
26{
58class ITKIOMRC_EXPORT MRCImageIO : public StreamingImageIOBase
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(MRCImageIO);
62
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
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
114protected:
116 // ~MRCImageIO(); // default works
117 void
118 PrintSelf(std::ostream & os, Indent indent) const override;
119
125 GetHeaderSize() const override;
126
127private:
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
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::intmax_t SizeType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
An ImageIO class to read the MRC file format. The MRC file format frequently has the extension "....
Definition: itkMRCImageIO.h:59
void Read(void *buffer) override
virtual void WriteImageInformation(const void *buffer)
void PrintSelf(std::ostream &os, Indent indent) const override
bool CanReadFile(const char *) override
void UpdateHeaderWithMinMaxMean(const void *bufferBegin)
void WriteImageInformation() override
Definition: itkMRCImageIO.h:76
static const char * m_MetaDataHeaderName
void UpdateHeaderFromImageIO()
void UpdateHeaderWithMinMaxMean(const TPixelType *bufferBegin)
bool CanWriteFile(const char *) override
Returns true if this ImageIO can write the specified file.
void InternalReadImageInformation(std::ifstream &file)
void ReadImageInformation() override
SizeType GetHeaderSize() const override
void Write(const void *buffer) override
Base class for most ITK classes.
Definition: itkObject.h:62
A base class for specific ImageIO file formats which support streaming.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....