Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(segmentation): Add polymorph segmentation and representation conversion capabilities #844

Merged
merged 126 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
e9273b6
Add wasm conversion contour 2 surface
rodrigobasilio2022 Oct 19, 2023
72884e4
Adding more converters
rodrigobasilio2022 Oct 19, 2023
ac7d994
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into pr…
sedghi Oct 20, 2023
73b1de4
remove circle json
sedghi Oct 20, 2023
a7d7b52
remove contour json
sedghi Oct 20, 2023
39a643d
remove surfaces json
sedghi Oct 20, 2023
a97e7b9
edit the polyseg contour example
sedghi Oct 20, 2023
9611ade
polyseg contour
sedghi Oct 20, 2023
3d30556
edits
sedghi Oct 20, 2023
1efbc6c
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Nov 27, 2023
a8c3a63
Update dependencies and import statements
sedghi Nov 27, 2023
8fc611b
Fix wasm loading issue and initialize polySeg
sedghi Nov 27, 2023
3029275
update
sedghi Dec 1, 2023
e7f0f66
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Dec 1, 2023
621d6bf
Fix camera clipping range and add surface actor to
sedghi Dec 1, 2023
fb0f39c
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 11, 2024
cc06953
Fix camera clipping range reset issue
sedghi Jan 11, 2024
bec70f4
Add polySegManager for controlling polymorphic segmentations
sedghi Jan 11, 2024
167416b
Refactor labelmap to surface conversion in PolySegManager
sedghi Jan 11, 2024
509bef5
Refactor segmentation conversion and surface display
sedghi Jan 11, 2024
fc797cf
Add segment index dropdown to toolbar
sedghi Jan 11, 2024
735f840
fix surface segmentation to include multiple geometries
sedghi Jan 11, 2024
500140b
Refactor surface conversion in PolySegManager
sedghi Jan 11, 2024
60e4aa0
Refactor segmentation-related functions and add new features
sedghi Jan 11, 2024
0b7c70e
Remove defaultOptions from viewport configuration
sedghi Jan 11, 2024
b5a25b7
Update Viewport and SegmentationStateManager
sedghi Jan 12, 2024
e019603
Add background color support to viewports
sedghi Jan 12, 2024
875285a
Remove unused code for manual labelmap segmentation tools
sedghi Jan 12, 2024
4284811
Refactor surface representation update in PolySegManager
sedghi Jan 12, 2024
0f3f1c0
Add 3D anatomy toggle button and set initial visibility to false
sedghi Jan 12, 2024
180ff8a
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 12, 2024
ffd7196
Add info section and update instructions in PolySegWasmVolumeLabelmap…
sedghi Jan 12, 2024
7022afa
Update DICOM web URL in code
sedghi Jan 15, 2024
29942d8
Update labelmap validation and polySeg conversion
sedghi Jan 15, 2024
66d4a58
Fix segmentation handling and add warning message
sedghi Jan 15, 2024
d64e62f
Add getSegmentAtWorldPoint utility function
sedghi Jan 15, 2024
068a710
Add isPointInsidePolyline function for 2D and 3D points
sedghi Jan 15, 2024
6149c97
Refactor addSegmentationRepresentation function and RepresentationPub…
sedghi Jan 15, 2024
92c53bf
Fix segmentationRepresentationUID assignment
sedghi Jan 15, 2024
61f86d1
Fix segmentIndex conversion issue and update annotation rendering
sedghi Jan 15, 2024
1ca7a33
Fix SurfaceData initialization in surfaceDisplay.ts
sedghi Jan 15, 2024
7f811f2
Refactor surface and labelmap rendering functions
sedghi Jan 15, 2024
4114572
Refactor PolySegManager to support both volume and stack viewports
sedghi Jan 15, 2024
cd9e8d0
Add ISurface interface to Surface class and update references***
sedghi Jan 15, 2024
7728431
Refactor render function in surfaceDisplay.ts
sedghi Jan 15, 2024
c1e4eda
Increase radius for 3D viewport and pass additional parameters to com…
sedghi Jan 16, 2024
3ad879b
Refactor polySegManager.ts file
sedghi Jan 16, 2024
42067ca
Add VTK contour support and refactor contour display logic
sedghi Jan 16, 2024
ba32b91
Refactor mergePoints.ts to remove duplicate points and update point r…
sedghi Jan 16, 2024
3f75113
Merge duplicate point logic in getDeduplicatedVTKPolyDataPoints
sedghi Jan 17, 2024
1b9423e
Add cachedStats to ProbeTool and add contour annotation to contourDis…
sedghi Jan 17, 2024
155a139
Add new tools and functionality for segmentation
sedghi Jan 17, 2024
1f03586
Update SegmentationRepresentations in PolySegManager
sedghi Jan 18, 2024
74219ae
Add lodash.get and hull.js dependencies, fix null check in Annotation…
sedghi Jan 18, 2024
05a2f61
Update user authentication logic
sedghi Jan 19, 2024
83c811a
moving towards web workers
sedghi Jan 22, 2024
ce91d4b
Update user authentication logic to use bcrypt hashing algorithm
sedghi Jan 22, 2024
1fcae75
refactoring
sedghi Jan 22, 2024
8f0a2ce
refactoring contour to surface
sedghi Jan 22, 2024
be8f933
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 22, 2024
76daa89
update yarn lock
sedghi Jan 22, 2024
8798f78
moved the label map to surface to worker
sedghi Jan 22, 2024
8016777
rename
sedghi Jan 22, 2024
ce9b375
start of labelmap to worker
sedghi Jan 22, 2024
3caa320
Refactor code to improve performance and readability
sedghi Jan 22, 2024
9e33374
Refactor code to improve performance and readability
sedghi Jan 23, 2024
7c84953
Refactor variable names and improve code readability
sedghi Jan 23, 2024
26dbc36
Refactor code to improve performance and readability
sedghi Jan 23, 2024
46743ec
Fix bug in login functionality
sedghi Jan 23, 2024
ab841b2
more on surface to labelmap
sedghi Jan 23, 2024
81dc30b
move to Map for surface rendering
sedghi Jan 24, 2024
be50717
fix surface representation
sedghi Jan 24, 2024
aab87f1
add stack labelmap to surface example
sedghi Jan 24, 2024
98d9f92
update
sedghi Jan 24, 2024
2b1e744
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 24, 2024
1b0e0a3
enhance stack to volume segmentation conversion
sedghi Jan 24, 2024
8ec04e4
add stack seg to surface
sedghi Jan 24, 2024
057a1cc
proper implemntation of contour to labelmap for stack
sedghi Jan 25, 2024
a17062c
surface rendering on stack viewport
sedghi Jan 26, 2024
bf32930
fix surface from contour
sedghi Jan 26, 2024
f7cd038
first api fix push
sedghi Jan 26, 2024
f5aea61
remaining
sedghi Jan 26, 2024
0bb4347
add example info page
sedghi Jan 26, 2024
c79e687
applied self review comments
sedghi Jan 26, 2024
01fbb63
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 26, 2024
2fe2aee
remainign
sedghi Jan 26, 2024
0036cd2
remainign
sedghi Jan 26, 2024
b7cfbb6
demo
sedghi Jan 27, 2024
f5c8a34
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 29, 2024
a5bcac4
Add Surface class and update polySeg options
sedghi Jan 31, 2024
4e4b239
add manipulation tools
sedghi Jan 31, 2024
9e18b7c
Fix rendering issue and add new utility function for 3D polyline
sedghi Jan 31, 2024
3ea1f6e
more updates
sedghi Jan 31, 2024
65daa21
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Jan 31, 2024
e023e98
Refactor segmentation-related code and fix error handling
sedghi Jan 31, 2024
23ba341
Add PolySegConversionOptions type
sedghi Jan 31, 2024
4ac03bd
wip
sedghi Jan 31, 2024
3c72ab0
Fix stack index in setStack method
sedghi Feb 1, 2024
1c4ed1e
api
sedghi Feb 1, 2024
b33363c
try to precache surface intersections
sedghi Feb 1, 2024
cb8fd01
Refactor clippingPlaneWorker.js and surfaceRendering/index.ts
sedghi Feb 1, 2024
e99bb8e
update
sedghi Feb 1, 2024
a80bbac
Merge remote-tracking branch 'origin/main' into new-polyseg-wasm
wayfarer3130 Feb 2, 2024
fef80ad
Removed one debugger and fixed a NPE
wayfarer3130 Feb 2, 2024
24cbff5
Merge remote-tracking branch 'origin/main' into new-polyseg-wasm
wayfarer3130 Feb 2, 2024
530d924
Merge branch 'new-polyseg-wasm' of github.com:cornerstonejs/cornersto…
sedghi Feb 2, 2024
c13913c
update
sedghi Feb 2, 2024
6336183
Add manipulation bindings and mock contour segmentation
sedghi Feb 2, 2024
dc19319
Fix contour segmentation behavior and add utility functions
sedghi Feb 2, 2024
eb4942f
Add triggerAnnotationRenderForToolGroupIds utility function
sedghi Feb 5, 2024
b740606
Add mock contour segmentation for volume and stack viewports
sedghi Feb 5, 2024
30cb7c4
Add getViewportImageIds utility function
sedghi Feb 5, 2024
f7ed131
api
sedghi Feb 5, 2024
59235e7
Update contour segmentation radius and terminate web worker by name
sedghi Feb 5, 2024
0186e7b
Fix compute job limit bug and terminate workers properly
sedghi Feb 5, 2024
79db2e3
Remove unused enum and add new enum for worker types
sedghi Feb 5, 2024
b52f1bf
Add event listener for caching progress
sedghi Feb 5, 2024
2c81490
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Feb 5, 2024
be57a89
update
sedghi Feb 5, 2024
0006ad8
Add getSegmentationIdRepresentations function to segmentationState.ts…
sedghi Feb 6, 2024
0d1594d
Refactor segmentation utilities and tools
sedghi Feb 6, 2024
14121a5
Update search radius for border detection
sedghi Feb 6, 2024
5b16161
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Feb 6, 2024
72bb717
Refactor addManipulationBindings function to accept options object
sedghi Feb 6, 2024
576d524
update review
sedghi Feb 6, 2024
4a4b044
Merge branch 'main' of github.com:cornerstonejs/cornerstone3D into ne…
sedghi Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 98 additions & 15 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ number
// @public (undocumented)
function applyPreset(actor: VolumeActor, preset: ViewportPreset): void;

// @public (undocumented)
const backgroundColors: {
slicer3D: number[];
};

// @public (undocumented)
export abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
constructor(props: ViewportInput);
Expand Down Expand Up @@ -278,7 +283,8 @@ declare namespace CONSTANTS {
RENDERING_DEFAULTS,
mprCameraValues as MPR_CAMERA_VALUES,
EPSILON,
presets as VIEWPORT_PRESETS
presets as VIEWPORT_PRESETS,
backgroundColors as BACKGROUND_COLORS
}
}
export { CONSTANTS }
Expand Down Expand Up @@ -603,7 +609,7 @@ function createAndCacheDerivedSegmentationImage(referencedImageId: string, optio
function createAndCacheDerivedSegmentationImages(referencedImageIds: Array<string>, options?: DerivedImageOptions): DerivedImages;

// @public (undocumented)
function createAndCacheDerivedSegmentationVolume(referencedVolumeId: string, options: DerivedVolumeOptions): Promise<IImageVolume>;
function createAndCacheDerivedSegmentationVolume(referencedVolumeId: string, options?: DerivedVolumeOptions): Promise<IImageVolume>;

// @public (undocumented)
function createAndCacheDerivedVolume(referencedVolumeId: string, options: DerivedVolumeOptions): Promise<IImageVolume>;
Expand Down Expand Up @@ -632,6 +638,9 @@ function createInt16SharedArray(length: number): Int16Array;
// @public (undocumented)
function createLinearRGBTransferFunction(voiRange: VOIRange): vtkColorTransferFunction;

// @public (undocumented)
function createLocalSegmentationVolume(options: LocalVolumeOptions, volumeId: string, preventCache?: boolean): Promise<IImageVolume>;

// @public (undocumented)
function createLocalVolume(options: LocalVolumeOptions, volumeId: string, preventCache?: boolean): IImageVolume;

Expand Down Expand Up @@ -808,7 +817,9 @@ export enum EVENTS {
// (undocumented)
VOLUME_SCROLL_OUT_OF_BOUNDS = "CORNERSTONE_VOLUME_SCROLL_OUT_OF_BOUNDS",
// (undocumented)
VOLUME_VIEWPORT_NEW_VOLUME = "CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME"
VOLUME_VIEWPORT_NEW_VOLUME = "CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME",
// (undocumented)
WEB_WORKER_PROGRESS = "CORNERSTONE_WEB_WORKER_PROGRESS"
}

// @public (undocumented)
Expand Down Expand Up @@ -994,6 +1005,9 @@ function getUnknownVolumeLoaderSchema(): string;
// @public (undocumented)
function getViewportImageCornersInWorld(viewport: IStackViewport | IVolumeViewport): Point3[];

// @public (undocumented)
function getViewportImageIds(viewport: IViewport): string[];

// @public (undocumented)
function getViewportModality(viewport: IViewport, volumeId?: string): string;

Expand Down Expand Up @@ -1221,7 +1235,7 @@ interface IEnabledElement {
// @public (undocumented)
interface IGeometry {
// (undocumented)
data: IContourSet | Surface;
data: IContourSet | ISurface;
// (undocumented)
id: string;
// (undocumented)
Expand Down Expand Up @@ -1437,7 +1451,7 @@ interface IImageVolume {
// (undocumented)
convertToImageSlicesAndCache(): string[];
// (undocumented)
decache?: () => void;
decache?: (completelyRemove?: boolean) => void;
// (undocumented)
destroy(): void;
// (undocumented)
Expand Down Expand Up @@ -1467,6 +1481,8 @@ interface IImageVolume {
// (undocumented)
metadata: Metadata;
// (undocumented)
modified(): void;
// (undocumented)
numVoxels: number;
// (undocumented)
origin: Point3;
Expand Down Expand Up @@ -1762,6 +1778,8 @@ export class ImageVolume implements IImageVolume {
// (undocumented)
metadata: Metadata;
// (undocumented)
modified(): void;
// (undocumented)
protected numFrames: number;
// (undocumented)
numVoxels: number;
Expand Down Expand Up @@ -2029,6 +2047,30 @@ interface IStreamingVolumeProperties {
};
}

// @public (undocumented)
interface ISurface {
// (undocumented)
readonly frameOfReferenceUID: string;
// (undocumented)
getColor(): Point3;
// (undocumented)
getPoints(): number[];
// (undocumented)
getPolys(): number[];
// (undocumented)
getSizeInBytes(): number;
// (undocumented)
readonly id: string;
// (undocumented)
setColor(color: Point3): void;
// (undocumented)
setPoints(points: number[]): void;
// (undocumented)
setPolys(polys: number[]): void;
// (undocumented)
readonly sizeInBytes: number;
}

// @public (undocumented)
function isValidVolume(imageIds: string[]): boolean;

Expand Down Expand Up @@ -3027,6 +3069,33 @@ type StreamingRetrieveOptions = BaseRetrieveOptions & {
streaming: boolean;
};

// @public (undocumented)
export class Surface implements ISurface {
constructor(props: SurfaceProps);
// (undocumented)
readonly frameOfReferenceUID: string;
// (undocumented)
getColor(): RGB;
// (undocumented)
getPoints(): number[];
// (undocumented)
getPolys(): number[];
// (undocumented)
getSizeInBytes(): number;
// (undocumented)
_getSizeInBytes(): number;
// (undocumented)
readonly id: string;
// (undocumented)
setColor(color: RGB): void;
// (undocumented)
setPoints(points: number[]): void;
// (undocumented)
setPolys(polys: number[]): void;
// (undocumented)
readonly sizeInBytes: number;
}

// @public (undocumented)
type SurfaceData = {
points: number[];
Expand Down Expand Up @@ -3183,6 +3252,7 @@ declare namespace Types {
IContour,
PublicSurfaceData,
SurfaceData,
ISurface,
RGB,
ColormapPublic,
ColormapRegistration,
Expand Down Expand Up @@ -3287,7 +3357,8 @@ declare namespace utilities {
convertVolumeToStackViewport,
cacheUtils,
roundNumber,
roundToPrecision
roundToPrecision,
getViewportImageIds
}
}
export { utilities }
Expand Down Expand Up @@ -3494,6 +3565,8 @@ export class Viewport implements IViewport {
// (undocumented)
getCanvas(): HTMLCanvasElement;
// (undocumented)
getClippingPlanesForActor(actorEntry?: ActorEntry): vtkPlane[];
// (undocumented)
_getCorners(bounds: Array<number>): Array<number>[];
// (undocumented)
getCurrentImageIdIndex(): number;
Expand Down Expand Up @@ -3541,12 +3614,8 @@ export class Viewport implements IViewport {
// (undocumented)
_isInBounds(point: Point3, bounds: number[]): boolean;
// (undocumented)
protected newActorAdded: boolean;
// (undocumented)
options: ViewportInputOptions;
// (undocumented)
protected posProcessNewActors(): void;
// (undocumented)
_removeActor(actorUID: string): void;
// (undocumented)
removeActors(actorUIDs: Array<string>): void;
Expand Down Expand Up @@ -3771,7 +3840,8 @@ declare namespace volumeLoader {
getVolumeLoaderSchemes,
registerUnknownVolumeLoader,
getUnknownVolumeLoaderSchema,
createAndCacheDerivedSegmentationVolume
createAndCacheDerivedSegmentationVolume,
createLocalSegmentationVolume
}
}
export { volumeLoader }
Expand Down Expand Up @@ -3841,13 +3911,28 @@ export class VolumeViewport extends BaseVolumeViewport {
// (undocumented)
getNumberOfSlices: () => number;
// (undocumented)
getSliceIndex: () => number;
// (undocumented)
getSlicePlaneCoordinates: () => Array<{
sliceIndex: number;
point: Point3;
}>;
// (undocumented)
getSlicesClippingPlanes(): Array<{
sliceIndex: number;
planes: Array<{
normal: Point3;
origin: Point3;
}>;
}>;
// (undocumented)
resetCamera(resetPan?: boolean, resetZoom?: boolean, resetToCenter?: boolean, resetRotation?: boolean): boolean;
// (undocumented)
resetProperties(volumeId?: string): void;
// (undocumented)
setBlendMode(blendMode: BlendModes, filterActorUIDs?: any[], immediate?: boolean): void;
// (undocumented)
setOrientation(orientation: OrientationAxis, immediate?: boolean): void;
setOrientation(orientation: OrientationAxis | OrientationVectors, immediate?: boolean): void;
// (undocumented)
setSlabThickness(slabThickness: number, filterActorUIDs?: any[]): void;
// (undocumented)
Expand All @@ -3864,8 +3949,6 @@ export class VolumeViewport3D extends BaseVolumeViewport {
// (undocumented)
getRotation: () => number;
// (undocumented)
posProcessNewActors(): void;
// (undocumented)
resetCamera(resetPan?: boolean, resetZoom?: boolean, resetToCenter?: boolean): boolean;
// (undocumented)
resetProperties(volumeId?: string): void;
Expand Down Expand Up @@ -3936,7 +4019,7 @@ class VoxelManager<T> {
// (undocumented)
setAtIJK: (i: number, j: number, k: number, v: any) => void;
// (undocumented)
setAtIJKPoint: ([i, j, k]: [any, any, any], v: any) => void;
setAtIJKPoint: ([i, j, k]: Point3, v: any) => void;
// (undocumented)
setAtIndex: (index: any, v: any) => void;
// (undocumented)
Expand Down
Loading