ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkPNGImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
35 class ITKIOPNG_EXPORT PNGImageIO:public ImageIOBase
36 {
37 public:
38  ITK_DISALLOW_COPY_AND_ASSIGN(PNGImageIO);
39 
41  using Self = PNGImageIO;
44 
46  using PaletteType = std::vector< RGBPixelType >;
47 
49  itkNewMacro(Self);
50 
52  itkTypeMacro(PNGImageIO, ImageIOBase);
53 
56  itkSetMacro(CompressionLevel, int);
57  itkGetConstMacro(CompressionLevel, int);
59 
63  itkGetConstReferenceMacro(ColorPalette, PaletteType);
64 
65  /*-------- This part of the interface deals with reading data. ------ */
66 
69  bool CanReadFile(const char *) override;
70 
72  void ReadImageInformation() override;
73 
75  void Read(void *buffer) override;
76 
78  virtual void ReadVolume(void *buffer);
79 
80  /*-------- This part of the interfaces deals with writing data. ----- */
81 
84  bool CanWriteFile(const char *) override;
85 
88  void WriteImageInformation() override;
89 
92  void Write(const void *buffer) override;
93 
94 protected:
95  PNGImageIO();
96  ~PNGImageIO() override;
97  void PrintSelf(std::ostream & os, Indent indent) const override;
98 
99  void WriteSlice(const std::string & fileName, const void *buffer);
100 
103  int m_CompressionLevel{ 4 };
104 
106 };
107 } // end namespace itk
108 
109 #endif // itkPNGImageIO_h
Light weight base class for most itk classes.
Abstract superclass defines image IO interface.
ImageIO object for reading and writing PNG images.
Definition: itkPNGImageIO.h:35
PaletteType m_ColorPalette
std::vector< RGBPixelType > PaletteType
Definition: itkPNGImageIO.h:46
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:58
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60