Skip to content

fix(tools): make VolumeCroppingTool target vtkVolume actor (overlay-safe)#2668

Merged
wayfarer3130 merged 6 commits intocornerstonejs:mainfrom
mbellehumeur:fix/OrientationController
Apr 20, 2026
Merged

fix(tools): make VolumeCroppingTool target vtkVolume actor (overlay-safe)#2668
wayfarer3130 merged 6 commits intocornerstonejs:mainfrom
mbellehumeur:fix/OrientationController

Conversation

@mbellehumeur
Copy link
Copy Markdown
Contributor

@mbellehumeur mbellehumeur commented Mar 18, 2026

Context

VolumeCroppingTool previously assumed the viewport “default actor” (or getActors()[0]) was the volume being cropped.
In viewports with 3D overlay actors (e.g. OrientationController) registered before the volume, that assumption breaks: cropping logic can attach clipping planes / mapper operations to the wrong actor.

_getVolumeActor now searches viewport.getActors?.() and picks the entry whose actor.getClassName() is vtkVolume.
This avoids accidentally using overlay/non-volume actors when they are registered first.

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Copy link
Copy Markdown
Contributor

@igoroctaviano igoroctaviano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igoroctaviano
Copy link
Copy Markdown
Contributor

@mbellehumeur after some feedback from Denny, please incorporate this commit into your branch: https://github.com/RadicalImaging/CS3D_FUBerlin/commit/bb0ff98929f19c6e1f3525b1b0bbc62300384b8f

@mbellehumeur
Copy link
Copy Markdown
Contributor Author

@mbellehumeur after some feedback from Denny, please incorporate this commit into your branch: RadicalImaging/CS3D_FUBerlin@bb0ff98

I have applied that commit to the OrientationController2 branch. This PR is jsut for volumeCropping despite the name of the branch.

Comment thread packages/tools/src/tools/VolumeCroppingTool.ts Outdated
Comment thread packages/tools/src/tools/VolumeCroppingTool.ts Outdated
_getVolumeActor now searches viewport.getActors?.() and picks the entry whose actor.getClassName() is vtkVolume.
This avoids accidentally using overlay/non-volume actors when they are registered first.
Removed _getVolumeActorEntry:
Its logic was fully inlined into _getVolumeActor to simplify the flow.
Updated call sites that depended on _getVolumeActorEntry:
preMouseDownCallback now calls _getVolumeActor(...) and returns early if none is found.
_initialize3DViewports now uses volumeActor directly for mapper/input data access.
@wayfarer3130 wayfarer3130 merged commit d6baa68 into cornerstonejs:main Apr 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants