VTK  9.0.1
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 
44 class VTKIOGDAL_EXPORT vtkGDALRasterReader : public vtkImageReader2
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
53 
57  int CanReadFile(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 
124 
129 
131 
136  const char* GetCellArrayName(int index);
137  int GetCellArrayStatus(const char* name);
138  void SetCellArrayStatus(const char* name, int status);
142 
143 protected:
144  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
145  vtkInformationVector* outputVector) override;
146 
148  vtkInformationVector* outputVector) override;
149 
151 
152 protected:
153  int TargetDimensions[2];
159  std::vector<std::string> Domains;
160  std::vector<std::string> MetaData;
162 
163  class vtkGDALRasterReaderInternal;
164  vtkGDALRasterReaderInternal* Impl;
165 
166 private:
167  vtkGDALRasterReader(const vtkGDALRasterReader&) = delete;
168  void operator=(const vtkGDALRasterReader&) = delete;
169 };
170 
171 #endif // vtkGDALRasterReader_h
vtkGDALRasterReader::Domains
std::vector< std::string > Domains
Definition: vtkGDALRasterReader.h:159
vtkGDALRasterReader::GetRasterDimensions
int * GetRasterDimensions()
Get raster width and height in number of pixels (cells)
vtkGDALRasterReader::GetProjectionWKT
const char * GetProjectionWKT() const
Returns WKT spatial reference.
Definition: vtkGDALRasterReader.h:67
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkGDALRasterReader::DriverShortName
std::string DriverShortName
Definition: vtkGDALRasterReader.h:157
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:36
vtkGDALRasterReader
Read raster file formats using GDAL.
Definition: vtkGDALRasterReader.h:45
vtkGDALRasterReader::DomainMetaData
std::string DomainMetaData
Definition: vtkGDALRasterReader.h:156
vtkGDALRasterReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGDALRasterReader::CollateBands
bool CollateBands
Definition: vtkGDALRasterReader.h:161
vtkGDALRasterReader::~vtkGDALRasterReader
~vtkGDALRasterReader() override
vtkGDALRasterReader::vtkGDALRasterReader
vtkGDALRasterReader()
vtkGDALRasterReader::GetDriverLongName
const std::string & GetDriverLongName()
vtkGDALRasterReader::GetDriverShortName
const std::string & GetDriverShortName()
Return driver name which was used to read the current data.
vtkGDALRasterReader::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called in response to a REQUEST_DATA request from the executive.
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkGDALRasterReader::GetCellArrayStatus
int GetCellArrayStatus(const char *name)
vtkGDALRasterReader::GetInvalidValue
double GetInvalidValue(size_t bandIndex=0, int *hasNoData=nullptr)
Return the invalid value for a pixel (for blanking purposes) in a specified raster band.
vtkGDALRasterReader::New
static vtkGDALRasterReader * New()
vtkGDALRasterReader::GetProjectionString
const char * GetProjectionString() const
Return proj4 spatial reference.
vtkGDALRasterReader::GetCellArrayName
const char * GetCellArrayName(int index)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkGDALRasterReader::ProjectionWKT
std::string ProjectionWKT
Definition: vtkGDALRasterReader.h:155
vtkImageReader2
Superclass of binary file readers.
Definition: vtkImageReader2.h:53
vtkGDALRasterReader::GetMetaData
const std::vector< std::string > & GetMetaData()
Return metadata as reported by GDAL.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkGDALRasterReader::EnableAllCellArrays
void EnableAllCellArrays()
vtkGDALRasterReader::GetNumberOfCells
vtkIdType GetNumberOfCells()
Return the number of cells that are not set to GDAL NODATA.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:65
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkGDALRasterReader::RequestInformation
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkGDALRasterReader::DisableAllCellArrays
void DisableAllCellArrays()
vtkGDALRasterReader::MetaData
std::vector< std::string > MetaData
Definition: vtkGDALRasterReader.h:160
vtkGDALRasterReader::GetNumberOfCellArrays
int GetNumberOfCellArrays()
The following methods allow selective reading of bands.
vtkGDALRasterReader::SetCellArrayStatus
void SetCellArrayStatus(const char *name, int status)
vtkGDALRasterReader::GetDomainMetaData
std::vector< std::string > GetDomainMetaData(const std::string &domain)
Return domain metadata.
vtkGDALRasterReader::GetGeoCornerPoints
const double * GetGeoCornerPoints()
Return geo-referenced corner points (Upper left, lower left, lower right, upper right)
vtkGDALRasterReader::CanReadFile
int CanReadFile(const char *fname) override
Is this file supported.
vtkGDALRasterReader::DriverLongName
std::string DriverLongName
Definition: vtkGDALRasterReader.h:158
vtkGDALRasterReader::Projection
std::string Projection
Definition: vtkGDALRasterReader.h:154
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkGDALRasterReader::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkGDALRasterReader::Impl
vtkGDALRasterReaderInternal * Impl
Definition: vtkGDALRasterReader.h:163
vtkImageReader2.h