-
Notifications
You must be signed in to change notification settings - Fork 390
feat(segmentStatsCalculator): for calculation of statistics #1881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…individual and collective modes This commit introduces a more flexible approach to calculating segmentation statistics by: - Adding a new SegmentStatsCalculator to manage segment-specific statistics - Supporting both 'individual' and 'collective' computation modes - Refactoring VolumetricCalculator and BasicStatsCalculator to support more dynamic statistical analysis - Updating segmentation statistics worker to use the new calculation method - Improving example code to demonstrate new statistics calculation features
…at/multi-getStats
✅ Deploy Preview for cornerstone-3d-docs canceled.
|
} | ||
): NamedStatistics { | ||
const { spacing } = options; | ||
const volumeUnit = spacing ? 'mm³' : 'voxels³'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add methods to getCalibratedLengthUnitsAndScale to get the appropriate volume unit. Also, voxel is the unit, voxels^3 would be a 9 dimensional hyper cube.
…tion statistics - Add volume unit and calibration support to getCalibratedLengthUnitsAndScale - Update VolumetricCalculator and SegmentStatsCalculator to include calibration and pixel spacing options - Improve volume statistics calculation with more flexible unit and scaling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces an instantiable segment statistics calculator to compute statistics for segmentation data either collectively or individually. Key changes include:
- Adding a new class (SegmentStatsCalculator) to create and manage per‐segment or combined volumetric calculators.
- Adapting the compute worker and related utility functions to work with the new calculator API.
- Refactoring existing basic statistics calculators and updating examples and helpers to support the new mode parameter.
Reviewed Changes
File | Description |
---|---|
packages/tools/src/utilities/segmentation/SegmentStatsCalculator.ts | New class to manage individual and collective segment statistics |
packages/tools/src/utilities/segmentation/VolumetricCalculator.ts | Refactored state management and statistics calculation for volumes |
packages/tools/src/utilities/segmentation/getStatistics.ts | Added mode parameter handling (collective vs individual) |
packages/tools/examples/labelmapStatistics/index.ts | Updated UI to include direct control for individual/collective modes |
packages/tools/src/utilities/math/basic/BasicStatsCalculator.ts | Refactored to use a state-based approach for accumulating stats |
packages/tools/src/workers/computeWorker.js | Switched to using SegmentStatsCalculator in place of VolumetricCalculator |
packages/tools/src/utilities/getCalibratedUnits.ts | Updated to provide calibrated volume units |
packages/tools/src/utilities/segmentation/index.ts | Updated exports to include the new SegmentStatsCalculator |
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
…at/multi-getStats
This commit adds screenshot test images for various segmentation tools (circular brush, scissor, eraser, and sphere brush) across Chromium and WebKit browsers. It also removes two deprecated threshold brush tests for bone and fat segmentation.
921e458
to
7030468
Compare
Introducing Instantiable Calculators
Sometimes, a static calculator just isn't enough. For example, if you want to loop through all the labelmap data and calculate statistics for each segment, you'll need to use separate calculators for each one.
Segment Statistics Calculation:
SegmentStatsCalculator
to manage statistics for multiple segments, supporting both individual and collective modes for more versatile statistics calculations.