vtkGDALRasterReader for C++

For anyone in the future:

The default for the vtkGDALRasterReader is to return the scalars associated with cells, but the vtkWarpScalar warps on scalars associated with points. The solution here was to convert the cell data to point data before warping.

vtkNew<vtkImageDataGeometryFilter> surface;
surface->SetInputConnection(reader->GetOutputPort());

// Convert cell data to point data
vtkNew<vtkCellDataToPointData> c2p;
c2p->SetInputConnection(surface->GetOutputPort());

// Warp the surface from point data in the vertical direction
vtkNew<vtkWarpScalar> warp;
warp->SetInputConnection(c2p->GetOutputPort());
1 Like