Skip to content

Commit

Permalink
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
Browse files Browse the repository at this point in the history
…w-polyseg-wasm
  • Loading branch information
sedghi committed Feb 6, 2024
2 parents 14121a5 + a441c58 commit 5b16161
Show file tree
Hide file tree
Showing 44 changed files with 1,138 additions and 246 deletions.
89 changes: 82 additions & 7 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function addAnnotation(annotation: Annotation, annotationGroupSelector: Annotati
// @public (undocumented)
const addCanvasPointsToArray: (element: HTMLDivElement, canvasPoints: Types_2.Point2[], newCanvasPoint: Types_2.Point2, commonData: PlanarFreehandROICommonData) => number;

// @public (undocumented)
function addChildAnnotation(parentAnnotation: Annotation, childAnnotation: Annotation): void;

// @public (undocumented)
function addColorLUT(colorLUT: Types_2.ColorLUT, index: number): void;

Expand Down Expand Up @@ -226,6 +229,8 @@ export class AngleTool extends AnnotationTool {
// @public (undocumented)
type Annotation = {
annotationUID?: string;
parentAnnotationUID?: string;
childAnnotationUIDs?: string[];
highlighted?: boolean;
isLocked?: boolean;
isVisible?: boolean;
Expand Down Expand Up @@ -1077,6 +1082,9 @@ export class CircleScissorsTool extends BaseTool {
static toolName: any;
}

// @public (undocumented)
function clearParentAnnotation(annotation: Annotation): void;

// @public (undocumented)
function clip(a: any, b: any, box: any, da?: any, db?: any): 0 | 1;

Expand Down Expand Up @@ -1389,18 +1397,27 @@ export { CONSTANTS }
// @public (undocumented)
function containsPoint(polyline: Types_2.Point2[], point: Types_2.Point2, closed?: boolean): boolean;

// @public (undocumented)
function containsPoints(polyline: Types_2.Point2[], points: Types_2.Point2[]): boolean;

// @public (undocumented)
function contourAndFindLargestBidirectional(segmentation: any): any;

// @public (undocumented)
type ContourAnnotation = Annotation & ContourAnnotationData;

// @public (undocumented)
type ContourAnnotationCompletedEventDetail = AnnotationCompletedEventDetail & {
contourHoleProcessingEnabled: boolean;
};

// @public (undocumented)
type ContourAnnotationData = {
data: {
contour: {
polyline: Types_2.Point3[];
closed: boolean;
windingDirection?: ContourWindingDirection;
};
};
};
Expand All @@ -1413,6 +1430,9 @@ declare namespace contours {
_default_3 as detectContourHoles,
generateContourSetsFromLabelmap,
AnnotationToPointData,
getContourHolesDataWorld,
getContourHolesDataCanvas,
updateContourPolyline,
interpolation,
acceptAutogeneratedInterpolations,
findHandlePolylineIndex
Expand Down Expand Up @@ -1802,6 +1822,7 @@ declare namespace drawing {
drawHandle,
drawLine,
drawPolyline,
drawPath,
drawLinkedTextBox,
drawRect,
drawTextBox,
Expand All @@ -1825,6 +1846,17 @@ function drawLine(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, lin
// @public (undocumented)
function drawLinkedTextBox(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, textBoxUID: string, textLines: Array<string>, textBoxPosition: Types_2.Point2, annotationAnchorPoints: Array<Types_2.Point2>, textBox: unknown, options?: {}): SVGRect;

// @public (undocumented)
function drawPath(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, pathUID: string, points: Types_2.Point2[] | Types_2.Point2[][], options: {
color?: string;
fillColor?: string;
fillOpacity?: number;
width?: number;
lineWidth?: number;
lineDash?: string;
closePath?: boolean;
}): void;

// @public (undocumented)
function drawPolyline(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, polylineUID: string, points: Types_2.Point2[], options: {
color?: string;
Expand All @@ -1833,7 +1865,7 @@ function drawPolyline(svgDrawingHelper: SVGDrawingHelper, annotationUID: string,
width?: number;
lineWidth?: number;
lineDash?: string;
connectLastToFirst?: boolean;
closePath?: boolean;
}): void;

// @public (undocumented)
Expand Down Expand Up @@ -2095,6 +2127,7 @@ declare namespace EventTypes_2 {
AnnotationInterpolationCompletedEventType,
AnnotationInterpolationRemovedEventDetail,
AnnotationInterpolationRemovedEventType,
ContourAnnotationCompletedEventDetail,
SegmentationDataModifiedEventType,
SegmentationRepresentationModifiedEventDetail,
SegmentationRepresentationModifiedEventType,
Expand Down Expand Up @@ -2323,6 +2356,9 @@ const getCalibratedScale: (image: any, handles?: any[]) => any;
// @public (undocumented)
function getCanvasEllipseCorners(ellipseCanvasPoints: CanvasCoordinates): Array<Types_2.Point2>;

// @public (undocumented)
function getChildAnnotations(annotation: Annotation): Annotation[];

// @public (undocumented)
function getClosestLineSegmentIntersection(points: Types_2.Point2[], p1: Types_2.Point2, q1: Types_2.Point2, closed?: boolean): {
segment: Types_2.Point2;
Expand All @@ -2335,6 +2371,12 @@ function getColorForSegmentIndex(toolGroupId: string, segmentationRepresentation
// @public (undocumented)
function getColorLUT(index: number): Types_2.ColorLUT | undefined;

// @public (undocumented)
function getContourHolesDataCanvas(annotation: Annotation, viewport: Types_2.IViewport): Types_2.Point2[][];

// @public (undocumented)
function getContourHolesDataWorld(annotation: Annotation): Types_2.Point3[][];

// @public (undocumented)
function getDataInTime(dynamicVolume: Types_2.IDynamicImageVolume, options: {
frameNumbers?: any;
Expand Down Expand Up @@ -2414,6 +2456,9 @@ function getNumberOfAnnotations(toolName: string, annotationGroupSelector: Annot
// @public (undocumented)
function getOrientationStringLPS(vector: Types_2.Point3): string;

// @public (undocumented)
function getParentAnnotation(annotation: Annotation): Annotation;

// @public (undocumented)
function getPoint(points: any, idx: any): Types_2.Point3;

Expand Down Expand Up @@ -2520,6 +2565,9 @@ function getViewportForAnnotation(annotation: Annotation): IVolumeViewport_2 | I
// @public (undocumented)
function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string, requireParallelNormals?: boolean): string[];

// @public (undocumented)
function getWindingDirection(polyline: Types_2.Point2[]): number;

// @public (undocumented)
function getWorldWidthAndHeightFromCorners(viewPlaneNormal: Types_2.Point3, viewUp: Types_2.Point3, topLeftWorld: Types_2.Point3, bottomRightWorld: Types_2.Point3): {
worldWidth: number;
Expand Down Expand Up @@ -2654,6 +2702,9 @@ function intersectLine(line1Start: Types_2.Point2, line1End: Types_2.Point2, lin
// @public (undocumented)
function intersectPolyline(sourcePolyline: Types_2.Point2[], targetPolyline: Types_2.Point2[]): boolean;

// @public (undocumented)
function invalidateAnnotation(annotation: Annotation): void;

// @public (undocumented)
function invalidateBrushCursor(toolGroupId: string): void;

Expand Down Expand Up @@ -2709,6 +2760,8 @@ interface ISpline {
// (undocumented)
deleteControlPointByIndex(index: number): boolean;
// (undocumented)
get fixedResolution(): boolean;
// (undocumented)
getClosestControlPoint(point: Types_2.Point2): ClosestControlPoint;
// (undocumented)
getClosestControlPointWithinDistance(point: Types_2.Point2, range: number): ClosestControlPoint;
Expand Down Expand Up @@ -3201,6 +3254,7 @@ export class LivewireContourTool extends ContourSegmentationBaseTool {
worldToSlice?: (point: Types_2.Point3) => Types_2.Point2;
sliceToWorld?: (point: Types_2.Point2) => Types_2.Point3;
originalPath?: Types_2.Point3[];
contourHoleProcessingEnabled?: boolean;
} | null;
// (undocumented)
editHandle(worldPos: Types_2.Point3, element: any, annotation: any, handleIndex: number): void;
Expand Down Expand Up @@ -3233,19 +3287,19 @@ export class LivewireContourTool extends ContourSegmentationBaseTool {
// (undocumented)
protected scissorsRight: LivewireScissors;
// (undocumented)
protected setupBaseEditData(worldPos: any, element: any, annotation: any, rightPos?: any): void;
protected setupBaseEditData(worldPos: any, element: any, annotation: any, rightPos?: any, contourHoleProcessingEnabled?: any): void;
// (undocumented)
static toolName: string;
// (undocumented)
toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LivewireContourAnnotation) => void;
// (undocumented)
touchDragCallback: any;
// (undocumented)
triggerChangeEvent: (annotation: LivewireContourAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes) => void;
triggerChangeEvent: (annotation: LivewireContourAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes, contourHoleProcessingEnabled?: boolean) => void;
// (undocumented)
undo(element: any, config: any, evt: any): void;
// (undocumented)
protected updateAnnotation(_: any, livewirePath: LivewirePath): void;
protected updateAnnotation(livewirePath: LivewirePath): void;
}

declare namespace locking {
Expand Down Expand Up @@ -3757,9 +3811,11 @@ declare namespace polyline {
export {
isClosed,
containsPoint,
containsPoints,
getAABB,
getArea,
getSignedArea,
getWindingDirection,
getNormal3,
getNormal2,
intersectPolyline,
Expand Down Expand Up @@ -4818,6 +4874,7 @@ type SplineLineSegment = {
// @public (undocumented)
type SplineProps = {
resolution?: number;
fixedResolution?: boolean;
closed?: boolean;
};

Expand Down Expand Up @@ -4866,13 +4923,15 @@ export class SplineROITool extends ContourSegmentationBaseTool {
newAnnotation?: boolean;
hasMoved?: boolean;
lastCanvasPoint?: Types_2.Point2;
contourHoleProcessingEnabled?: boolean;
} | null;
// (undocumented)
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
// (undocumented)
fireChangeOnUpdate: {
annotationUID: string;
changeType: ChangeTypes;
contourHoleProcessingEnabled: boolean;
};
// (undocumented)
handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: SplineROIAnnotation, handle: ToolHandle) => void;
Expand All @@ -4885,6 +4944,8 @@ export class SplineROITool extends ContourSegmentationBaseTool {
// (undocumented)
isPointNearTool: (element: HTMLDivElement, annotation: SplineROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean;
// (undocumented)
_isSplineROIAnnotation(annotation: Annotation): annotation is SplineROIAnnotation;
// (undocumented)
mouseDragCallback: any;
// (undocumented)
protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean;
Expand All @@ -4899,11 +4960,11 @@ export class SplineROITool extends ContourSegmentationBaseTool {
// (undocumented)
touchDragCallback: any;
// (undocumented)
triggerAnnotationCompleted: (annotation: SplineROIAnnotation) => void;
triggerAnnotationCompleted: (annotation: SplineROIAnnotation, contourHoleProcessingEnabled: boolean) => void;
// (undocumented)
triggerAnnotationModified: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes) => void;
// (undocumented)
triggerChangeEvent: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes) => void;
triggerChangeEvent: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType: ChangeTypes, contourHoleProcessingEnabled: any) => void;
}

// @public (undocumented)
Expand Down Expand Up @@ -4965,14 +5026,19 @@ declare namespace state_2 {
export {
getAllAnnotations,
getAnnotations,
getParentAnnotation,
getChildAnnotations,
clearParentAnnotation,
addChildAnnotation,
getNumberOfAnnotations,
addAnnotation,
getAnnotation,
removeAnnotation,
removeAllAnnotations,
setAnnotationManager,
getAnnotationManager,
resetAnnotationManager
resetAnnotationManager,
invalidateAnnotation
}
}

Expand Down Expand Up @@ -5655,6 +5721,15 @@ export class UltrasoundDirectionalTool extends AnnotationTool {
// @public (undocumented)
function unlockAllAnnotations(): void;

// @public (undocumented)
function updateContourPolyline(annotation: ContourAnnotation, polylineData: {
points: Types_2.Point2[];
closed?: boolean;
targetWindingDirection?: ContourWindingDirection;
}, transforms: {
canvasToWorld: (point: Types_2.Point2) => Types_2.Point3;
}): void;

declare namespace utilities {
export {
math,
Expand Down
6 changes: 6 additions & 0 deletions packages/tools/examples/livewireContourSegmentation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const DEFAULT_SEGMENTATION_CONFIG = {
outlineDashInactive: undefined,
};

const { KeyboardBindings } = cornerstoneTools.Enums;

const {
SegmentationDisplayTool,
PlanarFreehandContourSegmentationTool,
Expand Down Expand Up @@ -324,6 +326,10 @@ async function run() {
{
mouseButton: MouseBindings.Primary, // Left Click
},
{
mouseButton: MouseBindings.Primary, // Left Click+Shift
modifierKey: KeyboardBindings.Shift,
},
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const DEFAULT_SEGMENTATION_CONFIG = {
outlineDashInactive: undefined,
};

const { KeyboardBindings } = cornerstoneTools.Enums;

const {
SegmentationDisplayTool,
PlanarFreehandContourSegmentationTool,
Expand Down Expand Up @@ -431,6 +433,10 @@ async function run() {
{
mouseButton: MouseBindings.Primary, // Left Click
},
{
mouseButton: MouseBindings.Primary, // Left Click
modifierKey: KeyboardBindings.Shift,
},
],
});

Expand Down
10 changes: 10 additions & 0 deletions packages/tools/examples/splineContourSegmentationTools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const DEFAULT_SEGMENTATION_CONFIG = {
outlineDashInactive: undefined,
};

const { KeyboardBindings } = cornerstoneTools.Enums;

const {
SplineContourSegmentationTool,
SegmentationDisplayTool,
Expand Down Expand Up @@ -212,6 +214,10 @@ addDropdownToToolbar({
{
mouseButton: MouseBindings.Primary, // Left Click
},
{
mouseButton: MouseBindings.Primary, // Left Click+Shift
modifierKey: KeyboardBindings.Shift,
},
],
});

Expand Down Expand Up @@ -364,6 +370,10 @@ async function run() {
{
mouseButton: MouseBindings.Primary, // Left Click
},
{
mouseButton: MouseBindings.Primary, // Left Click+Shift
modifierKey: KeyboardBindings.Shift,
},
],
});

Expand Down
Loading

0 comments on commit 5b16161

Please sign in to comment.