VTK  9.1.0
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
32class GDALDataset;
33class vtkImageData;
34class vtkUniformGrid;
35
36class VTKGEOVISGDAL_EXPORT vtkGDALRasterConverter : public vtkObject
37{
38public:
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
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, VTK_FILEPATH const char* filename);
99
105 bool FindDataRange(GDALDataset* dataset, int bandId, double* minValue, double* maxValue);
106
107protected:
110
112
117 bool CopyToGDAL(vtkImageData* input, GDALDataset* output, int flipAxis[3]);
118
119 class vtkGDALRasterConverterInternal;
120 vtkGDALRasterConverterInternal* Internal;
121
122private:
124 void operator=(const vtkGDALRasterConverter&) = delete;
125};
126
127#endif // vtkGDALRasterConverter_h
Convert between VTK image representation and GDAL datasets.
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.
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 WriteTifFile(GDALDataset *dataset, VTK_FILEPATH const char *filename)
Write GDALDataset to tiff file.
static vtkGDALRasterConverter * New()
void SetGDALGeoTransform(GDALDataset *dataset, double origin[2], double spacing[2], int flipAxis[2])
Set geo-transform on GDAL dataset.
~vtkGDALRasterConverter() override
GDALDataset * CreateGDALDataset(vtkImageData *data, const char *mapProjection, int flipAxis[3])
Create GDALDataset to match vtkImageData.
bool CopyToGDAL(vtkImageData *input, GDALDataset *output, int flipAxis[3])
Copies vtkImageData contents to GDALDataset GDALDataset must be initialized to same dimensions as vtk...
vtkUniformGrid * CreateVTKUniformGrid(GDALDataset *input)
Create vtkUniformGrid to match GDALDataset.
GDALDataset * CreateGDALDataset(int xDim, int yDim, int vtkDataType, int numberOfBands)
Create GDAL dataset in memory.
bool FindDataRange(GDALDataset *dataset, int bandId, double *minValue, double *maxValue)
Traverse values in specified band to find min/max.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
image data with blanking
@ spacing
Definition: vtkX3D.h:487
@ data
Definition: vtkX3D.h:321
#define VTK_FILEPATH