Placing points on top of a (changing) vtkImageSlice

Hi there,

I am working on segmentating ImageData that’s being displayed as vtkImageSlices.

For this I place some points on the image which give me the boundaries for the segmentation.

Right now I’m using the vtkContourWidget, but when changing slices, the depth of the image changes and therefore the contour drawin by the widget will be hidden behind the Slice, and or be at a certain distance of it.

So I want to implement my own version of the ContourWidget, where the points are placed right on top of the current slice, and remain so when changing slices.

What is a recommended way of doing this?

The solution I came up with is simply the following:

  1. Place point (represented as 2D image) at current slice depth
  2. On slice change, reposition points to new slice depth so they stay flat right on top of the slice.

Is this a viable solution, or is there someting I’m missing that could make it easier?

Thanks in advance!

In case someone is wondering, this solution worked.

I calculated the world position through a vtkBoundedPlanePointPlacer where the oblique plane is the plane of the slice as given by the vtkImageSliceMapper.

On reslice I just checked that every point’s plane origin corresponded to the current slice plane origin to enable or disable the handle.