[vtk-developers] 2 ways of representing lines

Lisa Avila lisa.avila at kitware.com
Wed Aug 7 17:57:02 EDT 2002


Hello Dean,

I have solved a problem with the ImagePlaneWidget which may indicate what 
your problem is.

The culler was doing the "right" thing - it culled out an actor that had 
bogus bounds. The reason the actor had bogus bounds was because the cursor 
actor was created in the image plane widget to be 1) visible, 2) have 4 
points, and 3) had no points defined.  This caused bad results as you can 
imaging when ComputeBounds() was called on that polydata. Also, when the 
new points were defined, the points were not set to modified, and therefore 
ComputeBounds() was never called again. Of course, I have to wonder why 
Purify didn't catch this....

To fix this I defined the points in the cursor to some initial values and I 
turned the visibility off by default.

Perhaps you have some similarly undefined data?


Lisa


At 02:53 PM 8/6/2002, Dean Inglis wrote:
>Hi all,
>
>I have a workaround for a long-standing pb with representing straight lines
>in VTK.  I recently added cross-hairs to vtkImagePlaneWidget wherein the
>pipeline for the cross-hairs is basically:
>
><to store it>
>   vtkPoints          *CursorPoints;
>   vtkPolyData        *CursorPolyData;
>   vtkPolyDataMapper  *CursorMapper;
>   vtkActor           *CursorActor;
>
><and to generate it>
>   // Construct initial points
>   this->CursorPoints->SetNumberOfPoints(4);
>
>   this->CursorPolyData->SetPoints(this->CursorPoints);
>
>   this->CursorMapper->SetInput(this->CursorPolyData);
>   this->CursorMapper->SetResolveCoincidentTopologyToPolygonOffset();
>
>   this->CursorActor->SetMapper(this->CursorMapper);
>   this->CursorActor->PickableOff();
>
>   vtkCellArray *cells = vtkCellArray::New();
>   cells->Allocate(cells->EstimateSize(2,2));
>   vtkIdType pts[2];
>   pts[0] = 0; pts[1] = 1;       // horizontal segment
>   cells->InsertNextCell(2,pts);
>   pts[0] = 2; pts[1] = 3;       // vertical segment
>   cells->InsertNextCell(2,pts);
>
>   this->CursorPolyData->SetLines(cells);
>   this->CursorPolyData->Modified();
>   cells->Delete();
>
><snip>
>
>Well, if one zooms in on a vtkImagePlaneWidget, the image data can still be
>queried (i.e. the picking is functional) but the cross-hairs disappear.  Try
>/Examples/GUI/Tcl/ImagePlaneWidget.tcl without the line:
><snip>
>[ren1 GetCullers] RemoveAllItems
><snip>
>
>Hmmmmm.  I am considering changing the representation of the cross-hairs to
>avoid this messing about with the cullers:
><new representation>
>   vtkLineSource      *CursorLine1;
>   vtkLineSource      *CursorLine2;
>   vtkAppendPolyData  *CursorPolyData;
>   vtkPolyDataMapper  *CursorMapper;
>   vtkActor           *CursorActor;
><snip>
>
>I've tested and it works.  Any thoughts before I make this change?
>
>Dean
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Dean Inglis, Ph.D.
>Clinical Research Unit
>25 Charlton Avenue East, Unit 610
>Hamilton, ONT, L8N 1Y2
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list