From d0500df27f0af864549b37f4465b61cc16b45d9d Mon Sep 17 00:00:00 2001 From: Jorge Lopes Date: Fri, 28 Jun 2024 17:09:17 +0100 Subject: [PATCH 1/3] fix: adding missing types --- packages/tools/src/types/index.ts | 40 +++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/packages/tools/src/types/index.ts b/packages/tools/src/types/index.ts index 901032fe1..da4375d49 100644 --- a/packages/tools/src/types/index.ts +++ b/packages/tools/src/types/index.ts @@ -7,6 +7,7 @@ import type { import type { ContourAnnotationData, ContourAnnotation, + ContourWindingDirection, } from './ContourAnnotation'; import type { ContourSegmentationAnnotationData, @@ -43,15 +44,20 @@ import type SVGDrawingHelper from './SVGDrawingHelper'; import type * as CINETypes from './CINETypes'; import type { RepresentationConfig, + RepresentationPublicInput, + RepresentationPublicInputOptions, + SegmentSpecificRepresentationConfig, + Segmentation, + SegmentationPublicInput, SegmentationRepresentationConfig, SegmentationRepresentationData, - Segmentation, - ToolGroupSpecificRepresentationState, + SegmentationState, ToolGroupSpecificContourRepresentation, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, - SegmentationState, - RepresentationPublicInput, + ToolGroupSpecificRepresentationState, + ToolGroupSpecificRepresentations, + ToolGroupSpecificSurfaceRepresentation, } from './SegmentationStateTypes'; import { ISculptToolShape } from './ISculptToolShape'; import type ISynchronizerEventHandler from './ISynchronizerEventHandler'; @@ -69,12 +75,14 @@ import type { Statistics, NamedStatistics } from './CalculatorTypes'; import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners'; import { LabelmapToolOperationData, + LabelmapToolOperationDataAny, LabelmapToolOperationDataStack, LabelmapToolOperationDataVolume, } from './LabelmapToolOperationData'; import type { - InterpolationViewportData, + AcceptInterpolationSelector, ImageInterpolationData, + InterpolationViewportData, } from './InterpolationTypes'; // Splines @@ -94,15 +102,17 @@ export type { // AnnotationState Annotation, Annotations, - ContourAnnotationData, ContourAnnotation, + ContourAnnotationData, + ContourWindingDirection, ContourSegmentationAnnotationData, ContourSegmentationAnnotation, BidirectionalData, CanvasCoordinates, IAnnotationManager, - InterpolationViewportData, + AcceptInterpolationSelector, ImageInterpolationData, + InterpolationViewportData, GroupSpecificAnnotations, AnnotationState, AnnotationStyle, @@ -135,16 +145,21 @@ export type { AnnotationHandle, TextBoxHandle, // Segmentation + RepresentationConfig, + RepresentationPublicInput, + RepresentationPublicInputOptions, + SegmentSpecificRepresentationConfig, Segmentation, - SegmentationState, - SegmentationRepresentationData, + SegmentationPublicInput, SegmentationRepresentationConfig, - RepresentationConfig, - ToolGroupSpecificRepresentationState, + SegmentationRepresentationData, + SegmentationState, ToolGroupSpecificContourRepresentation, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, - RepresentationPublicInput, + ToolGroupSpecificRepresentationState, + ToolGroupSpecificRepresentations, + ToolGroupSpecificSurfaceRepresentation, LabelmapTypes, // Cursors SVGCursorDescriptor, @@ -168,6 +183,7 @@ export type { // Labelmap data LabelmapToolOperationData, + LabelmapToolOperationDataAny, LabelmapToolOperationDataStack, LabelmapToolOperationDataVolume, // Splines From 3f8f90decd912a5afaca800b3d1063675282ace9 Mon Sep 17 00:00:00 2001 From: Jorge Lopes Date: Fri, 28 Jun 2024 17:10:40 +0100 Subject: [PATCH 2/3] fix: order --- packages/tools/src/types/index.ts | 164 ++++++++++++++++++------------ 1 file changed, 99 insertions(+), 65 deletions(-) diff --git a/packages/tools/src/types/index.ts b/packages/tools/src/types/index.ts index da4375d49..f02d38e81 100644 --- a/packages/tools/src/types/index.ts +++ b/packages/tools/src/types/index.ts @@ -1,47 +1,67 @@ +// AnnotationState +import type * as AnnotationStyle from './AnnotationStyle'; +import type * as ToolSpecificAnnotationTypes from './ToolSpecificAnnotationTypes'; +import type AnnotationGroupSelector from './AnnotationGroupSelector'; +import type IAnnotationManager from './IAnnotationManager'; +import type JumpToSliceOptions from './JumpToSliceOptions'; +import type { + AcceptInterpolationSelector, + ImageInterpolationData, + InterpolationViewportData, +} from './InterpolationTypes'; import type { Annotation, - Annotations, AnnotationState, + Annotations, GroupSpecificAnnotations, } from './AnnotationTypes'; +import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners'; import type { - ContourAnnotationData, ContourAnnotation, + ContourAnnotationData, ContourWindingDirection, } from './ContourAnnotation'; import type { - ContourSegmentationAnnotationData, ContourSegmentationAnnotation, + ContourSegmentationAnnotationData, } from './ContourSegmentationAnnotation'; + +// Rendering +import type AnnotationRenderContext from './AnnotationRenderContext'; + +// Geometry +import type PlanarBoundingBox from './PlanarBoundingBox'; +import type { + ToolProps, + PublicToolProps, + ToolConfiguration, +} from './ToolProps'; + +// Event data import type * as EventTypes from './EventTypes'; -import type * as LabelmapTypes from './LabelmapTypes'; +import type IDistance from './IDistance'; import type IPoints from './IPoints'; import type ITouchPoints from './ITouchPoints'; -import type IDistance from './IDistance'; -import type PlanarBoundingBox from './PlanarBoundingBox'; + +// ToolBindings +import type InteractionTypes from './InteractionTypes'; +import type ToolAction from './ToolAction'; import type { - SetToolBindingsType, IToolBinding, + SetToolBindingsType, ToolOptionsType, } from './ISetToolModeOptions'; + +// +import type ISynchronizerEventHandler from './ISynchronizerEventHandler'; +import type IToolClassReference from './IToolClassReference'; import type IToolGroup from '../store/ToolGroupManager/ToolGroup'; -import type * as ToolSpecificAnnotationTypes from './ToolSpecificAnnotationTypes'; -import type * as AnnotationStyle from './AnnotationStyle'; import type ToolHandle from './ToolHandle'; import type { AnnotationHandle, TextBoxHandle } from './ToolHandle'; -import type InteractionTypes from './InteractionTypes'; -import type ToolAction from './ToolAction'; -import type { - ToolProps, - PublicToolProps, - ToolConfiguration, -} from './ToolProps'; -import type { SVGCursorDescriptor, SVGPoint } from './CursorTypes'; -import type JumpToSliceOptions from './JumpToSliceOptions'; -import type ScrollOptions from './ScrollOptions'; -import type BoundsIJK from './BoundsIJK'; -import type SVGDrawingHelper from './SVGDrawingHelper'; -import type * as CINETypes from './CINETypes'; +import { ISculptToolShape } from './ISculptToolShape'; + +// Segmentation +import type * as LabelmapTypes from './LabelmapTypes'; import type { RepresentationConfig, RepresentationPublicInput, @@ -59,33 +79,45 @@ import type { ToolGroupSpecificRepresentations, ToolGroupSpecificSurfaceRepresentation, } from './SegmentationStateTypes'; -import { ISculptToolShape } from './ISculptToolShape'; -import type ISynchronizerEventHandler from './ISynchronizerEventHandler'; + +// Cursors +import type { SVGCursorDescriptor, SVGPoint } from './CursorTypes'; + +// Scroll +import type ScrollOptions from './ScrollOptions'; + +// Cine +import type BoundsIJK from './BoundsIJK'; +import type * as CINETypes from './CINETypes'; +import type SVGDrawingHelper from './SVGDrawingHelper'; + +// FloodFill import type { FloodFillGetter, FloodFillOptions, FloodFillResult, } from './FloodFillTypes'; -import type IToolClassReference from './IToolClassReference'; -import type { ContourSegmentationData } from './ContourTypes'; -import type IAnnotationManager from './IAnnotationManager'; -import type AnnotationGroupSelector from './AnnotationGroupSelector'; -import type AnnotationRenderContext from './AnnotationRenderContext'; -import type { Statistics, NamedStatistics } from './CalculatorTypes'; -import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners'; + +// Contour +import type { + ContourConfig, + ContourRenderingConfig, + ContourSegmentationData, +} from './ContourTypes'; + +// Statistics +import type { NamedStatistics, Statistics } from './CalculatorTypes'; + +// Labelmap import { LabelmapToolOperationData, LabelmapToolOperationDataAny, LabelmapToolOperationDataStack, LabelmapToolOperationDataVolume, } from './LabelmapToolOperationData'; -import type { - AcceptInterpolationSelector, - ImageInterpolationData, - InterpolationViewportData, -} from './InterpolationTypes'; // Splines +import type { BidirectionalData } from '../utilities/segmentation/createBidirectionalToolData'; import type { CardinalSplineProps } from './CardinalSplineProps'; import type { ClosestControlPoint } from './ClosestControlPoint'; import type { ClosestPoint } from './ClosestPoint'; @@ -95,56 +127,59 @@ import type { ISpline } from './ISpline'; import type { SplineCurveSegment } from './SplineCurveSegment'; import type { SplineLineSegment } from './SplineLineSegment'; import type { SplineProps } from './SplineProps'; -import type { BidirectionalData } from '../utilities/segmentation/createBidirectionalToolData'; + +// PolySeg import type { PolySegConversionOptions } from './PolySeg'; export type { // AnnotationState + AcceptInterpolationSelector, Annotation, + AnnotationGroupSelector, + AnnotationState, + AnnotationStyle, Annotations, + BidirectionalData, + CanvasCoordinates, ContourAnnotation, ContourAnnotationData, - ContourWindingDirection, - ContourSegmentationAnnotationData, ContourSegmentationAnnotation, - BidirectionalData, - CanvasCoordinates, + ContourSegmentationAnnotationData, + ContourWindingDirection, + GroupSpecificAnnotations, IAnnotationManager, - AcceptInterpolationSelector, ImageInterpolationData, InterpolationViewportData, - GroupSpecificAnnotations, - AnnotationState, - AnnotationStyle, - ToolSpecificAnnotationTypes, JumpToSliceOptions, - AnnotationGroupSelector, + ToolSpecificAnnotationTypes, // Rendering AnnotationRenderContext, // Geometry PlanarBoundingBox, - ToolProps, PublicToolProps, ToolConfiguration, + ToolProps, // Event data EventTypes, + IDistance, IPoints, ITouchPoints, - IDistance, // ToolBindings IToolBinding, - SetToolBindingsType, - ToolOptionsType, InteractionTypes, + SetToolBindingsType, ToolAction, + ToolOptionsType, // - IToolGroup, - IToolClassReference, - ISynchronizerEventHandler, - ToolHandle, AnnotationHandle, + ISculptToolShape, + ISynchronizerEventHandler, + IToolClassReference, + IToolGroup, TextBoxHandle, + ToolHandle, // Segmentation + LabelmapTypes, RepresentationConfig, RepresentationPublicInput, RepresentationPublicInputOptions, @@ -160,28 +195,27 @@ export type { ToolGroupSpecificRepresentationState, ToolGroupSpecificRepresentations, ToolGroupSpecificSurfaceRepresentation, - LabelmapTypes, // Cursors SVGCursorDescriptor, SVGPoint, // Scroll ScrollOptions, - // CINE - CINETypes, + // Cine BoundsIJK, + CINETypes, SVGDrawingHelper, // FloodFill - FloodFillResult, FloodFillGetter, FloodFillOptions, + FloodFillResult, // Contour + ContourConfig, + ContourRenderingConfig, ContourSegmentationData, - ISculptToolShape, - //Statistics - Statistics, + // Statistics NamedStatistics, - - // Labelmap data + Statistics, + // Labelmap LabelmapToolOperationData, LabelmapToolOperationDataAny, LabelmapToolOperationDataStack, @@ -196,6 +230,6 @@ export type { SplineCurveSegment, SplineLineSegment, SplineProps, - // polySeg + // PolySeg PolySegConversionOptions, }; From f2019bbc06abff8648cd8ea5de24ca2e1013af24 Mon Sep 17 00:00:00 2001 From: Jorge Lopes Date: Fri, 28 Jun 2024 17:16:12 +0100 Subject: [PATCH 3/3] update api --- common/reviews/api/tools.api.md | 144 +++++++++++++++++++++++++------- 1 file changed, 115 insertions(+), 29 deletions(-) diff --git a/common/reviews/api/tools.api.md b/common/reviews/api/tools.api.md index b96c1069a..42689c89d 100644 --- a/common/reviews/api/tools.api.md +++ b/common/reviews/api/tools.api.md @@ -34,6 +34,14 @@ declare namespace aabb { // @public (undocumented) function acceptAutogeneratedInterpolations(annotationGroupSelector: AnnotationGroupSelector, selector: AcceptInterpolationSelector): void; +// @public (undocumented) +type AcceptInterpolationSelector = { + toolNames?: string[]; + segmentationId?: string; + segmentIndex?: number; + sliceIndex?: number; +}; + declare namespace activeSegmentation { export { getActiveSegmentationRepresentation, @@ -1259,7 +1267,7 @@ export class CircleScissorsTool extends BaseTool { function clearParentAnnotation(annotation: Annotation): void; // @public (undocumented) -function clip(a: any, b: any, box: any, da?: any, db?: any): 1 | 0; +function clip(a: any, b: any, box: any, da?: any, db?: any): 0 | 1; // @public (undocumented) function clip_2(val: number, low: number, high: number): number; @@ -1601,6 +1609,27 @@ type ContourAnnotationData = { onInterpolationComplete?: () => void; }; +// @public (undocumented) +type ContourConfig = { + outlineWidthAutoGenerated?: number; + outlineWidthActive?: number; + outlineWidthInactive?: number; + outlineOpacity?: number; + outlineOpacityInactive?: number; + outlineDashActive?: string; + outlineDashInactive?: string; + activeSegmentOutlineWidthDelta?: number; + outlineDashAutoGenerated?: string; + renderOutline?: boolean; + renderFill?: boolean; + fillAlpha?: number; + fillAlphaInactive?: number; + fillAlphaAutoGenerated?: number; +}; + +// @public (undocumented) +type ContourRenderingConfig = {}; + declare namespace contours { export { areCoplanarContours, @@ -1660,6 +1689,16 @@ type ContourSegmentationData = { annotationUIDsMap?: Map>; }; +// @public (undocumented) +enum ContourWindingDirection { + // (undocumented) + Clockwise = 1, + // (undocumented) + CounterClockwise = -1, + // (undocumented) + Unknown = 0 +} + // @public (undocumented) type ControlPointInfo = { index: number; @@ -3345,6 +3384,9 @@ type LabelmapToolOperationData = { toolGroupId: string; }; +// @public (undocumented) +type LabelmapToolOperationDataAny = LabelmapToolOperationDataVolume | LabelmapToolOperationDataStack; + // @public (undocumented) type LabelmapToolOperationDataStack = LabelmapToolOperationData & LabelmapSegmentationDataStack; @@ -4717,6 +4759,16 @@ type RepresentationPublicInput = { options?: RepresentationPublicInputOptions; }; +// @public (undocumented) +type RepresentationPublicInputOptions = { + segmentationRepresentationUID?: string; + colorLUTOrIndex?: Types_2.ColorLUT | number; + polySeg?: { + enabled: boolean; + options?: any; + }; +}; + // @public (undocumented) function resetAnnotationManager(): void; @@ -4943,6 +4995,15 @@ type SegmentationModifiedEventDetail = { // @public (undocumented) type SegmentationModifiedEventType = Types_2.CustomEventType; +// @public (undocumented) +type SegmentationPublicInput = { + segmentationId: string; + representation: { + type: Enums.SegmentationRepresentations; + data?: LabelmapSegmentationData | ContourSegmentationData | SurfaceSegmentationData; + }; +}; + // @public (undocumented) type SegmentationRemovedEventDetail = { segmentationId: string; @@ -5056,6 +5117,11 @@ export class SegmentSelectTool extends BaseTool { static toolName: any; } +// @public (undocumented) +type SegmentSpecificRepresentationConfig = { + [key: number | string]: RepresentationConfig; +}; + declare namespace selection { export { setAnnotationSelected, @@ -5779,6 +5845,9 @@ type ToolGroupSpecificLabelmapRepresentation = ToolGroupSpecificRepresentationSt // @public (undocumented) type ToolGroupSpecificRepresentation = ToolGroupSpecificLabelmapRepresentation | ToolGroupSpecificContourRepresentation; +// @public (undocumented) +type ToolGroupSpecificRepresentations = Array; + // @public (undocumented) type ToolGroupSpecificRepresentationState = { segmentationRepresentationUID: string; @@ -5793,6 +5862,13 @@ type ToolGroupSpecificRepresentationState = { }; }; +// @public (undocumented) +type ToolGroupSpecificSurfaceRepresentation = ToolGroupSpecificRepresentationState & { + config: SurfaceRenderingConfig; + segmentationRepresentationSpecificConfig?: RepresentationConfig; + segmentSpecificConfig?: SegmentSpecificRepresentationConfig; +}; + // @public (undocumented) type ToolHandle = AnnotationHandle | TextBoxHandle; @@ -6008,68 +6084,78 @@ function triggerSegmentationRepresentationRemoved(toolGroupId: string, segmentat declare namespace Types { export { + AcceptInterpolationSelector, Annotation, + AnnotationGroupSelector, + AnnotationState, + AnnotationStyle, Annotations, - ContourAnnotationData, - ContourAnnotation, - ContourSegmentationAnnotationData, - ContourSegmentationAnnotation, BidirectionalData, CanvasCoordinates, + ContourAnnotation, + ContourAnnotationData, + ContourSegmentationAnnotation, + ContourSegmentationAnnotationData, + ContourWindingDirection, + GroupSpecificAnnotations, IAnnotationManager, - InterpolationViewportData, ImageInterpolationData, - GroupSpecificAnnotations, - AnnotationState, - AnnotationStyle, - ToolSpecificAnnotationTypes, + InterpolationViewportData, JumpToSliceOptions, - AnnotationGroupSelector, + ToolSpecificAnnotationTypes, AnnotationRenderContext, PlanarBoundingBox, - ToolProps, PublicToolProps, ToolConfiguration, + ToolProps, EventTypes_2 as EventTypes, + IDistance, IPoints, ITouchPoints, - IDistance, IToolBinding, - SetToolBindingsType, - ToolOptionsType, InteractionTypes, + SetToolBindingsType, ToolAction, - ToolGroup as IToolGroup, - IToolClassReference, - ISynchronizerEventHandler, - ToolHandle, + ToolOptionsType, AnnotationHandle, + ISculptToolShape, + ISynchronizerEventHandler, + IToolClassReference, + ToolGroup as IToolGroup, TextBoxHandle, + ToolHandle, + LabelmapTypes, + RepresentationConfig, + RepresentationPublicInput, + RepresentationPublicInputOptions, + SegmentSpecificRepresentationConfig, Segmentation, - SegmentationState, - SegmentationRepresentationData, + SegmentationPublicInput, SegmentationRepresentationConfig, - RepresentationConfig, - ToolGroupSpecificRepresentationState, + SegmentationRepresentationData, + SegmentationState, ToolGroupSpecificContourRepresentation, ToolGroupSpecificLabelmapRepresentation, ToolGroupSpecificRepresentation, - RepresentationPublicInput, - LabelmapTypes, + ToolGroupSpecificRepresentationState, + ToolGroupSpecificRepresentations, + ToolGroupSpecificSurfaceRepresentation, SVGCursorDescriptor, SVGPoint_2 as SVGPoint, ScrollOptions_2 as ScrollOptions, - CINETypes, BoundsIJK_2 as BoundsIJK, + CINETypes, SVGDrawingHelper, - FloodFillResult, FloodFillGetter, FloodFillOptions, + FloodFillResult, + ContourConfig, + ContourRenderingConfig, ContourSegmentationData, - ISculptToolShape, - Statistics, NamedStatistics, + Statistics, LabelmapToolOperationData, + LabelmapToolOperationDataAny, LabelmapToolOperationDataStack, LabelmapToolOperationDataVolume, CardinalSplineProps,