VTK  9.5.20251009
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
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
51 int CanReadFile(VTK_FILEPATH const char* fname) override;
52
56 const char* GetProjectionString() const;
57
61 const char* GetProjectionWKT() const { return this->ProjectionWKT.c_str(); }
62
67 const double* GetGeoCornerPoints();
68
74 vtkSetMacro(CollateBands, bool);
75 vtkGetMacro(CollateBands, bool);
76 vtkBooleanMacro(CollateBands, bool);
77
79
82 vtkSetVector2Macro(TargetDimensions, int);
83 vtkGetVector2Macro(TargetDimensions, int);
85
87
92
96 const std::vector<std::string>& GetMetaData();
97
104 double GetInvalidValue(size_t bandIndex = 0, int* hasNoData = nullptr);
105
109 std::vector<std::string> GetDomainMetaData(const std::string& domain);
110
112
115 const std::string& GetDriverShortName();
116 const std::string& GetDriverLongName();
118
123
125
130 const char* GetCellArrayName(int index);
131 int GetCellArrayStatus(const char* name);
132 void SetCellArrayStatus(const char* name, int status);
136
137protected:
139 vtkInformationVector* outputVector) override;
140
142 vtkInformationVector* outputVector) override;
143
144 int FillOutputPortInformation(int port, vtkInformation* info) override;
145
146 int TargetDimensions[2];
147 std::string Projection;
148 std::string ProjectionWKT;
149 std::string DomainMetaData;
150 std::string DriverShortName;
151 std::string DriverLongName;
152 std::vector<std::string> Domains;
153 std::vector<std::string> MetaData;
155
156 class vtkGDALRasterReaderInternal;
157 vtkGDALRasterReaderInternal* Impl;
158
159private:
161 void operator=(const vtkGDALRasterReader&) = delete;
162};
163
164VTK_ABI_NAMESPACE_END
165#endif // vtkGDALRasterReader_h
Read raster file formats using GDAL.
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.
Superclass of binary file readers.
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:367
#define VTK_FILEPATH