[vtk-developers] A vtkDataSampler and image interpolation

David Gobbi david.gobbi at gmail.com
Mon Jul 4 13:23:48 EDT 2011


Hi All,

I've written some new interpolation classes for VTK, both for images
and for other data sets.  One thing that I want to ensure is that the
abstract interface is something that people will be satisfied with.
I use the same ScalarMode constants as vtkMapper, but there might
be a better way of selecting arrays that I am not aware of:

class vtkDataSampler : public vtkObject
{
  // set the data to interpolate (does not establish pipeline connection)
  void SetInput(vtkDataObject *);

  // update any internal state variables prior to commencing interpolation
  void Update();

  // get an interpolated value, return "false" if out of bounds
  bool GetSample(const double point[3], double *value);

  // get an interpolated value (meant for use by wrapper languages)
  double GetSample(double x, double y, double z, int component);

  // set the scalar mode (same as vtkMapper scalar modes)
  void SetScalarMode(int mode);
  void SetScalarModeToDefault();
  void SetScalarModeToUsePointData();
  void SetScalarModeToUseCellData();
  void SetScalarModeToUsePointFieldData();
  void SetScalarModeToUseCellFieldData();

  // set the array, if chosen scalar mode is field data
  void SetArrayName(const char *name);

  void SetTolerance(double);
  void SetLocator(vtkLocator *locator);
};

The changes are on gerrit, if people want to see the full implementation:
http://review.source.kitware.com/2004

 - David



More information about the vtk-developers mailing list