[vtkusers] Interpolation between two contours

David Gobbi david.gobbi at gmail.com
Sun Jun 26 13:57:56 EDT 2011


Hi Markus,

Please keep your replies on the list.  The contours do not need to
have the same number of points (that's the reason for using a
spline!).  You can look at the spline code that I wrote for the
vtkLassoStencilSource:

http://vtk.org/gitweb?p=VTK.git;a=blob_plain;f=Imaging/vtkLassoStencilSource.cxx

 - David

On Sun, Jun 26, 2011 at 10:51 AM, Markus Lachinger <lachinge at in.tum.de> wrote:
> Hi David,
>
> thank you for the fast reply!
>
> The comptational effort is neglectable in this case, but I tried to
> understand your solution as well.
>
> Do I understand that correctly that you assume the two contours are defined
> by the same number of points (or you can approximate both contours with the
> same degree of the spline function)? So i interpolate the x and the y
> coordinates in between via linear interpolation?
>
> But what do I do if I start with i.e. a triangle defined by three points and
> end up with a star that is defined by i.e. 14 points. How do I interplate
> from contour1 to contour2?
>
> If I misunderstood your suggestion please can you give me some links
> considering your proposed technique?
>
> Thank you for your help,
> Markus
>
> Am 6/26/11 7:28 AM, schrieb David Gobbi:
>>
>> Hi Markus,
>>
>> Converting the contours to binary images as part of your solution will
>> really increase the computational cost, so I would suggest not taking
>> that approach.
>>
>> You should try parameterizing the contours with splines (two splines
>> per contour, one for x vs. t and one for y vs. t, where t is the
>> parameter).  The parameter can either be the fractional distance
>> around the contour, or it can be an angle using the center of the
>> contour as a reference point.  Then, to interpolate, do a for-loop
>> where you take small steps in t (the parameter value) and compute
>> the (x,y) points for each of the two contours. Interpolate between
>> these (x,y) points to create your interpolated contour.
>>
>>  - David
>>
>>
>> On Sat, Jun 25, 2011 at 7:46 PM, Markus<vishapxtreme at googlemail.com>
>>  wrote:
>>>
>>> Hi all,
>>>
>>> I am pretty new to the VTK and I got the assignment to interpolate
>>> between
>>> two contours. What I have done so far is converting the contours to an
>>> binary image (area inside 0, outside 1) and computed an
>>> vtkEuclideanDistance.
>>>
>>> The missing step is the interpolation between contour one and two, of
>>> which
>>> I both have a binary image and a distance map computed, but I am missing
>>> the
>>> final step to the interpolation.
>>>
>>> I took a look at vtkTemporalDataSet, but I am stuck how to use it.
>>> vtkTemporalInterpolator seems to be a good match for what I want to do (I
>>> want to be able to set the number of frames in between the images and
>>> then
>>> get the interpolated image for frame x), but I did not understand how to
>>> use
>>> those for my purpose from the examples at
>>> http://www.vtk.org/Wiki/VTK/Time_Support
>>>
>>> I would appreciate your help on how to solve this,
>>> thanks
>>>
>>> Markus
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>



More information about the vtkusers mailing list