VTK  9.1.0
vtkGDALRasterReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkGDALRasterReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
34#ifndef vtkGDALRasterReader_h
35#define vtkGDALRasterReader_h
36
37#include <vtkIOGDALModule.h> // For export macro
38#include <vtkImageReader2.h>
39
40// C++ includes
41#include <string> // string is required
42#include <vector> // vector is required
43
44class VTKIOGDAL_EXPORT vtkGDALRasterReader : public vtkImageReader2
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
53
57 int CanReadFile(VTK_FILEPATH const char* fname) override;
58
62 const char* GetProjectionString() const;
63
67 const char* GetProjectionWKT() const { return this->ProjectionWKT.c_str(); }
68
73 const double* GetGeoCornerPoints();
74
80 vtkSetMacro(CollateBands, bool);
81 vtkGetMacro(CollateBands, bool);
82 vtkBooleanMacro(CollateBands, bool);
83
85
88 vtkSetVector2Macro(TargetDimensions, int);
89 vtkGetVector2Macro(TargetDimensions, int);
91
93
98
102 const std::vector<std::string>& GetMetaData();
103
110 double GetInvalidValue(size_t bandIndex = 0, int* hasNoData = nullptr);
111
115 std::vector<std::string> GetDomainMetaData(const std::string& domain);
116
118
121 const std::string& GetDriverShortName();
122 const std::string& GetDriverLongName();
124
129
131
136 const char* GetCellArrayName(int index);
137 int GetCellArrayStatus(const char* name);
138 void SetCellArrayStatus(const char* name, int status);
142
143protected:
145 vtkInformationVector* outputVector) override;
146
148 vtkInformationVector* outputVector) override;
149
150 int FillOutputPortInformation(int port, vtkInformation* info) override;
151
152protected:
153 int TargetDimensions[2];
154 std::string Projection;
155 std::string ProjectionWKT;
156 std::string DomainMetaData;
157 std::string DriverShortName;
158 std::string DriverLongName;
159 std::vector<std::string> Domains;
160 std::vector<std::string> MetaData;
162
163 class vtkGDALRasterReaderInternal;
164 vtkGDALRasterReaderInternal* Impl;
165
166private:
168 void operator=(const vtkGDALRasterReader&) = delete;
169};
170
171#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
These method should be reimplemented by subclasses that have more than a single input or single outpu...
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()
int CanReadFile(VTK_FILEPATH const char *fname) override
Is this file supported.
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)
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:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH