[vtk-developers] A vtkDataSampler and image interpolation

Biddiscombe, John A. biddisco at cscs.ch
Wed Jul 6 10:55:10 EDT 2011


I remember now what it was I really wanted to say ...

Inside the streamtracer/particle tracer code, the integrators like RK4 make many Get requests for the interpolated velocity, the requests are refined iteratively and then the final interpolated position (cell+parametric coords) is used to get all the other scalars.

So when implementing the abstract interpolation base class,, it'd be well to consider that it may be required to operate at the top level (like the current probe filter and your image interpolation) where you simply loop over N points and compute the interpolated values
but it may also be called N times with a 'quick look' intention using as much cached info as possible, followed by the final call where we want the interpolated values for all vars/scalars.

The interpolatedvelocityfield stuff has methods to find the parametric weights - and then later to use these weights to interpolate all scalars - if you follow me. kind of break things up a bit so that the full calculation is not done every time.
loop N times getting one field only, (velocity here)
Reuse the weights from the best Get,
to Get all the other scalars using those weights.
+ more tweaks for the caching stuff.

The more I write, the more I realize it will mess up your class to try to accommodate any of this.

JB

Additionally, the original implementation used code like
GetVelocity(x,y,z) and on every single access, the interpolation internally ran
GetPointData()->GetArray(VelocityArrayName) and then interpolating inside that field array
and was actually spending a huge amount of time inside the array lookup (as much as inside the parametric weight computation).

so we want to avoid
GetValue(x,y,x,char *fieldname)
and encourage
GetValue(x,y,x,vtkDataArray *)
but ideally
template<T> GetValue(x,y,x,T *) for float/double etc arrays
which means we end up with
template<T> GetValue(x,y,x,T *, vtkIdType CellId, double *weights, etc etc)
but perhaps some of the concrete strategies can implement these and classes requiring these more sophisticated interpolators can ask for the strategies directly rather than the abstract base ..

Sorry for ranting on.




From: David Gobbi [mailto:david.gobbi at gmail.com]
Sent: 06 July 2011 15:52
To: Biddiscombe, John A.
Cc: VTK Developers
Subject: Re: [vtk-developers] A vtkDataSampler and image interpolation

Thanks, John.  This is the sort of info that I'm looking for, i.e. details about how the interface should specify what arrays to use as input, and what arrays to generate as output.  All the other info, meaning the use cases and specific implementations, is useful as evidence that a strategy-based approach to interpolation is desirable.

 - David


On Wed, Jul 6, 2011 at 2:59 AM, Biddiscombe, John A. <biddisco at cscs.ch<mailto:biddisco at cscs.ch>> wrote:
>>
virtual void vtkDataSampler::SamplePoints(vtkPoints *points, vtkDataArray *outputScalars);
<<
it's worse though because we might need all scalars, not just one

virtual void vtkDataSampler::SamplePoints(vtkPoints *points, vtkDataSetAttributes *blah-de-blah);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110706/3046c389/attachment.html>


More information about the vtk-developers mailing list