VTK
vtkGDALRasterConverter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGDALRasterConverter.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 =========================================================================*/
25 #ifndef vtkGDALRasterConverter_h
26 #define vtkGDALRasterConverter_h
27 
28 #include "vtkGeovisGDALModule.h" // For export macro
29 #include "vtkObject.h"
30 
31 // Forward declarations
32 class GDALDataset;
33 class vtkImageData;
34 class vtkUniformGrid;
35 
36 class VTKGEOVISGDAL_EXPORT vtkGDALRasterConverter : public vtkObject
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
48  vtkSetMacro(NoDataValue, double);
49  vtkGetMacro(NoDataValue, double);
51 
57  GDALDataset* CreateGDALDataset(int xDim,
58  int yDim,
59  int vtkDataType,
60  int numberOfBands);
61 
67  GDALDataset* CreateGDALDataset(vtkImageData* data, const char* mapProjection);
68 
72  void CopyBandInfo(GDALDataset* src, GDALDataset* dest);
73 
79  vtkUniformGrid* CreateVTKUniformGrid(GDALDataset* input);
80 
85  void SetGDALProjection(GDALDataset* dataset, const char* projectionString);
86 
90  void SetGDALGeoTransform(GDALDataset* dataset,
91  double origin[2],
92  double spacing[2]);
93 
97  void CopyNoDataValues(GDALDataset* src, GDALDataset* dest);
98 
102  void WriteTifFile(GDALDataset* dataset, const char* filename);
103 
109  bool FindDataRange(GDALDataset* dataset,
110  int bandId,
111  double* minValue,
112  double* maxValue);
113 
114 protected:
117 
118  double NoDataValue;
119 
124  bool CopyToGDAL(vtkImageData* input, GDALDataset* output);
125 
126  class vtkGDALRasterConverterInternal;
127  vtkGDALRasterConverterInternal* Internal;
128 
129 private:
131  void operator=(const vtkGDALRasterConverter&) = delete;
132 };
133 
134 #endif // vtkGDALRasterConverter_h
vtkGDALRasterConverter::~vtkGDALRasterConverter
~vtkGDALRasterConverter()
vtkGDALRasterConverter::NoDataValue
double NoDataValue
Definition: vtkGDALRasterConverter.h:118
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:41
vtkGDALRasterConverter::WriteTifFile
void WriteTifFile(GDALDataset *dataset, const char *filename)
Write GDALDataset to tiff file.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkGDALRasterConverter::Internal
vtkGDALRasterConverterInternal * Internal
Definition: vtkGDALRasterConverter.h:126
vtkGDALRasterConverter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGDALRasterConverter::CreateGDALDataset
GDALDataset * CreateGDALDataset(int xDim, int yDim, int vtkDataType, int numberOfBands)
Create GDAL dataset in memory.
vtkGDALRasterConverter::CreateGDALDataset
GDALDataset * CreateGDALDataset(vtkImageData *data, const char *mapProjection)
Create GDALDataset to match vtkImageData.
vtkGDALRasterConverter::CopyNoDataValues
void CopyNoDataValues(GDALDataset *src, GDALDataset *dest)
Copies NoDataValue info from 1st to 2nd dataset.
vtkGDALRasterConverter::SetGDALGeoTransform
void SetGDALGeoTransform(GDALDataset *dataset, double origin[2], double spacing[2])
Set geo-transform on GDAL dataset.
vtkGDALRasterConverter::SetGDALProjection
void SetGDALProjection(GDALDataset *dataset, const char *projectionString)
Set projection on GDAL dataset, using any projection string recognized by GDAL.
vtkGDALRasterConverter::CopyToGDAL
bool CopyToGDAL(vtkImageData *input, GDALDataset *output)
Copies vtkImageData contents to GDALDataset GDALDataset must be initialized to same dimensions as vtk...
vtkGDALRasterConverter::FindDataRange
bool FindDataRange(GDALDataset *dataset, int bandId, double *minValue, double *maxValue)
Traverse values in specified band to find min/max.
vtkGDALRasterConverter
Convert between VTK image representation and GDAL datasets.
Definition: vtkGDALRasterConverter.h:37
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkGDALRasterConverter::CreateVTKUniformGrid
vtkUniformGrid * CreateVTKUniformGrid(GDALDataset *input)
Create vtkUniformGrid to match GDALDataset.
vtkObject.h
vtkX3D::spacing
@ spacing
Definition: vtkX3D.h:481
vtkGDALRasterConverter::CopyBandInfo
void CopyBandInfo(GDALDataset *src, GDALDataset *dest)
Copies color interpretation and color tables.
vtkGDALRasterConverter::New
static vtkGDALRasterConverter * New()
vtkGDALRasterConverter::vtkGDALRasterConverter
vtkGDALRasterConverter()