VTK  9.3.20240417
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
129 #ifndef vtkPNGReader_h
130 #define vtkPNGReader_h
131 
132 #include "vtkIOImageModule.h" // For export macro
133 #include "vtkImageReader2.h"
134 #include "vtkSmartPointer.h" // For vtkSmartPointer
135 
136 VTK_ABI_NAMESPACE_BEGIN
137 class vtkStringArray;
138 VTK_ABI_NAMESPACE_END
139 
140 VTK_ABI_NAMESPACE_BEGIN
141 class VTKIOIMAGE_EXPORT vtkPNGReader : public vtkImageReader2
142 {
143 public:
144  static vtkPNGReader* New();
146  void PrintSelf(ostream& os, vtkIndent indent) override;
147 
151  int CanReadFile(VTK_FILEPATH const char* fname) override;
152 
158  const char* GetFileExtensions() override { return ".png"; }
159 
163  const char* GetDescriptiveName() override { return "PNG"; }
164 
170  void GetTextChunks(const char* key, int beginEndIndex[2]);
171 
173 
176  const char* GetTextKey(int index);
179 
181 
186  const char* GetTextValue(int index);
189 
195 
197 
202  vtkSetMacro(ReadSpacingFromFile, bool);
203  vtkGetMacro(ReadSpacingFromFile, bool);
204  vtkBooleanMacro(ReadSpacingFromFile, bool);
206 protected:
208  ~vtkPNGReader() override;
209 
210  void ExecuteInformation() override;
212  template <class OT>
214  template <class OT>
215  void vtkPNGReaderUpdate2(OT* outPtr, int* outExt, vtkIdType* outInc, long pixSize);
216 
217 private:
218  vtkPNGReader(const vtkPNGReader&) = delete;
219  void operator=(const vtkPNGReader&) = delete;
220 
221  class vtkInternals;
222  vtkInternals* Internals;
223  bool ReadSpacingFromFile;
224 };
225 VTK_ABI_NAMESPACE_END
226 #endif
general representation of visualization data
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
Superclass of binary file readers.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store vtkAlgorithm input/output information.
read PNG files
Definition: vtkPNGReader.h:142
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkPNGReader.h:163
vtkStringArray * GetTextKeys()
Returns the text key stored at 'index'.
static vtkPNGReader * New()
const char * GetTextValue(int index)
Returns the text value stored at 'index'.
void ExecuteInformation() override
size_t GetNumberOfTextChunks()
Return the number of text chunks in the PNG file.
const char * GetFileExtensions() override
Get the file extensions for this format.
Definition: vtkPNGReader.h:158
const char * GetTextKey(int index)
Returns the text key stored at 'index'.
void vtkPNGReaderUpdate(vtkImageData *data, OT *outPtr)
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStringArray * GetTextValues()
Returns the text value stored at 'index'.
void vtkPNGReaderUpdate2(OT *outPtr, int *outExt, vtkIdType *outInc, long pixSize)
void GetTextChunks(const char *key, int beginEndIndex[2])
Given a 'key' for the text chunks, fills in 'beginEndIndex' with the begin and end indexes.
~vtkPNGReader() override
int CanReadFile(VTK_FILEPATH const char *fname) override
Is the given file a PNG file?
a vtkAbstractArray subclass for strings
Set of utilities for OpenTURNS<->VTK conversions.
Definition: vtkOTFilter.h:21
@ key
Definition: vtkX3D.h:257
@ index
Definition: vtkX3D.h:246
@ data
Definition: vtkX3D.h:315
int vtkIdType
Definition: vtkType.h:315
#define VTK_FILEPATH