[vtk-developers] question about vtkContourWidget/vtkContourRepresentation?

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Fri May 7 14:01:03 EDT 2010


Hi Karthik,

Let me tell you a bit more about the process Nicolas is implementing:

   1. Run a level set on a 2D image
   2. Apply vtkContourFilter or vtkMarchignSquares
   3. Decimate the resulting vtkPolyData using vtkDecimatePolyline
   4. Initialize the contour widget with the resulting polydata

In such a pipeline when initializing the contour widget, the input 
polydata points can not be in order, and then we finally ended iterating 
on the line to sort the order of the point container.

So, I wonder do you think it could be included in the 
vtkContourRepresentation class?

Thanks,
Arnaud

On 05/07/2010 01:49 PM, Karthik Krishnan wrote:
> Yes, that surely explains the behaviour Nicolas is getting. The way to 
> look at the initialization for the contour widget is that its 
> initializing the control points. The input is sort of assumed to a 
> vtkPolyData containing a single vtkPolyline cell. (in which case, the 
> points would have been in order).
>
>
>
> On Fri, May 7, 2010 at 11:35 AM, Arnaud GELAS 
> <arnaud_gelas at hms.harvard.edu <mailto:arnaud_gelas at hms.harvard.edu>> 
> wrote:
>
>     Hi guys,
>
>     I was looking at the code of vtkContourWidget::Initialize and thus
>     vtkContourRepresentation::Initialize method, and it seems that the
>     initialization does not take into account the connectivity
>     information stored into the input polydata.
>     For instance, vtkContourRepresentation appends to the node
>     container points from the input polydata in the same order of the
>     points container.
>
>     In vtkContourRepresentation.cxx
>
>     1217   for ( vtkIdType i=0; i < nPoints; i++ )
>     1218     {
>     1219     double *p = points->GetPoint( i );
>     1220     this->AddNodeAtWorldPosition( p, worldOrient );
>     1221     }
>
>     I guess such a behavior may explain why Nicolas gets such results
>     when passing a contour resulting from a marching squares to a
>     contour widget.
>
>     http://www.vtk.org/pipermail/vtkusers/2010-May/108826.html
>
>     I just wonder if it is supposed to be the normal behavior?
>     and if not what would be the best way to fix it?
>     assuming the polydata contains lines? assuming the input comes
>     from a vtkStripper?
>
>     Thanks,
>     Best,
>     Arnaud
>
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100507/18a4e083/attachment.html>


More information about the vtk-developers mailing list