ITK  5.2.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  * 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 itkPNGImageIO_h
19 #define itkPNGImageIO_h
20 #include "ITKIOPNGExport.h"
21 
22 
23 #include "itkImageIOBase.h"
24 
25 namespace itk
26 {
39 class ITKIOPNG_EXPORT PNGImageIO : public ImageIOBase
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(PNGImageIO);
43 
45  using Self = PNGImageIO;
48 
50  using PaletteType = std::vector<RGBPixelType>;
51 
53  itkNewMacro(Self);
54 
56  itkTypeMacro(PNGImageIO, ImageIOBase);
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  }
74 
75  /*-------- This part of the interface deals with reading data. ------ */
76 
79  bool
80  CanReadFile(const char *) override;
81 
83  void
84  ReadImageInformation() override;
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
104  WriteImageInformation() override;
105 
108  void
109  Write(const void * buffer) override;
110 
111 protected:
112  PNGImageIO();
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 * buffer);
119 
120 
122 };
123 } // end namespace itk
124 
125 #endif // itkPNGImageIO_h
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itk::RGBPixel
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:58
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::PNGImageIO::SetColorPalette
void SetColorPalette(const PaletteType _arg)
Definition: itkPNGImageIO.h:65
itk::PNGImageIO
ImageIO object for reading and writing PNG images.
Definition: itkPNGImageIO.h:39
itkImageIOBase.h
itk::PNGImageIO::m_ColorPalette
PaletteType m_ColorPalette
Definition: itkPNGImageIO.h:121
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
itk::PNGImageIO::PaletteType
std::vector< RGBPixelType > PaletteType
Definition: itkPNGImageIO.h:50
fileName
std::string fileName
Definition: itkTestDriverInclude.h:118