[vtkusers] vtkSeedWidget -- points always displayed in overlay?

kent williams nkwmailinglists at gmail.com
Fri Apr 24 11:18:22 EDT 2009


The problem is that even if I use vtkPointHandleRepresentation3D, the
widget interacts very poorly with the Plane view widget I'm using,
which is vtkinria3d's vtkViewImage2D class.

If I use vtkPointHandleRepresentation3D, I have to call 'AllOn()'
before anything shows up, and then box & crosshairs don't go away if I
switch to a different slice.   If I zoom in and out, the crosshairs
and bounding boxes flip in and out of visibility, as though they're
being clipped incosistently by the view plane.

What I don't get is how the SeedWidget actors know which slice is
being displayed.  I don't see the connection there. Here is my setup
code:

    typedef vtkPointHandleRepresentation3D HandleRepType;

    HandleRepType *handle =
      HandleRepType::New();
    handle->AllOn();
    handle->GetProperty()->SetColor(1,0,0);

    this->m_SeedRepresentation =
      vtkSeedRepresentation::New();
    this->m_SeedRepresentation->SetHandleRepresentation(handle);

    this->m_SeedWidget = vtkSeedWidget::New();
    // m_ViewImage type is vtkinria3d's vtkViewImage2D
    vtkImageActor *imageActor = this->m_ViewImage->GetImageActor();
    this->m_Placer = vtkImageActorPointPlacer::New();

    this->m_Placer->SetImageActor(imageActor);
    this->m_Orientation = this->m_ViewImage->GetOrientation();
    this->m_SeedWidget->SetInteractor(this->m_ViewImage->GetRenderWindowInteractor());
    this->m_SeedWidget->SetRepresentation(this->m_SeedRepresentation);
    this->m_SeedWidget->SetKeyPressActivation(0);
    this->m_SeedWidget->On();


On Thu, Apr 23, 2009 at 10:42 PM, Karthik Krishnan
<karthik.krishnan at kitware.com> wrote:
> Kent:
>
> I apologize for any poor documentation.. will try to add some. Here is an
> explanation.
>
> vtkPointHandleRepresentation2D - The geometrical representation (a 2D cross
> hair) is composed of vtkActor2D and entirely exists on the overlay plane.
> Being rendered as an overlay, it will be visible even if you change slices
> etc. This is the only representation that exists on the overlay plane.
>
> vtkPointHandleRepresentation3D - Its rendered as a 3D cross hair (much like
> vtkCursor3D) and exists in physical space. It will change its visibility as
> you toggle slices. Try to set the point placer as a vtkImageActorPointPlacer
> on this representation if you are placing it on an image actor. I'll try to
> add a test/example when I get a chance.
>
> vtkSphereHandleRepresentation - Same as vtkPointHandleRepresentation3D,
> except that its rendered as a sphere
>
> vtkPolygonalHandleRepresentation3D - Same as vtkPointHandleRepresentation3D,
> except that it is rendered as an arbitrary polygonal shape.
>
> Thanks
> --
> karthik
>
> On Thu, Apr 23, 2009 at 5:42 PM, kent williams <nkwmailinglists at gmail.com>
> wrote:
>>
>> I was having nothing but trouble trying to get the vtkSeedWidget
>> going, and I instrumented it so I could quickly try all the
>> HandleRepresentation types.
>>
>> What I'd like is for points to display in a 2D viewer, allow all the
>> normal interactions, and when I change to a different slice, the
>> handles disappear. When I change back to the slice, the points should
>> reappear.
>>
>> What actually happens is this, depending on representation:
>>
>> 1. vtkPointHandleRepresentation2D: Points stuck at one pixel size,
>> regardless of zoom. Nearly invisible.  They stay visible no matter
>> what slice you go to.
>> 2. vtkPointHandleRepresentation3D: Nothing shows up in my 2D viewer at
>> all.
>> 3. vtkPolygonalRepresentation3D -- with geometry provided by a
>> vtkSphereSource: Spheres display, but don't disappear if you change
>> slices. Points can't be selected, moved, or deleted with the mouse.
>> 4.vtkSphereHandleRepresentation -- pretty much as case #3.
>>
>> I am using vtkinria3d's vtkViewWidget2D class, and not
>> vtkImageViewer2, but that shouldn't cause this problem -- I though if
>> I used 3D, the handles would disappear when i changed slices and
>> reappear when i went back to the original slice.
>> _______________________________________________
>> 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