VTK  9.2.20221001
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 =========================================================================*/
37 #ifndef vtkGDALRasterReader_h
38 #define vtkGDALRasterReader_h
39 
40 #include <vtkIOGDALModule.h> // For export macro
41 #include <vtkImageReader2.h>
42 
43 // C++ includes
44 #include <string> // string is required
45 #include <vector> // vector is required
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class VTKIOGDAL_EXPORT vtkGDALRasterReader : public vtkImageReader2
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
57 
61  int CanReadFile(VTK_FILEPATH const char* fname) override;
62 
66  const char* GetProjectionString() const;
67 
71  const char* GetProjectionWKT() const { return this->ProjectionWKT.c_str(); }
72 
77  const double* GetGeoCornerPoints();
78 
84  vtkSetMacro(CollateBands, bool);
85  vtkGetMacro(CollateBands, bool);
86  vtkBooleanMacro(CollateBands, bool);
87 
89 
92  vtkSetVector2Macro(TargetDimensions, int);
93  vtkGetVector2Macro(TargetDimensions, int);
95 
97 
102 
106  const std::vector<std::string>& GetMetaData();
107 
114  double GetInvalidValue(size_t bandIndex = 0, int* hasNoData = nullptr);
115 
119  std::vector<std::string> GetDomainMetaData(const std::string& domain);
120 
122 
128 
133 
135 
140  const char* GetCellArrayName(int index);
141  int GetCellArrayStatus(const char* name);
142  void SetCellArrayStatus(const char* name, int status);
146 
147 protected:
148  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
149  vtkInformationVector* outputVector) override;
150 
152  vtkInformationVector* outputVector) override;
153 
155 
156 protected:
157  int TargetDimensions[2];
163  std::vector<std::string> Domains;
164  std::vector<std::string> MetaData;
166 
167  class vtkGDALRasterReaderInternal;
168  vtkGDALRasterReaderInternal* Impl;
169 
170 private:
171  vtkGDALRasterReader(const vtkGDALRasterReader&) = delete;
172  void operator=(const vtkGDALRasterReader&) = delete;
173 };
174 
175 VTK_ABI_NAMESPACE_END
176 #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...
const std::string & GetDriverShortName()
Return driver name which was used to read the current data.
vtkGDALRasterReaderInternal * Impl
const std::string & GetDriverLongName()
Return driver name which was used to read the current data.
const char * GetProjectionString() const
Return proj4 spatial reference.
void SetCellArrayStatus(const char *name, int status)
The following methods allow selective reading of bands.
int GetNumberOfCellArrays()
The following methods allow selective reading of bands.
const std::vector< std::string > & GetMetaData()
Return metadata as reported by GDAL.
const double * GetGeoCornerPoints()
Return geo-referenced corner points (Upper left, lower left, lower right, upper right)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int CanReadFile(VTK_FILEPATH const char *fname) override
Is this file supported.
std::vector< std::string > GetDomainMetaData(const std::string &domain)
Return domain metadata.
std::vector< std::string > Domains
std::vector< std::string > MetaData
static vtkGDALRasterReader * New()
const char * GetCellArrayName(int index)
The following methods allow selective reading of bands.
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.
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...
int * GetRasterDimensions()
Get raster width and height in number of pixels (cells)
const char * GetProjectionWKT() const
Returns WKT spatial reference.
Superclass of binary file readers.
a simple class to control print indentation
Definition: vtkIndent.h:120
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ info
Definition: vtkX3D.h:388
@ port
Definition: vtkX3D.h:459
@ name
Definition: vtkX3D.h:231
@ index
Definition: vtkX3D.h:258
@ string
Definition: vtkX3D.h:502
int vtkIdType
Definition: vtkType.h:326
#define VTK_FILEPATH