Pretty cool idea David, thanks for the explanation.<div><br></div><div>There are other potential filter applications that come to mind (as I'm sure you're aware of) such as streamlines, etc. Have you created a list, or thought about, which filters might benefit from this capability?</div>
<div><br>W<br><br><div class="gmail_quote">On Tue, Jul 5, 2011 at 8:26 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Will,<br>
<br>
If I modified the vtkProbeFilter to use the vtkDataSampler, it would<br>
allow people to customize the way that vtkProbeFilter interpolates the<br>
data.<br>
<br>
The interface would look like this: a SetDataSampler() method would be<br>
added to vtkProbeFilter<br>
<br>
void vtkProbeFilter::SetDataSampler(vtkDataSampler *);<br>
<br>
The probe filter would have a default vtkDataSampler object which<br>
would use FindCell to interpolate the data (much like the way<br>
vtkProbeFilter works now). But here is where the magic comes. The<br>
user would be able to provide a different data sampler:<br>
<br>
vtkImageSampler *isample = vtkImageSampler::New();<br>
probeFilter->SetDataSampler(isample);<br>
<br>
The vtkImageSampler is for image data, it has interpolation code that<br>
is specifically written for structured data and is orders of magnitude<br>
faster than using FindCell to interpolate the data. Also, it provides<br>
the option of choosing different interpolation modes: nearest, linear,<br>
and cubic.<br>
<br>
So, in a nutshell, adding a SetDataSampler() method would make it<br>
possible for users to customize the way that vtkProbeFilter<br>
interpolates values from its Input. The use of vtkImageSampler here<br>
is just one example, if a person needs to use vtkProbeFilter on an FEM<br>
data set and knows of an efficient way to interpolate their FEM, then<br>
they could write a vtkDataSampler class specifically for their FEM.<br>
<br>
Another way to describe my goal is as follows: I have a whole bunch of<br>
image interpolation code that I've written and tweaked over the past<br>
10+ years, and I want to be able to use this interpolation code with<br>
the VTK graphics pipeline. The vtkDataSampler class is how I hope to<br>
achieve this.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Tue, Jul 5, 2011 at 3:49 AM, Will Schroeder<br>
<<a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a>> wrote:<br>
> David-<br>
> What's the relationship of this vtkDataSampler class to the vtkProbeFilter?<br>
> W<br>
><br>
> On Mon, Jul 4, 2011 at 1:23 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
>><br>
>> Hi All,<br>
>><br>
>> I've written some new interpolation classes for VTK, both for images<br>
>> and for other data sets. One thing that I want to ensure is that the<br>
>> abstract interface is something that people will be satisfied with.<br>
>> I use the same ScalarMode constants as vtkMapper, but there might<br>
>> be a better way of selecting arrays that I am not aware of:<br>
>><br>
>> class vtkDataSampler : public vtkObject<br>
>> {<br>
>> // set the data to interpolate (does not establish pipeline connection)<br>
>> void SetInput(vtkDataObject *);<br>
>><br>
>> // update any internal state variables prior to commencing interpolation<br>
>> void Update();<br>
>><br>
>> // get an interpolated value, return "false" if out of bounds<br>
>> bool GetSample(const double point[3], double *value);<br>
>><br>
>> // get an interpolated value (meant for use by wrapper languages)<br>
>> double GetSample(double x, double y, double z, int component);<br>
>><br>
>> // set the scalar mode (same as vtkMapper scalar modes)<br>
>> void SetScalarMode(int mode);<br>
>> void SetScalarModeToDefault();<br>
>> void SetScalarModeToUsePointData();<br>
>> void SetScalarModeToUseCellData();<br>
>> void SetScalarModeToUsePointFieldData();<br>
>> void SetScalarModeToUseCellFieldData();<br>
>><br>
>> // set the array, if chosen scalar mode is field data<br>
>> void SetArrayName(const char *name);<br>
>><br>
>> void SetTolerance(double);<br>
>> void SetLocator(vtkLocator *locator);<br>
>> };<br>
>><br>
>> The changes are on gerrit, if people want to see the full implementation:<br>
>> <a href="http://review.source.kitware.com/2004" target="_blank">http://review.source.kitware.com/2004</a><br>
>><br>
>> - David<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com">http://www.kitware.com</a><br>(518) 881-4902<br>
</div>