Slice View Control using Slice Projection in other Slice View

Hi, I am currently trying to add some more control options for the three slice view to the application. One thing I want to accomplish is that, through the projection line of Slice A in Slice B, user could maybe drag and move the projection line of Slice A in Slice B to move Slice A.

I know that the projection lines could be turned on in the crosshair button on top, but I could not find the corresponding module/class source code for the projection lines.

I am thinking the Class vtkMRMLSliceIntersectionWidget might be useful. Any thoughts on how this could be implemented?

There’s work already underway on this from project week. I’m not sure of the current schedule but perhaps you could help move this along.

1 Like

@dgmato it would be great if you could give us an update on your draggable slice intersections development work.

Thank you, I will take a look at the project :slight_smile:

Hi!

You can see the code and commits for this topic in my branch:
https://github.com/dgmato/Slicer/tree/interactive_slice_intersection

Regarding the current progress, I have created new classes to render the interaction handles for interactive slice intersection. These are: vtkMRMLSliceIntersectionInteractionWidget and vtkMRMLSliceIntersectionInteractionRepresentation . I have used the classes vtkMRMLTransformHandleWidget and vtkMRMLTransformHandleRepresentation as a template. These classes were developed by @Sunderlandkyl during last NA-MIC Project Week. Instead of managing the interaction handles based on a vtkMRMLTransformNode and vtkMRMLDisplayNode, for our case, we need to use a vtkMRMLSliceNode as a reference to enable interactive slice intersection. Therefore, I have adapted the code for that, associating a SliceNode to the interaction pipelines.

Also, I have created a new action to the viewers toolbar to select “interactive slice intersection” and I have added a new variable to the vtkMRMLSliceCompositeNode to control the visibility of the handles, similar to the way the normal slice intersection visibility is controlled.

I have also added new parameters to the vtkMRMLSliceNode class to control the interaction handles: size, active widgets, visibility, … I did this to enable the use of the functions “GetActiveComponentType” and “GetActiveComponentIndex” from the vtkMRMLSliceIntersectionInteractionRepresentation class, which are needed to know which handle the user is hovering over (translation handle or rotation handle).

Currently, I am working to pass function calls from the displayable manager to the widget class. I am using the vtkMRMLCrosshairDisplayableManager for that. I am having some trouble developing this last part, so I would really appreciate some help.

@Sunderlandkyl told me he could contribute to this project soon. @PCRedHot2, you can also contribute to this branch.

2 Likes

I think new updates won’t help my situation, because my project is using an older version. Instead, I have created a temporary module to implement this feature - directly drag and move/rotate the slice in other slices. Thank you for all your help!

For anyone with similar issue, here is the extension code PCRedHot/SliceIntersection (github.com), just import to slicer directly using the extension wizard should be fine.

Translation by dragging the middle of the projection line.
Rotation by dragging the ends of the projection line.

1 Like

Thanks for sharing. This may be useful until the implementation in Slicer core is ready.

@dgmato Have you made progress since your last report? Do you need any help?

Thanks for sharing @PCRedHot2

I was able to display the interaction handles in the slice views and to enable interactions with these handles using the base classes developed by @Sunderlandkyl . I am currently updating the SliceToRAS transform in the function ApplyTransform of the vtkMRMLSliceIntersectionInteractionWidget class. I’ve checked the code by @PCRedHot2 and I am using a similar approach to update the SliceToRAS transform:

// Update SliceToRAS transform
vtkMatrix4x4* matrix = transform->GetMatrix();
vtkMRMLSliceNode* sliceNode = this->GetSliceNode();
vtkNew transformedSliceToRAS;
vtkMatrix4x4::Multiply4x4(matrix, sliceNode->GetSliceToRAS(), transformedSliceToRAS);
sliceNode->GetSliceToRAS()->DeepCopy(transformedSliceToRAS);
sliceNode->UpdateMatrices();

This is my branch for this development: https://github.com/dgmato/Slicer/tree/interactive_slice_intersection

However, when interacting with the handles in a slice view, the image is transformed in that view but the slice intersection in the other views do not change. See image below. See how I am able to transform the volume, but not the slice intersections.

2021-08-30 11-25-01

Also, the rotation and translation movements are inverted. I mean that if I move the translation handle to the right, the image is translated to the left. The same thing happens with the rotation direction.

Do you know what may be the problem here?

I would really appreciate some help on this. Thanks!

David

THansk for the update. You should not modify the current view node’s SlicerToRAS, but the SliceToRAS of that slice that intersection of you interact with. If the slice views are linked or you move the intersection position then you need to modify SliceToRAS of all the other views in the same view group (see vtkMRMLSliceIntersectionWidget::ProcessSetCrosshair, vtkMRMLSliceIntersectionWidget::ProcessRotate).

1 Like

Thanks for the tip @lassoan . I was able to fix this. Now, the SliceToRAS transform is updated in the rest of the slice nodes in the view group.

Current state:

2021-08-31 17-14-48

I am currently working on updating the handleToWorld transforms so that the interaction handles follow the position of the slice intersection lines. I have not been able to come up with a solution for this yet.

This is getting quite nice. You might do without the interaction handles, just change the mouse cursor near the intersection lines to indicate there is some action there.