feature(segmentation): Add contour tools and utilities in a side panel (#5517)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-10-29 14:15:52 -04:00
1 parent ab440f086a
commit 35bfc9b0cc
73 files changed
+2770 -435

No files matched your search

@@ -117,6 +117,13 @@ Let's look at one of the evaluators (for `evaluate.cornerstoneTool`)
as you can see the job of this evaluator is to determine if the button should be disabled or not. It does so by checking the `toolGroup` and the `toolName` and then returns an object with `disabled` and `className` properties.
Various information can be returned by an evaluator. In particular...
- `disabled`: flag indicating if the tool should be disabled or not
- `disabledText`: the text or tooltip to show if the `disabled` flag above is set to `true`
- `visible`: flag indicating if the tool show be visible or not; this is a convenient way to force a tool to hide based on some custom (evaluator) logic
- `isActive`: flag to indicating where the tool is currently active or not
- `className`: custom CSS class names to add to the tool's component
The following evaluators are provided by us:
- `evaluate.cornerstoneTool`: If assigned to a button (see next), it will make the button react to the active viewport state based on its toolGroup.
@@ -34,6 +34,17 @@ createLabelmapForDisplaySet(
}
}
)
createContourForDisplaySet(
displaySet,
{
segmentationId?: string,
label: string,
segments?: {
[segmentIndex: number]: Partial<Segment>
}
}
)
```
### Segmentation Management
@@ -85,17 +96,33 @@ interface Segmentation {
## Code Examples
### Creating a Segmentation
### Creating a Label Map Segmentation
```typescript
const displaySet = displaySetService.getDisplaySetByUID(displaySetUID);
const segmentationId = await segmentationService.createLabelmapForDisplaySet(
displaySet,
{
label: 'New Segmentation',
label: 'New Label Map Segmentation',
segments: {
1: {
label: 'First Segment',
label: 'First Label Map Segment',
active: true
}
}
}
);
### Creating a Label Map Segmentation
const displaySet = displaySetService.getDisplaySetByUID(displaySetUID);
const segmentationId = await segmentationService.createContourForDisplaySet(
displaySet,
{
label: 'New Contour Segmentation',
segments: {
1: {
label: 'First Contour Segment',
active: true
}
}