ITK  6.0.0
Insight Toolkit
itkPNGImageIO.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 itkPNGImageIO_h
19#define itkPNGImageIO_h
20#include "ITKIOPNGExport.h"
21
22
23#include "itkImageIOBase.h"
24
25namespace itk
26{
39class ITKIOPNG_EXPORT PNGImageIO : public ImageIOBase
40{
41public:
42 ITK_DISALLOW_COPY_AND_MOVE(PNGImageIO);
43
48
50 using PaletteType = std::vector<RGBPixelType>;
51
53 itkNewMacro(Self);
54
56 itkOverrideGetNameOfClassMacro(PNGImageIO);
57
61 itkGetConstReferenceMacro(ColorPalette, PaletteType);
62
64 void
66 {
67 if (this->m_ColorPalette != _arg)
68 {
69 this->m_ColorPalette = _arg;
70 this->Modified();
71 }
72 }
75 /*-------- This part of the interface deals with reading data. ------ */
76
79 bool
80 CanReadFile(const char *) override;
81
83 void
85
87 void
88 Read(void * buffer) override;
89
91 virtual void
92 ReadVolume(void * buffer);
93
94 /*-------- This part of the interfaces deals with writing data. ----- */
95
98 bool
99 CanWriteFile(const char *) override;
100
103 void
105
108 void
109 Write(const void * buffer) override;
110
111protected:
113 ~PNGImageIO() override;
114 void
115 PrintSelf(std::ostream & os, Indent indent) const override;
116
117 void
118 WriteSlice(const std::string & fileName, const void * const buffer);
119
120
121 PaletteType m_ColorPalette{};
122};
123} // end namespace itk
124
125#endif // itkPNGImageIO_h
Abstract superclass defines image IO interface.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
ImageIO object for reading and writing PNG images.
Definition: itkPNGImageIO.h:40
void ReadImageInformation() override
void Write(const void *buffer) override
void PrintSelf(std::ostream &os, Indent indent) const override
bool CanWriteFile(const char *) override
void WriteSlice(const std::string &fileName, const void *const buffer)
~PNGImageIO() override
bool CanReadFile(const char *) override
virtual void ReadVolume(void *buffer)
void Read(void *buffer) override
void SetColorPalette(const PaletteType _arg)
Definition: itkPNGImageIO.h:65
void WriteImageInformation() override
std::vector< RGBPixelType > PaletteType
Definition: itkPNGImageIO.h:50
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:59
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....