ITK  4.13.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:
39  typedef PNGImageIO Self;
42 
44  typedef std::vector< RGBPixelType > PaletteType;
45 
47  itkNewMacro(Self);
48 
50  itkTypeMacro(PNGImageIO, ImageIOBase);
51 
54  itkSetMacro(CompressionLevel, int);
55  itkGetConstMacro(CompressionLevel, int);
57 
61  itkGetConstReferenceMacro(ColorPalette, PaletteType);
62 
63  /*-------- This part of the interface deals with reading data. ------ */
64 
67  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
68 
70  virtual void ReadImageInformation() ITK_OVERRIDE;
71 
73  virtual void Read(void *buffer) ITK_OVERRIDE;
74 
76  virtual void ReadVolume(void *buffer);
77 
78  /*-------- This part of the interfaces deals with writing data. ----- */
79 
82  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
83 
86  virtual void WriteImageInformation() ITK_OVERRIDE;
87 
90  virtual void Write(const void *buffer) ITK_OVERRIDE;
91 
92 protected:
93  PNGImageIO();
94  ~PNGImageIO() ITK_OVERRIDE;
95  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
96 
97  void WriteSlice(const std::string & fileName, const void *buffer);
98 
101  int m_CompressionLevel;
102 
103  PaletteType m_ColorPalette;
104 
105 private:
106  ITK_DISALLOW_COPY_AND_ASSIGN(PNGImageIO);
107 };
108 } // end namespace itk
109 
110 #endif // itkPNGImageIO_h
Light weight base class for most itk classes.
Abstract superclass defines image IO interface.
std::vector< RGBPixelType > PaletteType
Definition: itkPNGImageIO.h:44
SmartPointer< Self > Pointer
Definition: itkPNGImageIO.h:41
ImageIO object for reading and writing PNG images.
Definition: itkPNGImageIO.h:35
RGBPixel< unsigned char > RGBPixelType
Definition: itkPNGImageIO.h:43
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:58
PNGImageIO Self
Definition: itkPNGImageIO.h:39
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageIOBase Superclass
Definition: itkPNGImageIO.h:40