Question about contour widget

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about contour widget

jmorra
I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found the following question http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes the same contour appears on every plane.  Ideally I'd like a different contour on every plane.  If I don't use the vtkImageActorPointPlacer then the contour only appears on one plane but it's the same plane regardless of which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

Karthik Krishnan-3
On Tue, Oct 12, 2010 at 10:33 AM, Jonathan Morra <[hidden email]> wrote:
I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found the following question http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

What this point placer does is to constrain the contour to the plane defined by the ImageActor. However, given that the same image actor is used for multiple slices, when you change the slice, the position of the image actor effectively changes and the contour updates itself to lie on the new plane.

What you need is to use a vtkBoundedPlanePointPlacer with the bounding planes de-lienating the bounds of the image actor when the contour is defined. That way it won't change when you change the slice.

Also to manage visibility of the contour (the contour will be visible for all slices in front of the defined slice), you could subclass the contour representation, insert a clipper that clips the polydata based on the bounding planes, that way, visibility is implicitly managed by the representation.

--
karthik

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes the same contour appears on every plane.  Ideally I'd like a different contour on every plane.  If I don't use the vtkImageActorPointPlacer then the contour only appears on one plane but it's the same plane regardless of which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

jmorra
Thanks for your help, I replaced the placer as you suggested, and now my code looks like the following

vtkBoundedPlanePointPlacer placer = new vtkBoundedPlanePointPlacer();
        placer.SetProjectionNormalToZAxis();
        placer.SetProjectionPosition(panel.getImageViewer().GetImageActor().GetCenter()[2]);
        rep.SetPointPlacer(placer);

This is almost right.  The contour now appears on the plane that I drew it on and the plane above it and that is it.  I just want the contour on the plane I drew it on.  I tried playing around with placer.SetPixelTolerance() but that didn't make a difference.

On Tue, Oct 12, 2010 at 2:33 AM, Karthik Krishnan <[hidden email]> wrote:
On Tue, Oct 12, 2010 at 10:33 AM, Jonathan Morra <[hidden email]> wrote:
I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found the following question http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

What this point placer does is to constrain the contour to the plane defined by the ImageActor. However, given that the same image actor is used for multiple slices, when you change the slice, the position of the image actor effectively changes and the contour updates itself to lie on the new plane.

What you need is to use a vtkBoundedPlanePointPlacer with the bounding planes de-lienating the bounds of the image actor when the contour is defined. That way it won't change when you change the slice.

Also to manage visibility of the contour (the contour will be visible for all slices in front of the defined slice), you could subclass the contour representation, insert a clipper that clips the polydata based on the bounding planes, that way, visibility is implicitly managed by the representation.

--
karthik

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes the same contour appears on every plane.  Ideally I'd like a different contour on every plane.  If I don't use the vtkImageActorPointPlacer then the contour only appears on one plane but it's the same plane regardless of which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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




_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

Karthik Krishnan-3
You need to add the bounding planes to confine it to a single plane. Something like :

  placer.RemoveAllBoundingPlanes();
  placer.SetProjectionNormalToZAxis();

  imageActor.GetBounds(bounds);
  plane = new vtkPLane()
  plane->SetOrigin( bounds[0], bounds[2], bounds[4] );
  plane->SetNormal( 0.0, 0.0, 1.0 );
  this->Placer->AddBoundingPlane( plane );
     
  plane2 = vtkPlane::New();
  plane2->SetOrigin( bounds[1], bounds[3], bounds[5] );
  plane2->SetNormal( 0.0, 0.0, -1.0 );
  placer.AddBoundingPlane( plane2 ); 

On Tue, Oct 12, 2010 at 9:04 PM, Jonathan Morra <[hidden email]> wrote:
Thanks for your help, I replaced the placer as you suggested, and now my code looks like the following

vtkBoundedPlanePointPlacer placer = new vtkBoundedPlanePointPlacer();
        placer.SetProjectionNormalToZAxis();
        placer.SetProjectionPosition(panel.getImageViewer().GetImageActor().GetCenter()[2]);
        rep.SetPointPlacer(placer);

This is almost right.  The contour now appears on the plane that I drew it on and the plane above it and that is it.  I just want the contour on the plane I drew it on.  I tried playing around with placer.SetPixelTolerance() but that didn't make a difference.

On Tue, Oct 12, 2010 at 2:33 AM, Karthik Krishnan <[hidden email]> wrote:
On Tue, Oct 12, 2010 at 10:33 AM, Jonathan Morra <[hidden email]> wrote:
I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found the following question http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

What this point placer does is to constrain the contour to the plane defined by the ImageActor. However, given that the same image actor is used for multiple slices, when you change the slice, the position of the image actor effectively changes and the contour updates itself to lie on the new plane.

What you need is to use a vtkBoundedPlanePointPlacer with the bounding planes de-lienating the bounds of the image actor when the contour is defined. That way it won't change when you change the slice.

Also to manage visibility of the contour (the contour will be visible for all slices in front of the defined slice), you could subclass the contour representation, insert a clipper that clips the polydata based on the bounding planes, that way, visibility is implicitly managed by the representation.

--
karthik

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes the same contour appears on every plane.  Ideally I'd like a different contour on every plane.  If I don't use the vtkImageActorPointPlacer then the contour only appears on one plane but it's the same plane regardless of which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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





_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

jmorra
I have followed your suggestion and tried the following code
// The contour rep requires a suitable point placer
        double[] bounds = panel.getImageViewer().GetImageActor().GetBounds();
        vtkBoundedPlanePointPlacer placer = new vtkBoundedPlanePointPlacer();
        placer.SetProjectionNormalToZAxis();
        placer.SetProjectionPosition(bounds[4]);

        placer.RemoveAllBoundingPlanes();
        vtkPlane plane1 = new vtkPlane();
        plane1.SetOrigin(bounds[0], bounds[2], bounds[4]);
        plane1.SetNormal(0.0, 0.0, 1.0);
        placer.AddBoundingPlane(plane1);

        vtkPlane plane2 = new vtkPlane();
        plane2.SetOrigin(bounds[1], bounds[3], bounds[5]);
        plane2.SetNormal(0.0, 0.0, -1.0);
        placer.AddBoundingPlane(plane2);
  
        rep.SetPointPlacer(placer);
        contourWidget.SetRepresentation(rep);

When I do this I cannot see any contours.  I have tried it with both with and without the line
        placer.SetProjectionPosition(bounds[4]);
and I didn't notice any change.  Is there something else that I am missing?  I also tried setting the vtkOrientedGlyphContourRepresentation to AlwaysOnTopOn(), but that didn't make a difference.  But if I comment out from
        placer.RemoveAllBoundingPlanes();
to the end of the snippet, I'm back where I was before which is having the contour show up on two planes.

Thanks for all your help, and I'm eagerly awaiting your response as this is the last bug in version 1.0 of my software.

On Wed, Oct 13, 2010 at 12:44 AM, Karthik Krishnan <[hidden email]> wrote:
You need to add the bounding planes to confine it to a single plane. Something like :

  placer.RemoveAllBoundingPlanes();
  placer.SetProjectionNormalToZAxis();

  imageActor.GetBounds(bounds);
  plane = new vtkPLane()
  plane->SetOrigin( bounds[0], bounds[2], bounds[4] );
  plane->SetNormal( 0.0, 0.0, 1.0 );
  this->Placer->AddBoundingPlane( plane );
     
  plane2 = vtkPlane::New();
  plane2->SetOrigin( bounds[1], bounds[3], bounds[5] );
  plane2->SetNormal( 0.0, 0.0, -1.0 );
  placer.AddBoundingPlane( plane2 ); 

On Tue, Oct 12, 2010 at 9:04 PM, Jonathan Morra <[hidden email]> wrote:
Thanks for your help, I replaced the placer as you suggested, and now my code looks like the following

vtkBoundedPlanePointPlacer placer = new vtkBoundedPlanePointPlacer();
        placer.SetProjectionNormalToZAxis();
        placer.SetProjectionPosition(panel.getImageViewer().GetImageActor().GetCenter()[2]);
        rep.SetPointPlacer(placer);

This is almost right.  The contour now appears on the plane that I drew it on and the plane above it and that is it.  I just want the contour on the plane I drew it on.  I tried playing around with placer.SetPixelTolerance() but that didn't make a difference.

On Tue, Oct 12, 2010 at 2:33 AM, Karthik Krishnan <[hidden email]> wrote:
On Tue, Oct 12, 2010 at 10:33 AM, Jonathan Morra <[hidden email]> wrote:
I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found the following question http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html and created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

What this point placer does is to constrain the contour to the plane defined by the ImageActor. However, given that the same image actor is used for multiple slices, when you change the slice, the position of the image actor effectively changes and the contour updates itself to lie on the new plane.

What you need is to use a vtkBoundedPlanePointPlacer with the bounding planes de-lienating the bounds of the image actor when the contour is defined. That way it won't change when you change the slice.

Also to manage visibility of the contour (the contour will be visible for all slices in front of the defined slice), you could subclass the contour representation, insert a clipper that clips the polydata based on the bounding planes, that way, visibility is implicitly managed by the representation.

--
karthik

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes the same contour appears on every plane.  Ideally I'd like a different contour on every plane.  If I don't use the vtkImageActorPointPlacer then the contour only appears on one plane but it's the same plane regardless of which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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






_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

John Drescher-2
I have done this but used a different method. My solution was to save
and restore the contours on each slice after a slice change.

I used this idea from Kent Williams and the brainstracer project he is
working on.

http://www.nitrc.org/plugins/scmsvn/viewcvs.php/trunk/?root=brainstracer

John
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

Dean Inglis
In reply to this post by jmorra
Hi John,

you are doing everything right as far as I can tell from your code.  The
solution
we implemented was to create a slice viewer based on vtkImageViewer2 that
broadcasted SliceChanged events whenever its ivar vtkImageActor changed
slices / display extents.  We created a vtkContour class inherited from
vtkProp that displays itself
in response to those events as well as stores and  maintains its history of
edits,
calculates its perimeter and area metrics, if closed displays the area as a
translucent image overlay
 etc etc.  The contour "knows" which slice extents it belongs to and
switches its visibility accordingly.
One could for example define a contour on a current vtkImageActor slice as
done
in your code and then send the vtkPolyData via the widget's rep method
GetContourRepresentationAsPolyData to initialize an isntance of the
vtkContour class.
We also subclassed a picker that adds vtkContour to the possible type of
props it can pick
so that one can mouse hover and cause it to automagically highlight itself
or pick
and cause it to remain highlighted in a selected state.   A selected contour
is unselected
whenever the slice viewer changes slices.  Editing of contours is
accomplished by passing its vtkPolyData ivar back to the vtkContourWidget
via
its Initialize method. There is a lot more interaction logic embedded in
this approach
but maybe you have some ideas to go on...

regards,
Dean


I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour
on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found
the following question
http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html
and
created the following code as a result (in Java)

        vtkContourWidget contourWidget = new vtkContourWidget();
        contourWidget.SetInteractor(panel.getRenWin().getIren());
        contourWidget.FollowCursorOn();

        vtkOrientedGlyphContourRepresentation rep = new
vtkOrientedGlyphContourRepresentation();
        contourWidget.SetRepresentation(rep);

        vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
        placer.SetImageActor(panel.getImageViewer().GetImageActor());
        rep.SetPointPlacer(placer);

        contourWidget.EnabledOn();
        contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes
the same contour appears on every plane.  Ideally I'd like a different
contour on every plane.  If I don't use the vtkImageActorPointPlacer then
the contour only appears on one plane but it's the same plane regardless of
which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

jmorra
Thanks a lot for all the advice, I went with Dean and John's solution, and it works perfectly.  Internally I keep the following data structure (in java)
HashSet<vtkContourWidget>[]
where the array is the same length as the number of planes, and I can store multiple contours per plane.  There's only one thing left for me to make this complete.  After I draw the contour, I use the vtkAppendPolyData to create one vtkPolyData.  I want to display that vtkPolyData on top of the vtkImageViewer2 in the same fashion as I do with the contours.  In order to accomplish this, I tried to use the following code, but it's not working yet

        vtkPolyDataMapper mapper = new vtkPolyDataMapper();
        mapper.SetInput(polyData);

        vtkActor actor = new vtkActor();
        actor.SetMapper(mapper);

        imageViewer.GetRenderer().AddActor(actor);

        double[] bounds = imageViewer.GetImageActor().GetBounds();

        vtkPlane topPlane = new vtkPlane();
        topPlane.SetOrigin(bounds[0], bounds[2], bounds[4]);
        normals[getPerpendicularSlice()] = 1;
        topPlane.SetNormal(0, 0, 1);

        vtkPlane bottomPlane = new vtkPlane();
        bottomPlane.SetOrigin(bounds[1], bounds[3], bounds[5]);
        bottomPlane.SetNormal(0, 0, -1);

        actor.GetMapper().RemoveAllClippingPlanes();
        actor.GetMapper().AddClippingPlane(topPlane);
        actor.GetMapper().AddClippingPlane(bottomPlane);

Am I on the right track with this?

Thanks

On Wed, Oct 13, 2010 at 7:23 PM, Dean Inglis <[hidden email]> wrote:
Hi John,

you are doing everything right as far as I can tell from your code.  The solution
we implemented was to create a slice viewer based on vtkImageViewer2 that
broadcasted SliceChanged events whenever its ivar vtkImageActor changed
slices / display extents.  We created a vtkContour class inherited from vtkProp that displays itself
in response to those events as well as stores and  maintains its history of edits,
calculates its perimeter and area metrics, if closed displays the area as a translucent image overlay
etc etc.  The contour "knows" which slice extents it belongs to and switches its visibility accordingly.
One could for example define a contour on a current vtkImageActor slice as done
in your code and then send the vtkPolyData via the widget's rep method
GetContourRepresentationAsPolyData to initialize an isntance of the vtkContour class.
We also subclassed a picker that adds vtkContour to the possible type of props it can pick
so that one can mouse hover and cause it to automagically highlight itself or pick
and cause it to remain highlighted in a selected state.   A selected contour is unselected
whenever the slice viewer changes slices.  Editing of contours is
accomplished by passing its vtkPolyData ivar back to the vtkContourWidget via
its Initialize method. There is a lot more interaction logic embedded in this approach
but maybe you have some ideas to go on...

regards,
Dean



I have a vtkImageViewer2 and wish to use vtkContourWidget to draw a contour
on the image.  The data I'm loading is a 3D DICOM CT volume.  I have found
the following question
http://vtk.1045678.n5.nabble.com/vtkContourWidget-with-vtkImageViewer2-td1236295.html
and
created the following code as a result (in Java)

      vtkContourWidget contourWidget = new vtkContourWidget();
      contourWidget.SetInteractor(panel.getRenWin().getIren());
      contourWidget.FollowCursorOn();

      vtkOrientedGlyphContourRepresentation rep = new
vtkOrientedGlyphContourRepresentation();
      contourWidget.SetRepresentation(rep);

      vtkImageActorPointPlacer placer = new vtkImageActorPointPlacer();
      placer.SetImageActor(panel.getImageViewer().GetImageActor());
      rep.SetPointPlacer(placer);

      contourWidget.EnabledOn();
      contourWidget.ProcessEventsOn();

When I do this and draw a contour and then scroll through the image planes
the same contour appears on every plane.  Ideally I'd like a different
contour on every plane.  If I don't use the vtkImageActorPointPlacer then
the contour only appears on one plane but it's the same plane regardless of
which plane is being viewed, which is also wrong.

Any suggestions about how to do this correctly would be greatly appreciated.

Thanks


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

shengweng
In reply to this post by Dean Inglis
Thank for your explanation.
But there is an error when I use the command in VC 2005:
     PolyData = ((*vtkOrientedGlyphContourRepresentation)(ContourWidget->GetRepresentation()))->GetContourRepresentationAsPolyData();
     Error Message:
      error C2275: “vtkOrientedGlyphContourRepresentation”: Invalid ......

     It seems that it doesn't support to change class vtkWidgetRepresentation to class vtkOrientedGlyphContourRepresentation because ContourWidget->GetRepresentation() returns a vtkWidgetRepresentation object which is the parent class of class vtkOrientedGlyphContourRepresentation.

          Shengwen
    Thanks
   
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

shengweng
The compile error message in VC 2005 is " Compiler Error C2275. 'identifier' : illegal use of this type as an expression...."..
I think the reason is that the parent or super class can't be coverted into its subclass. For example, the vtkWidgetRepresentation  can not be converted into vtkOrientedGlyphContourRepresentation.
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

John Drescher-2
On Wed, Oct 20, 2010 at 8:35 AM, shengweng <[hidden email]> wrote:
>
> The compile error message in VC 2005 is " Compiler Error C2275. 'identifier'
> : illegal use of this type as an expression...."..
> I think the reason is that the parent or super class can't be coverted into
> its subclass. For example, the vtkWidgetRepresentation  can not be converted
> into vtkOrientedGlyphContourRepresentation.
> --

You probably did not include the header for
vtkOrientedGlyphContourRepresentation

John
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

shengweng
In reply to this post by shengweng
I found "reinterpret_cast" can changes one data type into another, however, there was an error when I initilized the ContourWidget from the PolyData which was stored in the ContourRepresentation. I think the poly data may be wrong after data type was changed.
I have no idea about it. The polydata are stored in  ContourRepresentation, how to load it for initilization when the slice was changed?
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

shengweng
Base on the idea of Dean Inglis ,John Drescher and Jonathan Morra, I implement the method to show and change contour slice by slice. There is no need to reload poly data from the contourrepresentation, it is loaded automatically after the slice is changed.


Reply | Threaded
Open this post in threaded view
|

Re: Question about contour widget

Itsme
In reply to this post by shengweng
is your query about that polydata changed after the contour widgte dragged
solved ? i too had the same doubt whether after changing the contour, can we
get the polydata back which is according to the changes done by the contour
widget?


please revert back asap.


itsme




--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers