Line Widget Behind ImageSlice Actor


I don’t want “LineWidget” to be drawn behind “ImageSlice Actor”.

Nov-14-2022 16-15-27

This image is the result of adjusting the “Slice Index”.

I tried to adjust the Manipulator of LineWidget’s HandleRepresentations, but the result was not good.

What direction should I approach to solve this problem?


I’ll ask and answer myself

I referred to the code of Paint Widget Example.

    lineWidget.current = vtkLineWidget.newInstance(); //lineWidget instance 

    const activeActorMapper = contextActions.getActiveActorData().sliceObj.mapper;
    const slicingMode = activeActorMapper.getSlicingMode() % 3;
    const ijk = [0, 0, 0];
    const position = [0, 0, 0];

    ijk[slicingMode] = activeActorMapper.getSlice();
    commonData.source.indexToWorld(ijk, position);

1 Like

Make sure the handles of the line widget are positionned in front of the scene. (i.e. between the vtkImageData bounds and the camera position)

Thank you for your answer.

I am now trying to create a function that saves a record using “Line Widget” for each “Slice Index” and shows it again when it reaches that “Slice Index”.