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

@@ -38,7 +38,10 @@ export const TOOLBAR_SECTIONS = {
},
// mode specific
segmentationToolbox: 'segmentationToolbox',
labelMapSegmentationToolbox: 'labelMapSegmentationToolbox',
contourSegmentationToolbox: 'contourSegmentationToolbox',
labelMapSegmentationUtilities: 'labelMapSegmentationUtilities',
contourSegmentationUtilities: 'contourSegmentationUtilities',
dynamicToolbox: 'dynamic-toolbox',
roiThresholdToolbox: 'ROIThresholdToolbox',
};
@@ -314,12 +317,22 @@ export default class ToolbarService extends PubSubService {
: undefined;
// Check hideWhenDisabled at both evaluateProps level and props level
const hideWhenDisabled = evaluateProps?.hideWhenDisabled || props.hideWhenDisabled;
// Visibility is first determined by the evaluate function. If it is not returned from there,
// then we check hideWhenDisabled and disabled to determine visibility.
const visible =
evaluated?.visible === undefined
? hideWhenDisabled && evaluated?.disabled
? false
: true
: evaluated?.visible;
const updatedProps = {
...props,
...evaluated,
disabled: evaluated?.disabled || false,
visible: hideWhenDisabled && evaluated?.disabled ? false : true,
className: evaluated?.className || '',
visible,
className: evaluated?.className || props?.className || '',
isActive: evaluated?.isActive, // isActive will be undefined for buttons without this prop
};
evaluationResults.set(button.id, updatedProps);
@@ -570,7 +583,8 @@ export default class ToolbarService extends PubSubService {
btn.component = buttonType.defaultComponent;
}
if (!buttonType) {
if (!buttonType && !btn.component) {
console.warn(`Neither button type nor a component found for button: ${id}`);
return;
}
@@ -34,7 +34,7 @@ export type EvaluateObject = {
export type ButtonOptions = {
id: string;
type: 'range' | 'radio' | 'double-range' | 'custom';
type: 'range' | 'radio' | 'double-range' | 'custom' | 'checkbox' | 'select' | 'button';
name?: string;
min?: number;
max?: number;
@@ -59,6 +59,7 @@ export type ButtonProps = {
listeners?: Record<string, RunCommand>;
options?: ButtonOptions[];
buttonSection?: string | boolean;
isActive?: boolean;
};
export type Button = {