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.
@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
You can see the code and commits for this topic in my branch:
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.
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.
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();
vtkMatrix4x4::Multiply4x4(matrix, sliceNode->GetSliceToRAS(), transformedSliceToRAS);
This is my branch for this development: GitHub - dgmato/Slicer at 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.
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!
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).
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.
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.