VTK  9.6.20260202
vtkGDALRasterReader.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
26
27#ifndef vtkGDALRasterReader_h
28#define vtkGDALRasterReader_h
29
30#include <vtkIOGDALModule.h> // For export macro
31#include <vtkImageReader2.h>
32
33// C++ includes
34#include <string> // string is required
35#include <vector> // vector is required
36
37VTK_ABI_NAMESPACE_BEGIN
38class VTKIOGDAL_EXPORT vtkGDALRasterReader : public vtkImageReader2
39{
40public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
47
52 int CanReadFile(VTK_FILEPATH const char* fname) override;
53
57 const char* GetProjectionString() const;
58
62 const char* GetProjectionWKT() const { return this->ProjectionWKT.c_str(); }
63
68 const double* GetGeoCornerPoints();
69
75 vtkSetMacro(CollateBands, bool);
76 vtkGetMacro(CollateBands, bool);
77 vtkBooleanMacro(CollateBands, bool);
78
80
83 vtkSetVector2Macro(TargetDimensions, int);
84 vtkGetVector2Macro(TargetDimensions, int);
86
88
93
97 const std::vector<std::string>& GetMetaData();
98
105 double GetInvalidValue(size_t bandIndex = 0, int* hasNoData = nullptr);
106
110 std::vector<std::string> GetDomainMetaData(const std::string& domain);
111
113
116 const std::string& GetDriverShortName();
117 const std::string& GetDriverLongName();
119
124
126
131 const char* GetCellArrayName(int index);
132 int GetCellArrayStatus(const char* name);
133 void SetCellArrayStatus(const char* name, int status);
137
138protected:
140 vtkInformationVector* outputVector) override;
141
143 vtkInformationVector* outputVector) override;
144
145 int FillOutputPortInformation(int port, vtkInformation* info) override;
146
148 std::string Projection;
149 std::string ProjectionWKT;
150 std::string DomainMetaData;
151 std::string DriverShortName;
152 std::string DriverLongName;
153 std::vector<std::string> Domains;
154 std::vector<std::string> MetaData;
156
157 class vtkGDALRasterReaderInternal;
158 vtkGDALRasterReaderInternal* Impl;
159
160private:
162 void operator=(const vtkGDALRasterReader&) = delete;
163};
164
165VTK_ABI_NAMESPACE_END
166#endif // vtkGDALRasterReader_h
void DisableAllCellArrays()
The following methods allow selective reading of bands.
void EnableAllCellArrays()
The following methods allow selective reading of bands.
~vtkGDALRasterReader() override
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkGDALRasterReaderInternal * Impl
void SetCellArrayStatus(const char *name, int status)
The following methods allow selective reading of bands.
std::vector< std::string > GetDomainMetaData(const std::string &domain)
Return domain metadata.
int GetNumberOfCellArrays()
The following methods allow selective reading of bands.
const char * GetCellArrayName(int index)
The following methods allow selective reading of bands.
const std::vector< std::string > & GetMetaData()
Return metadata as reported by GDAL.
const char * GetProjectionString() const
Return proj4 spatial reference.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkGDALRasterReader * New()
std::vector< std::string > Domains
std::vector< std::string > MetaData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called in response to a REQUEST_DATA request from the executive.
vtkIdType GetNumberOfCells()
Return the number of cells that are not set to GDAL NODATA.
const std::string & GetDriverLongName()
Return driver name which was used to read the current data.
const char * GetProjectionWKT() const
Returns WKT spatial reference.
int * GetRasterDimensions()
Get raster width and height in number of pixels (cells)
double GetInvalidValue(size_t bandIndex=0, int *hasNoData=nullptr)
Return the invalid value for a pixel (for blanking purposes) in a specified raster band.
int GetCellArrayStatus(const char *name)
The following methods allow selective reading of bands.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
const double * GetGeoCornerPoints()
Return geo-referenced corner points (Upper left, lower left, lower right, upper right)
int CanReadFile(const char *fname) override
Is this file supported.
const std::string & GetDriverShortName()
Return driver name which was used to read the current data.
virtual int CanReadFile(const char *fname)
Return non zero if the reader can read the given file name.
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 zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
int vtkIdType
Definition vtkType.h:354
#define VTK_FILEPATH