@cornerstonejs/tools 3.8.4 → 3.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/stateManagement/segmentation/getViewportSegmentations.d.ts +2 -1
- package/dist/esm/stateManagement/segmentation/getViewportSegmentations.js +7 -3
- package/dist/esm/stateManagement/segmentation/internalAddSegmentationRepresentation.js +0 -2
- package/dist/esm/stateManagement/segmentation/segmentationState.d.ts +2 -2
- package/dist/esm/stateManagement/segmentation/segmentationState.js +2 -2
- package/dist/esm/tools/annotation/RegionSegmentPlusTool.js +4 -1
- package/dist/esm/tools/segmentation/BrushTool.js +1 -1
- package/dist/esm/utilities/index.d.ts +2 -1
- package/dist/esm/utilities/index.js +2 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { SegmentationRepresentations } from '../../enums';
|
|
2
|
-
import type { Segmentation } from '../../types';
|
|
2
|
+
import type { Segmentation, SegmentationRepresentation } from '../../types';
|
|
3
3
|
export declare function getViewportSegmentations(viewportId: string, type?: SegmentationRepresentations): Segmentation[];
|
|
4
|
+
export declare function getViewportSegmentationRepresentations(viewportId: string): SegmentationRepresentation[];
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getSegmentation } from './getSegmentation';
|
|
2
2
|
import { defaultSegmentationStateManager } from './SegmentationStateManager';
|
|
3
3
|
export function getViewportSegmentations(viewportId, type) {
|
|
4
|
-
const
|
|
5
|
-
const state = segmentationStateManager.getState();
|
|
6
|
-
const viewportRepresentations = state.viewportSegRepresentations[viewportId];
|
|
4
|
+
const viewportRepresentations = getViewportSegmentationRepresentations(viewportId);
|
|
7
5
|
const segmentations = viewportRepresentations.map((representation) => {
|
|
8
6
|
if (type && representation.type === type) {
|
|
9
7
|
return getSegmentation(representation.segmentationId);
|
|
@@ -13,3 +11,9 @@ export function getViewportSegmentations(viewportId, type) {
|
|
|
13
11
|
const filteredSegmentations = segmentations.filter((segmentation) => segmentation !== undefined);
|
|
14
12
|
return filteredSegmentations;
|
|
15
13
|
}
|
|
14
|
+
export function getViewportSegmentationRepresentations(viewportId) {
|
|
15
|
+
const segmentationStateManager = defaultSegmentationStateManager;
|
|
16
|
+
const state = segmentationStateManager.getState();
|
|
17
|
+
const viewportRepresentations = state.viewportSegRepresentations[viewportId];
|
|
18
|
+
return viewportRepresentations;
|
|
19
|
+
}
|
|
@@ -3,9 +3,7 @@ import { triggerAnnotationRenderForViewportIds } from '../../utilities/triggerAn
|
|
|
3
3
|
import { SegmentationRepresentations } from '../../enums';
|
|
4
4
|
import { triggerSegmentationModified } from './triggerSegmentationEvents';
|
|
5
5
|
import { addColorLUT } from './addColorLUT';
|
|
6
|
-
import { getNextColorLUTIndex } from './getNextColorLUTIndex';
|
|
7
6
|
import { defaultSegmentationStateManager } from './SegmentationStateManager';
|
|
8
|
-
import { getColorLUT } from './getColorLUT';
|
|
9
7
|
function internalAddSegmentationRepresentation(viewportId, representationInput) {
|
|
10
8
|
const { segmentationId, config } = representationInput;
|
|
11
9
|
const renderingConfig = {
|
|
@@ -7,11 +7,11 @@ import { addColorLUT } from './addColorLUT';
|
|
|
7
7
|
import { getColorLUT } from './getColorLUT';
|
|
8
8
|
import { getNextColorLUTIndex } from './getNextColorLUTIndex';
|
|
9
9
|
import { removeColorLUT } from './removeColorLUT';
|
|
10
|
-
import { getViewportSegmentations } from './getViewportSegmentations';
|
|
10
|
+
import { getViewportSegmentations, getViewportSegmentationRepresentations } from './getViewportSegmentations';
|
|
11
11
|
import { getViewportIdsWithSegmentation } from './getViewportIdsWithSegmentation';
|
|
12
12
|
import { getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport } from './getCurrentLabelmapImageIdForViewport';
|
|
13
13
|
import { updateLabelmapSegmentationImageReferences } from './updateLabelmapSegmentationImageReferences';
|
|
14
14
|
import { getStackSegmentationImageIdsForViewport } from './getStackSegmentationImageIdsForViewport';
|
|
15
15
|
import { getSegmentationRepresentation, getSegmentationRepresentations, getSegmentationRepresentationsBySegmentationId } from './getSegmentationRepresentation';
|
|
16
16
|
declare function destroy(): void;
|
|
17
|
-
export { getColorLUT, getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport, getNextColorLUTIndex, getSegmentation, getSegmentations, getStackSegmentationImageIdsForViewport, getViewportIdsWithSegmentation, getSegmentationRepresentation, getSegmentationRepresentations, removeColorLUT, getViewportSegmentations, removeSegmentation, removeLabelmapRepresentation, removeContourRepresentation, removeSurfaceRepresentation, removeSegmentationRepresentation, removeAllSegmentationRepresentations, removeAllSegmentations, addColorLUT, addSegmentations, updateLabelmapSegmentationImageReferences, getSegmentationRepresentationsBySegmentationId, destroy, };
|
|
17
|
+
export { getColorLUT, getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport, getNextColorLUTIndex, getSegmentation, getSegmentations, getStackSegmentationImageIdsForViewport, getViewportIdsWithSegmentation, getSegmentationRepresentation, getSegmentationRepresentations, getViewportSegmentationRepresentations, removeColorLUT, getViewportSegmentations, removeSegmentation, removeLabelmapRepresentation, removeContourRepresentation, removeSurfaceRepresentation, removeSegmentationRepresentation, removeAllSegmentationRepresentations, removeAllSegmentations, addColorLUT, addSegmentations, updateLabelmapSegmentationImageReferences, getSegmentationRepresentationsBySegmentationId, destroy, };
|
|
@@ -7,7 +7,7 @@ import { addColorLUT } from './addColorLUT';
|
|
|
7
7
|
import { getColorLUT } from './getColorLUT';
|
|
8
8
|
import { getNextColorLUTIndex } from './getNextColorLUTIndex';
|
|
9
9
|
import { removeColorLUT } from './removeColorLUT';
|
|
10
|
-
import { getViewportSegmentations } from './getViewportSegmentations';
|
|
10
|
+
import { getViewportSegmentations, getViewportSegmentationRepresentations, } from './getViewportSegmentations';
|
|
11
11
|
import { getViewportIdsWithSegmentation } from './getViewportIdsWithSegmentation';
|
|
12
12
|
import { getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport, } from './getCurrentLabelmapImageIdForViewport';
|
|
13
13
|
import { updateLabelmapSegmentationImageReferences } from './updateLabelmapSegmentationImageReferences';
|
|
@@ -17,4 +17,4 @@ import { defaultSegmentationStateManager } from './SegmentationStateManager';
|
|
|
17
17
|
function destroy() {
|
|
18
18
|
defaultSegmentationStateManager.resetState();
|
|
19
19
|
}
|
|
20
|
-
export { getColorLUT, getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport, getNextColorLUTIndex, getSegmentation, getSegmentations, getStackSegmentationImageIdsForViewport, getViewportIdsWithSegmentation, getSegmentationRepresentation, getSegmentationRepresentations, removeColorLUT, getViewportSegmentations, removeSegmentation, removeLabelmapRepresentation, removeContourRepresentation, removeSurfaceRepresentation, removeSegmentationRepresentation, removeAllSegmentationRepresentations, removeAllSegmentations, addColorLUT, addSegmentations, updateLabelmapSegmentationImageReferences, getSegmentationRepresentationsBySegmentationId, destroy, };
|
|
20
|
+
export { getColorLUT, getCurrentLabelmapImageIdForViewport, getCurrentLabelmapImageIdsForViewport, getNextColorLUTIndex, getSegmentation, getSegmentations, getStackSegmentationImageIdsForViewport, getViewportIdsWithSegmentation, getSegmentationRepresentation, getSegmentationRepresentations, getViewportSegmentationRepresentations, removeColorLUT, getViewportSegmentations, removeSegmentation, removeLabelmapRepresentation, removeContourRepresentation, removeSurfaceRepresentation, removeSegmentationRepresentation, removeAllSegmentationRepresentations, removeAllSegmentations, addColorLUT, addSegmentations, updateLabelmapSegmentationImageReferences, getSegmentationRepresentationsBySegmentationId, destroy, };
|
|
@@ -40,7 +40,10 @@ class RegionSegmentPlusTool extends GrowCutBaseTool {
|
|
|
40
40
|
async onMouseStable(evt, worldPoint, element) {
|
|
41
41
|
await super.preMouseDownCallback(evt);
|
|
42
42
|
const refVolume = cache.getVolume(this.growCutData.segmentation.referencedVolumeId);
|
|
43
|
-
const seeds = calculateGrowCutSeeds(refVolume, worldPoint, {})
|
|
43
|
+
const seeds = calculateGrowCutSeeds(refVolume, worldPoint, {}) || {
|
|
44
|
+
positiveSeedIndices: new Set(),
|
|
45
|
+
negativeSeedIndices: new Set(),
|
|
46
|
+
};
|
|
44
47
|
const { positiveSeedIndices, negativeSeedIndices } = seeds;
|
|
45
48
|
let cursor;
|
|
46
49
|
if (positiveSeedIndices.size / negativeSeedIndices.size > 20 ||
|
|
@@ -200,8 +200,8 @@ class BrushTool extends LabelmapBaseTool {
|
|
|
200
200
|
const operationData = this.getOperationData(element);
|
|
201
201
|
if (!this._previewData.preview && !this._previewData.isDrag) {
|
|
202
202
|
this.applyActiveStrategy(enabledElement, operationData);
|
|
203
|
-
this.doneEditMemo();
|
|
204
203
|
}
|
|
204
|
+
this.doneEditMemo();
|
|
205
205
|
this._deactivateDraw(element);
|
|
206
206
|
resetElementCursor(element);
|
|
207
207
|
this.updateCursor(evt);
|
|
@@ -39,4 +39,5 @@ import { getPixelValueUnits, getPixelValueUnitsImageId } from './getPixelValueUn
|
|
|
39
39
|
import * as geometricSurfaceUtils from './geometricSurfaceUtils';
|
|
40
40
|
import setAnnotationLabel from './setAnnotationLabel';
|
|
41
41
|
import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
42
|
-
|
|
42
|
+
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
43
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, setAnnotationLabel, moveAnnotationToViewPlane, getOrCreateImageVolume, };
|
|
@@ -39,4 +39,5 @@ import { getPixelValueUnits, getPixelValueUnitsImageId, } from './getPixelValueU
|
|
|
39
39
|
import * as geometricSurfaceUtils from './geometricSurfaceUtils';
|
|
40
40
|
import setAnnotationLabel from './setAnnotationLabel';
|
|
41
41
|
import { moveAnnotationToViewPlane } from './moveAnnotationToViewPlane';
|
|
42
|
-
|
|
42
|
+
import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume';
|
|
43
|
+
export { math, planar, viewportFilters, drawing, debounce, dynamicVolume, throttle, orientation, isObject, touch, triggerEvent, calibrateImageSpacing, getCalibratedLengthUnitsAndScale, getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, triggerAnnotationRenderForToolGroupIds, triggerAnnotationRender, getSphereBoundsInfo, getAnnotationNearPoint, getViewportForAnnotation, getAnnotationNearPointOnEnabledElement, viewport, cine, boundingBox, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, setAnnotationLabel, moveAnnotationToViewPlane, getOrCreateImageVolume, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.5",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"canvas": "^3.1.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@cornerstonejs/core": "^3.8.
|
|
106
|
+
"@cornerstonejs/core": "^3.8.5",
|
|
107
107
|
"@kitware/vtk.js": "32.12.1",
|
|
108
108
|
"@types/d3-array": "^3.0.4",
|
|
109
109
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"type": "individual",
|
|
123
123
|
"url": "https://ohif.org/donate"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "782551a1523d3619fa002b9b5bb2991519fb5f40"
|
|
126
126
|
}
|