VTK  9.7.1
vtkPNGReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkPNGReader_h
23 #define vtkPNGReader_h
24 
25 #include "vtkIOImageModule.h" // For export macro
26 #include "vtkImageReader2.h"
27 #include "vtkSmartPointer.h" // For vtkSmartPointer
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkStringArray;
31 VTK_ABI_NAMESPACE_END
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class VTKIOIMAGE_EXPORT vtkPNGReader : public vtkImageReader2
35 {
36 public:
37  static vtkPNGReader* New();
38  vtkTypeMacro(vtkPNGReader, vtkImageReader2);
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
48  int CanReadFile(VTK_FILEPATH const char* fname) override;
49  int CanReadFile(vtkResourceStream* stream) override;
51 
57  const char* GetFileExtensions() override { return ".png"; }
58 
62  const char* GetDescriptiveName() override { return "PNG"; }
63 
69  void GetTextChunks(const char* key, int beginEndIndex[2]);
70 
72 
75  const char* GetTextKey(int index);
76  vtkStringArray* GetTextKeys();
78 
80 
85  const char* GetTextValue(int index);
86  vtkStringArray* GetTextValues();
88 
93  size_t GetNumberOfTextChunks();
94 
96 
101  vtkSetMacro(ReadSpacingFromFile, bool);
102  vtkGetMacro(ReadSpacingFromFile, bool);
103  vtkBooleanMacro(ReadSpacingFromFile, bool);
105 protected:
106  vtkPNGReader();
107  ~vtkPNGReader() override;
108 
109  void ExecuteInformation() override;
110  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
111  template <class OT>
112  void vtkPNGReaderUpdate(vtkImageData* data, OT* outPtr);
113  template <class OT>
114  void vtkPNGReaderUpdate2(OT* outPtr, int* outExt, vtkIdType* outInc, long pixSize);
115 
116 private:
117  vtkPNGReader(const vtkPNGReader&) = delete;
118  void operator=(const vtkPNGReader&) = delete;
119 
120  class vtkInternals;
121  vtkInternals* Internals;
122  bool ReadSpacingFromFile;
123 };
124 VTK_ABI_NAMESPACE_END
125 #endif
Abstract class used for custom streams.
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
a vtkAbstractArray subclass for strings
int vtkIdType
Definition: vtkType.h:363
const char * GetFileExtensions() override
Get the file extensions for this format.
Definition: vtkPNGReader.h:57
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
a simple class to control print indentation
Definition: vtkIndent.h:28
read PNG files
Definition: vtkPNGReader.h:34
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual void ExecuteInformation()
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkPNGReader.h:62
Superclass of binary file readers.
#define VTK_FILEPATH
virtual int CanReadFile(const char *fname)
Return non zero if the reader can read the given file name.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:55
Set of utilities for OpenTURNS<->VTK conversions.
Definition: vtkOTFilter.h:20