@cornerstonejs/tools 3.28.0 → 4.0.0-beta.3
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.
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
2
|
-
import { config as segmentationConfig } from '../../stateManagement/segmentation';
|
|
3
2
|
import { BaseTool } from '../base';
|
|
4
3
|
import { triggerSegmentationModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
|
|
5
4
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
6
5
|
import { getActiveSegmentation } from '../../stateManagement/segmentation/activeSegmentation';
|
|
7
6
|
import { getSegmentIndexAtWorldPoint } from '../../utilities/segmentation';
|
|
8
7
|
import { state } from '../../store/state';
|
|
9
|
-
import {
|
|
8
|
+
import { drawLinkedTextBox as drawLinkedTextBoxSvg } from '../../drawingSvg';
|
|
10
9
|
class SegmentLabelTool extends BaseTool {
|
|
11
10
|
constructor(toolProps = {
|
|
12
11
|
data: {
|
|
@@ -91,14 +90,13 @@ class SegmentLabelTool extends BaseTool {
|
|
|
91
90
|
viewport,
|
|
92
91
|
});
|
|
93
92
|
const segment = activeSegmentation.segments[hoveredSegmentIndex];
|
|
94
|
-
const color = segmentationConfig.color.getSegmentIndexColor(viewport.id, segmentationId, hoveredSegmentIndex);
|
|
95
93
|
const label = segment?.label;
|
|
96
94
|
const canvasCoordinates = viewport.worldToCanvas(worldPoint);
|
|
97
95
|
this._editData = {
|
|
98
96
|
hoveredSegmentIndex,
|
|
99
97
|
hoveredSegmentLabel: label,
|
|
100
98
|
canvasCoordinates,
|
|
101
|
-
|
|
99
|
+
worldPoint,
|
|
102
100
|
};
|
|
103
101
|
if (!hoveredSegmentIndex || hoveredSegmentIndex === 0) {
|
|
104
102
|
return;
|
|
@@ -113,18 +111,12 @@ class SegmentLabelTool extends BaseTool {
|
|
|
113
111
|
return;
|
|
114
112
|
}
|
|
115
113
|
const { viewport } = enabledElement;
|
|
116
|
-
const { hoveredSegmentIndex, hoveredSegmentLabel, canvasCoordinates,
|
|
114
|
+
const { hoveredSegmentIndex, hoveredSegmentLabel, canvasCoordinates, worldPoint, } = this._editData;
|
|
117
115
|
if (!hoveredSegmentIndex) {
|
|
118
116
|
return;
|
|
119
117
|
}
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
canvasCoordinates[0] + offset,
|
|
123
|
-
canvasCoordinates[1] + offset,
|
|
124
|
-
];
|
|
125
|
-
const boundingBox = drawTextBoxSvg(svgDrawingHelper, 'segmentSelectLabelAnnotation', 'segmentSelectLabelTextBox', [hoveredSegmentLabel ?? '(unnamed segment)'], textBoxPosition, {
|
|
126
|
-
color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${color[3]})`,
|
|
127
|
-
});
|
|
118
|
+
const textBoxPosition = viewport.worldToCanvas(worldPoint);
|
|
119
|
+
const boundingBox = drawLinkedTextBoxSvg(svgDrawingHelper, 'segmentSelectLabelAnnotation', 'segmentSelectLabelTextBox', [hoveredSegmentLabel ? hoveredSegmentLabel : '(unnamed segment)'], textBoxPosition, [canvasCoordinates], {}, {});
|
|
128
120
|
const left = canvasCoordinates[0];
|
|
129
121
|
const top = canvasCoordinates[1];
|
|
130
122
|
const { width, height } = boundingBox;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache,
|
|
1
|
+
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, } from '@cornerstonejs/core';
|
|
2
2
|
import { addToolState, getToolState } from './state';
|
|
3
3
|
import { getStackData, requestType, priority, clearFromImageIds, getPromiseRemovedHandler, } from './stackPrefetchUtils';
|
|
4
|
-
const { imageRetrieveMetadataProvider } = utilities;
|
|
5
4
|
let configuration = {
|
|
6
5
|
maxImagesToPrefetch: Infinity,
|
|
7
6
|
minBefore: 2,
|
|
@@ -104,13 +103,9 @@ function prefetch(element) {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
const requestFn = (imageId, options) =>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
...options,
|
|
111
|
-
retrieveOptions: retrieveOptions?.default || Object.values(retrieveOptions)?.[0] || {},
|
|
112
|
-
});
|
|
113
|
-
};
|
|
106
|
+
const requestFn = (imageId, options) => imageLoader
|
|
107
|
+
.loadAndCacheImage(imageId, options)
|
|
108
|
+
.then(() => doneCallback(imageId));
|
|
114
109
|
stackPrefetch.indicesToRequest.forEach((imageIdIndex) => {
|
|
115
110
|
const imageId = stack.imageIds[imageIdIndex];
|
|
116
111
|
const options = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache,
|
|
1
|
+
import { imageLoader, Enums, eventTarget, imageLoadPoolManager, cache, getConfiguration as getCoreConfiguration, } from '@cornerstonejs/core';
|
|
2
2
|
import { addToolState, getToolState } from './state';
|
|
3
3
|
import { getStackData, requestType, priority, getPromiseRemovedHandler, nearestIndex, range, } from './stackPrefetchUtils';
|
|
4
|
-
const { imageRetrieveMetadataProvider } = utilities;
|
|
5
4
|
let configuration = {
|
|
6
5
|
maxImagesToPrefetch: Infinity,
|
|
7
6
|
preserveExistingPool: true,
|
|
@@ -87,13 +86,7 @@ function prefetch(element) {
|
|
|
87
86
|
imageIdsToPrefetch.push(imageId);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
|
-
const requestFn = (imageId, options) =>
|
|
91
|
-
const { retrieveOptions = {} } = metaData.get(imageRetrieveMetadataProvider.IMAGE_RETRIEVE_CONFIGURATION, imageId, 'stack');
|
|
92
|
-
return imageLoader.loadAndCacheImage(imageId, {
|
|
93
|
-
...options,
|
|
94
|
-
retrieveOptions: retrieveOptions?.default || Object.values(retrieveOptions)?.[0] || {},
|
|
95
|
-
});
|
|
96
|
-
};
|
|
89
|
+
const requestFn = (imageId, options) => imageLoader.loadAndCacheImage(imageId, options);
|
|
97
90
|
imageIdsToPrefetch.forEach((imageId) => {
|
|
98
91
|
const options = {
|
|
99
92
|
requestType,
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "4.0.0-beta.3";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '
|
|
1
|
+
export const version = '4.0.0-beta.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "^3.1.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "^
|
|
111
|
+
"@cornerstonejs/core": "^4.0.0-beta.3",
|
|
112
112
|
"@kitware/vtk.js": "32.12.1",
|
|
113
113
|
"@types/d3-array": "^3.0.4",
|
|
114
114
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "31e0bdf0464c1671e8ead3146b7cd19b5a4681a8"
|
|
131
131
|
}
|