VTK  9.6.20260307
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
130
131#ifndef vtkPNGReader_h
132#define vtkPNGReader_h
133
134#include "vtkIOImageModule.h" // For export macro
135#include "vtkImageReader2.h"
136#include "vtkSmartPointer.h" // For vtkSmartPointer
137
138VTK_ABI_NAMESPACE_BEGIN
139class vtkStringArray;
140VTK_ABI_NAMESPACE_END
141
142VTK_ABI_NAMESPACE_BEGIN
143class VTKIOIMAGE_EXPORT vtkPNGReader : public vtkImageReader2
144{
145public:
146 static vtkPNGReader* New();
148 void PrintSelf(ostream& os, vtkIndent indent) override;
149
151
157 int CanReadFile(VTK_FILEPATH const char* fname) override;
158 int CanReadFile(vtkResourceStream* stream) override;
160
166 const char* GetFileExtensions() override { return ".png"; }
167
171 const char* GetDescriptiveName() override { return "PNG"; }
172
178 void GetTextChunks(const char* key, int beginEndIndex[2]);
179
181
184 const char* GetTextKey(int index);
187
189
194 const char* GetTextValue(int index);
197
203
205
210 vtkSetMacro(ReadSpacingFromFile, bool);
211 vtkGetMacro(ReadSpacingFromFile, bool);
212 vtkBooleanMacro(ReadSpacingFromFile, bool);
214protected:
216 ~vtkPNGReader() override;
217
218 void ExecuteInformation() override;
220 template <class OT>
221 void vtkPNGReaderUpdate(vtkImageData* data, OT* outPtr);
222 template <class OT>
223 void vtkPNGReaderUpdate2(OT* outPtr, int* outExt, vtkIdType* outInc, long pixSize);
224
225private:
226 vtkPNGReader(const vtkPNGReader&) = delete;
227 void operator=(const vtkPNGReader&) = delete;
228
229 class vtkInternals;
230 vtkInternals* Internals;
231 bool ReadSpacingFromFile;
232};
233VTK_ABI_NAMESPACE_END
234#endif
general representation of visualization data
topologically and geometrically regular array of data
vtkImageReader2()
Return a descriptive name for the file format that might be useful in a GUI.
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
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 * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
vtkStringArray * GetTextValues()
Returns the text value 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.
static vtkPNGReader * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int CanReadFile(const char *fname) override
Return 3 if, after a quick check of file header, it looks like the provided file or stream can be rea...
void vtkPNGReaderUpdate2(OT *outPtr, int *outExt, vtkIdType *outInc, long pixSize)
const char * GetTextKey(int index)
Returns the text key stored at 'index'.
void GetTextChunks(const char *key, int beginEndIndex[2])
Given a 'key' for the text chunks, fills in 'beginEndIndex' with the begin and end indexes.
const char * GetFileExtensions() override
Get the file extensions for this format.
int CanReadFile(vtkResourceStream *stream) override
Return 3 if, after a quick check of file header, it looks like the provided file or stream can be rea...
~vtkPNGReader() override
vtkStringArray * GetTextKeys()
Returns the text key stored at 'index'.
Abstract class used for custom streams.
a vtkAbstractArray subclass for strings
Set of utilities for OpenTURNS<->VTK conversions.
Definition vtkOTFilter.h:21
int vtkIdType
Definition vtkType.h:363
#define VTK_FILEPATH