VTK  9.2.6
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 class VTKIOGDAL_EXPORT vtkGDALRasterReader : public vtkImageReader2
48 {
49 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
56 
60  int CanReadFile(VTK_FILEPATH const char* fname) override;
61 
65  const char* GetProjectionString() const;
66 
70  const char* GetProjectionWKT() const { return this->ProjectionWKT.c_str(); }
71 
76  const double* GetGeoCornerPoints();
77 
83  vtkSetMacro(CollateBands, bool);
84  vtkGetMacro(CollateBands, bool);
85  vtkBooleanMacro(CollateBands, bool);
86 
88 
91  vtkSetVector2Macro(TargetDimensions, int);
92  vtkGetVector2Macro(TargetDimensions, int);
94 
96 
101 
105  const std::vector<std::string>& GetMetaData();
106 
113  double GetInvalidValue(size_t bandIndex = 0, int* hasNoData = nullptr);
114 
118  std::vector<std::string> GetDomainMetaData(const std::string& domain);
119 
121 
127 
132 
134 
139  const char* GetCellArrayName(int index);
140  int GetCellArrayStatus(const char* name);
141  void SetCellArrayStatus(const char* name, int status);
145 
146 protected:
147  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
148  vtkInformationVector* outputVector) override;
149 
151  vtkInformationVector* outputVector) override;
152 
154 
155 protected:
156  int TargetDimensions[2];
162  std::vector<std::string> Domains;
163  std::vector<std::string> MetaData;
165 
166  class vtkGDALRasterReaderInternal;
167  vtkGDALRasterReaderInternal* Impl;
168 
169 private:
170  vtkGDALRasterReader(const vtkGDALRasterReader&) = delete;
171  void operator=(const vtkGDALRasterReader&) = delete;
172 };
173 
174 #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:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH