feat(CircleROITools) : Added new handles to the CircleROITools - #2122
Conversation
sedghi
left a comment
There was a problem hiding this comment.
can we have a configuration said simplified: true, and if it is false all of these appear?
|
I've made the changes, now when the configuration says |
…to add-new-handles
rodrigobasilio2022
left a comment
There was a problem hiding this comment.
Looks good to me. Just one minor question related to the duplication of the center information
…to add-new-handles
|
Hi there if this PR is OK can it be merged ? |
|
@rodrigobasilio2022 can you try it in local example and then merge? |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a configurable simplified mode for both CircleROITool and CircleROIStartEndThresholdTool, toggling between a 2-handle (center + radius) and a 5-handle (center, top, bottom, left, right) representation. Type definitions, drawing/modification callbacks, and rendering routines have been updated to support the new multi-handle scenario.
- Extended annotation types to support five points when
simplified: false. - Added a
simplifiedflag and branched logic throughout both tools. - Updated rendering, drag, and slice-projection logic to handle five handles.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/tools/src/types/ToolSpecificAnnotationTypes.ts | Updated points tuple for circle annotations to five handles |
| packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts | Introduced simplified config, branched logic for handle arrays |
| packages/tools/src/tools/annotation/CircleROITool.ts | Mirrored simplified changes, updated draw/modify callbacks |
| packages/tools/examples/.../index.ts | Enabled simplified example in segmentation demo |
Comments suppressed due to low confidence (2)
packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts:86
- There are no tests verifying both
simplifiedmodes (2-handle vs 5-handle). Consider adding unit or integration tests to cover drawing, modifying, and rendering behaviors whensimplifiedisfalse(5-handle mode).
//Simplified handles, if false (5 handles : center, top, bottom, left, right)
packages/tools/src/tools/annotation/CircleROITool.ts:287
- The variable
canvasCoordsis undefined in this scope. It should likely becanvasHandles[1]to match the center-plus-radius usage.
const radiusPoint = getCanvasCircleRadius([canvasCenter, canvasCoords]);
| }; | ||
| handles: { | ||
| points: [Types.Point3, Types.Point3]; // [center, end] | ||
| points: Types.Point3[]; // [center, top, bottom, left, right] |
There was a problem hiding this comment.
The points type for CircleROIStartEndThresholdAnnotation is a general Types.Point3[], which can lead to inconsistent tuple lengths. Consider defining it as a fixed-length tuple [Types.Point3, Types.Point3, Types.Point3, Types.Point3, Types.Point3] to reflect exactly five handles.
| points: Types.Point3[]; // [center, top, bottom, left, right] | |
| points: [Types.Point3, Types.Point3, Types.Point3, Types.Point3, Types.Point3]; // [center, top, bottom, left, right] |
rodrigobasilio2022
left a comment
There was a problem hiding this comment.
Thanks for the contribution
Context
Added new handles for the CircleROITool and CircleROIStartEndThreshold.
There is now 5 handles (center , top, bottom, left and right).
Changes & Results
Before :

After :

Testing
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment