VTK  9.0.2
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, int yDim, int vtkDataType, int numberOfBands);
58 
64  GDALDataset* CreateGDALDataset(vtkImageData* data, const char* mapProjection, int flipAxis[3]);
65 
69  void CopyBandInfo(GDALDataset* src, GDALDataset* dest);
70 
76  vtkUniformGrid* CreateVTKUniformGrid(GDALDataset* input);
77 
82  void SetGDALProjection(GDALDataset* dataset, const char* projectionString);
83 
88  GDALDataset* dataset, double origin[2], double spacing[2], int flipAxis[2]);
89 
93  void CopyNoDataValues(GDALDataset* src, GDALDataset* dest);
94 
98  void WriteTifFile(GDALDataset* dataset, const char* filename);
99 
105  bool FindDataRange(GDALDataset* dataset, int bandId, double* minValue, double* maxValue);
106 
107 protected:
110 
111  double NoDataValue;
112 
117  bool CopyToGDAL(vtkImageData* input, GDALDataset* output, int flipAxis[3]);
118 
119  class vtkGDALRasterConverterInternal;
120  vtkGDALRasterConverterInternal* Internal;
121 
122 private:
124  void operator=(const vtkGDALRasterConverter&) = delete;
125 };
126 
127 #endif // vtkGDALRasterConverter_h
Convert between VTK image representation and GDAL datasets.
GDALDataset * CreateGDALDataset(int xDim, int yDim, int vtkDataType, int numberOfBands)
Create GDAL dataset in memory.
void SetGDALProjection(GDALDataset *dataset, const char *projectionString)
Set projection on GDAL dataset, using any projection string recognized by GDAL.
vtkGDALRasterConverterInternal * Internal
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUniformGrid * CreateVTKUniformGrid(GDALDataset *input)
Create vtkUniformGrid to match GDALDataset.
static vtkGDALRasterConverter * New()
void CopyNoDataValues(GDALDataset *src, GDALDataset *dest)
Copies NoDataValue info from 1st to 2nd dataset.
void CopyBandInfo(GDALDataset *src, GDALDataset *dest)
Copies color interpretation and color tables.
void SetGDALGeoTransform(GDALDataset *dataset, double origin[2], double spacing[2], int flipAxis[2])
Set geo-transform on GDAL dataset.
~vtkGDALRasterConverter() override
bool CopyToGDAL(vtkImageData *input, GDALDataset *output, int flipAxis[3])
Copies vtkImageData contents to GDALDataset GDALDataset must be initialized to same dimensions as vtk...
bool FindDataRange(GDALDataset *dataset, int bandId, double *minValue, double *maxValue)
Traverse values in specified band to find min/max.
void WriteTifFile(GDALDataset *dataset, const char *filename)
Write GDALDataset to tiff file.
GDALDataset * CreateGDALDataset(vtkImageData *data, const char *mapProjection, int flipAxis[3])
Create GDALDataset to match vtkImageData.
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
image data with blanking
@ spacing
Definition: vtkX3D.h:487
@ data
Definition: vtkX3D.h:321