Add interactive volume shrinker widget and notebook #2248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…volume)
Description
This PR introduces an interactive volume cropping tool for use in Jupyter notebooks, in order to simplify and standardise the workflow around manual volume reduction prior to reconstruction or further processing.
The addition consists of a new widget class InteractiveVolumeShrinker allowing users to interactively select crop limits using sliders and visual overlays
Has an ability to save cropped geometry (cropped_ig), manual crop limits (crop_limits) and preview reconstruction (last_recon)
This functionality is designed for exploratory workflows in Jupyter, allowing a user to visually guide a crop without manually computing voxel bounds.
The implementation is non-invasive: it does not modify core processor behaviour, but provides a notebook-oriented interface on top of existing utilities.
No changes to existing APIs are required.
Example Usage
from cil.utilities.jupyter.interactiveVolumeShrinker import InteractiveVolumeShrinker
ivs = InteractiveVolumeShrinker(
absorption_data3D=absorption_data3D,
preview=preview_image,
roi_xy=roi_xy
)
ivs.show()
cropped_ig = ivs.cropped_ig
crop_limits = ivs.crop_limits
last_recon = ivs.last_recon
recon = FBP(cropped_ig, absorption_data3D.geometry)(absorption_data3D)
Contribution Notes
❤️ Thanks for your contribution!