Skip to content

Commit

Permalink
chore(export): spline classes for custom spline tool creation
Browse files Browse the repository at this point in the history
Co-authored-by: Sweet, Jon <[email protected]>
  • Loading branch information
JSweet314 and Sweet, Jon authored Dec 18, 2024
1 parent 0bb31a1 commit 4142eef
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 0 deletions.
132 changes: 132 additions & 0 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,12 @@ export class BrushTool extends LabelmapBaseTool {
protected updateCursor(evt: EventTypes_2.InteractionEventType): void;
}

// @public (undocumented)
class BSpline extends CubicSpline {
// (undocumented)
protected getTransformMatrix(): number[];
}

// @public (undocumented)
function calculateMinMaxMean(pixelLuminance: any, globalMin: any, globalMax: any): {
min: any;
Expand Down Expand Up @@ -936,12 +942,29 @@ Types_2.Point2,
Types_2.Point2
];

// @public (undocumented)
class CardinalSpline extends CubicSpline {
constructor(props?: CardinalSplineProps);
// (undocumented)
get fixedScale(): boolean;
// (undocumented)
protected getTransformMatrix(): number[];
// (undocumented)
get scale(): number;
set scale(scale: number);
}

// @public (undocumented)
type CardinalSplineProps = SplineProps & {
scale?: number;
fixedScale?: boolean;
};

// @public (undocumented)
class CatmullRomSpline extends CardinalSpline {
constructor();
}

// @public (undocumented)
enum ChangeTypes {
// (undocumented)
Expand Down Expand Up @@ -1863,6 +1886,14 @@ export class CrosshairsTool extends AnnotationTool {
_unsubscribeToViewportNewVolumeSet(viewportsInfo: any): void;
}

// @public (undocumented)
abstract class CubicSpline extends Spline {
// (undocumented)
protected getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[];
// (undocumented)
protected getSplineCurves(): SplineCurveSegment[];
}

// @public (undocumented)
const CursorNames: string[];

Expand Down Expand Up @@ -3681,6 +3712,11 @@ export class LengthTool extends AnnotationTool {
toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LengthAnnotation) => void;
}

// @public (undocumented)
class LinearSpline extends CardinalSpline {
constructor();
}

declare namespace lineSegment {
export {
distanceToPoint_2 as distanceToPoint,
Expand Down Expand Up @@ -4457,6 +4493,24 @@ type PublicToolProps = SharedToolProp & {
name?: string;
};

// @public (undocumented)
class QuadraticBezier extends QuadraticSpline {
// (undocumented)
protected getTransformMatrix(): number[];
// (undocumented)
hasTangentPoints(): boolean;
}

// @public (undocumented)
abstract class QuadraticSpline extends Spline {
// (undocumented)
protected getLineSegments(): SplineLineSegment[];
// (undocumented)
getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[];
// (undocumented)
protected getSplineCurves(): SplineCurveSegment[];
}

declare namespace rectangle {
export {
distanceToPoint_4 as distanceToPoint
Expand Down Expand Up @@ -5501,6 +5555,70 @@ export class SphereScissorsTool extends LabelmapBaseTool {
static toolName: any;
}

// @public (undocumented)
abstract class Spline implements ISpline {
constructor(props?: SplineProps);
// (undocumented)
get aabb(): Types_2.AABB2;
// (undocumented)
addControlPoint(point: Types_2.Point2): void;
// (undocumented)
addControlPointAtU(u: number): ControlPointInfo;
// (undocumented)
addControlPoints(points: Types_2.Point2[]): void;
// (undocumented)
clearControlPoints(): void;
// (undocumented)
get closed(): boolean;
set closed(closed: boolean);
// (undocumented)
containsPoint(point: Types_2.Point2): boolean;
// (undocumented)
protected get controlPoints(): Types_2.Point2[];
// (undocumented)
deleteControlPointByIndex(index: number): boolean;
// (undocumented)
get fixedResolution(): boolean;
// (undocumented)
getClosestControlPoint(point: Types_2.Point2): ClosestControlPoint;
// (undocumented)
getClosestControlPointWithinDistance(point: Types_2.Point2, maxDist: number): ClosestControlPoint;
// (undocumented)
getClosestPoint(point: Types_2.Point2): ClosestSplinePoint;
// (undocumented)
getClosestPointOnControlPointLines(point: Types_2.Point2): ClosestPoint;
// (undocumented)
getControlPoints(): Types_2.Point2[];
// (undocumented)
getPolylinePoints(): Types_2.Point2[];
// (undocumented)
protected abstract getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[];
// (undocumented)
getPreviewPolylinePoints(controlPointPreview: Types_2.Point2, closeDistance: number): Types_2.Point2[];
// (undocumented)
protected abstract getSplineCurves(): SplineCurveSegment[];
// (undocumented)
protected abstract getTransformMatrix(): number[];
// (undocumented)
hasTangentPoints(): boolean;
// (undocumented)
get invalidated(): boolean;
protected set invalidated(invalidated: boolean);
// (undocumented)
isPointNearCurve(point: Types_2.Point2, maxDist: number): boolean;
// (undocumented)
get length(): number;
// (undocumented)
get numControlPoints(): number;
// (undocumented)
get resolution(): number;
set resolution(resolution: number);
// (undocumented)
setControlPoints(points: Types_2.Point2[]): void;
// (undocumented)
updateControlPoint(index: number, newControlPoint: Types_2.Point2): void;
}

// @public (undocumented)
type SplineContourSegmentationAnnotation = SplineROIAnnotation & ContourSegmentationAnnotationData;

Expand Down Expand Up @@ -5635,6 +5753,20 @@ export class SplineROITool extends ContourSegmentationBaseTool {
triggerChangeEvent: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType: ChangeTypes, contourHoleProcessingEnabled: any) => void;
}

declare namespace splines {
export {
BSpline,
CardinalSpline,
CatmullRomSpline,
CubicSpline,
LinearSpline,
QuadraticBezier,
QuadraticSpline,
Spline
}
}
export { splines }

// @public (undocumented)
const stackContextPrefetch: {
enable: (element: any) => void;
Expand Down
3 changes: 3 additions & 0 deletions packages/tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as cursors from './cursors';
import * as Types from './types';
import * as annotation from './stateManagement/annotation';
import * as segmentation from './stateManagement/segmentation';
import * as splines from './tools/annotation/splines';

import {
BaseTool,
Expand Down Expand Up @@ -172,4 +173,6 @@ export {
RegionSegmentTool,
WholeBodySegmentTool,
LabelmapBaseTool,
// Spline classes
splines,
};
19 changes: 19 additions & 0 deletions packages/tools/src/tools/annotation/splines/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import BSpline from './BSpline';
import CardinalSpline from './CardinalSpline';
import CatmullRomSpline from './CatmullRomSpline';
import CubicSpline from './CubicSpline';
import LinearSpline from './LinearSpline';
import QuadraticBezier from './QuadraticBezier';
import QuadraticSpline from './QuadraticSpline';
import Spline from './Spline';

export {
BSpline,
CardinalSpline,
CatmullRomSpline,
CubicSpline,
LinearSpline,
QuadraticBezier,
QuadraticSpline,
Spline,
};

0 comments on commit 4142eef

Please sign in to comment.