@cornerstonejs/tools 1.66.11 → 1.67.0
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/cjs/tools/TrackballRotateTool.d.ts +2 -0
- package/dist/cjs/tools/TrackballRotateTool.js +20 -0
- package/dist/cjs/tools/TrackballRotateTool.js.map +1 -1
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js +3 -3
- package/dist/cjs/utilities/segmentation/brushSizeForToolGroup.js.map +1 -1
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js +3 -3
- package/dist/cjs/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -1
- package/dist/cjs/utilities/segmentation/index.d.ts +2 -1
- package/dist/cjs/utilities/segmentation/index.js +3 -1
- package/dist/cjs/utilities/segmentation/index.js.map +1 -1
- package/dist/cjs/utilities/segmentation/invalidateBrushCursor.js +2 -2
- package/dist/cjs/utilities/segmentation/invalidateBrushCursor.js.map +1 -1
- package/dist/cjs/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/cjs/utilities/segmentation/utilities.js +2 -2
- package/dist/cjs/utilities/segmentation/utilities.js.map +1 -1
- package/dist/esm/tools/TrackballRotateTool.js +20 -0
- package/dist/esm/tools/TrackballRotateTool.js.map +1 -1
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js +1 -1
- package/dist/esm/utilities/segmentation/brushSizeForToolGroup.js.map +1 -1
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js +1 -1
- package/dist/esm/utilities/segmentation/brushThresholdForToolGroup.js.map +1 -1
- package/dist/esm/utilities/segmentation/index.js +2 -1
- package/dist/esm/utilities/segmentation/index.js.map +1 -1
- package/dist/esm/utilities/segmentation/invalidateBrushCursor.js +1 -1
- package/dist/esm/utilities/segmentation/invalidateBrushCursor.js.map +1 -1
- package/dist/esm/utilities/segmentation/utilities.js +1 -1
- package/dist/esm/utilities/segmentation/utilities.js.map +1 -1
- package/dist/types/tools/TrackballRotateTool.d.ts +2 -0
- package/dist/types/tools/TrackballRotateTool.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/index.d.ts +2 -1
- package/dist/types/utilities/segmentation/index.d.ts.map +1 -1
- package/dist/types/utilities/segmentation/utilities.d.ts +1 -1
- package/dist/types/utilities/segmentation/utilities.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/TrackballRotateTool.ts +30 -0
- package/src/utilities/segmentation/brushSizeForToolGroup.ts +1 -1
- package/src/utilities/segmentation/brushThresholdForToolGroup.ts +1 -1
- package/src/utilities/segmentation/index.ts +2 -0
- package/src/utilities/segmentation/invalidateBrushCursor.ts +1 -1
- package/src/utilities/segmentation/utilities.ts +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.67.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.67.0",
|
|
33
33
|
"@icr/polyseg-wasm": "0.4.0",
|
|
34
34
|
"@types/offscreencanvas": "2019.7.3",
|
|
35
35
|
"comlink": "^4.4.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"type": "individual",
|
|
60
60
|
"url": "https://ohif.org/donate"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "53850d8ec676e74d6f1f644abd316431cd7aa7e4"
|
|
63
63
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import vtkMath from '@kitware/vtk.js/Common/Core/Math';
|
|
2
|
+
import { Events } from '../enums';
|
|
2
3
|
|
|
3
4
|
import { getEnabledElement } from '@cornerstonejs/core';
|
|
4
5
|
import type { Types } from '@cornerstonejs/core';
|
|
@@ -13,6 +14,7 @@ class TrackballRotateTool extends BaseTool {
|
|
|
13
14
|
static toolName;
|
|
14
15
|
touchDragCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
15
16
|
mouseDragCallback: (evt: EventTypes.InteractionEventType) => void;
|
|
17
|
+
cleanUp: () => void;
|
|
16
18
|
|
|
17
19
|
constructor(
|
|
18
20
|
toolProps: PublicToolProps = {},
|
|
@@ -29,6 +31,33 @@ class TrackballRotateTool extends BaseTool {
|
|
|
29
31
|
this.mouseDragCallback = this._dragCallback.bind(this);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
preMouseDownCallback = (evt: EventTypes.InteractionEventType) => {
|
|
35
|
+
const eventDetail = evt.detail;
|
|
36
|
+
const { element } = eventDetail;
|
|
37
|
+
const enabledElement = getEnabledElement(element);
|
|
38
|
+
const { viewport } = enabledElement;
|
|
39
|
+
|
|
40
|
+
const actorEntry = viewport.getDefaultActor();
|
|
41
|
+
const actor = actorEntry.actor as Types.VolumeActor;
|
|
42
|
+
const mapper = actor.getMapper();
|
|
43
|
+
const originalSampleDistance = mapper.getSampleDistance();
|
|
44
|
+
|
|
45
|
+
mapper.setSampleDistance(originalSampleDistance * 2);
|
|
46
|
+
|
|
47
|
+
if (this.cleanUp !== null) {
|
|
48
|
+
// Clean up previous event listener
|
|
49
|
+
element.removeEventListener('mouseup', this.cleanUp);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.cleanUp = () => {
|
|
53
|
+
mapper.setSampleDistance(originalSampleDistance);
|
|
54
|
+
viewport.render();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
element.addEventListener('mouseup', this.cleanUp, { once: true });
|
|
58
|
+
return true;
|
|
59
|
+
};
|
|
60
|
+
|
|
32
61
|
rotateCamera = (viewport, centerWorld, axis, angle) => {
|
|
33
62
|
const vtkCamera = viewport.getVtkActiveCamera();
|
|
34
63
|
const viewUp = vtkCamera.getViewUp();
|
|
@@ -70,6 +99,7 @@ class TrackballRotateTool extends BaseTool {
|
|
|
70
99
|
const { rotateIncrementDegrees } = this.configuration;
|
|
71
100
|
const enabledElement = getEnabledElement(element);
|
|
72
101
|
const { viewport } = enabledElement;
|
|
102
|
+
|
|
73
103
|
const camera = viewport.getCamera();
|
|
74
104
|
const width = element.clientWidth;
|
|
75
105
|
const height = element.clientHeight;
|
|
@@ -2,7 +2,7 @@ import { getToolGroup } from '../../store/ToolGroupManager';
|
|
|
2
2
|
import BrushTool from '../../tools/segmentation/BrushTool';
|
|
3
3
|
import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds';
|
|
4
4
|
import { getRenderingEngine } from '@cornerstonejs/core';
|
|
5
|
-
import getBrushToolInstances from './utilities';
|
|
5
|
+
import { getBrushToolInstances } from './utilities';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Sets the brush size for all brush-based tools in a given tool group.
|
|
@@ -2,7 +2,7 @@ import type { Types } from '@cornerstonejs/core';
|
|
|
2
2
|
import { getToolGroup } from '../../store/ToolGroupManager';
|
|
3
3
|
import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds';
|
|
4
4
|
import { getRenderingEngine } from '@cornerstonejs/core';
|
|
5
|
-
import getBrushToolInstances from './utilities';
|
|
5
|
+
import { getBrushToolInstances } from './utilities';
|
|
6
6
|
|
|
7
7
|
export function setBrushThresholdForToolGroup(
|
|
8
8
|
toolGroupId: string,
|
|
@@ -24,6 +24,7 @@ import { getUniqueSegmentIndices } from './getUniqueSegmentIndices';
|
|
|
24
24
|
import { getSegmentAtWorldPoint } from './getSegmentAtWorldPoint';
|
|
25
25
|
import { getSegmentAtLabelmapBorder } from './getSegmentAtLabelmapBorder';
|
|
26
26
|
import { getHoveredContourSegmentationAnnotation } from './getHoveredContourSegmentationAnnotation';
|
|
27
|
+
import { getBrushToolInstances } from './utilities';
|
|
27
28
|
|
|
28
29
|
export {
|
|
29
30
|
thresholdVolumeByRange,
|
|
@@ -48,4 +49,5 @@ export {
|
|
|
48
49
|
getSegmentAtWorldPoint,
|
|
49
50
|
getSegmentAtLabelmapBorder,
|
|
50
51
|
getHoveredContourSegmentationAnnotation,
|
|
52
|
+
getBrushToolInstances,
|
|
51
53
|
};
|
|
@@ -2,7 +2,7 @@ import { getToolGroup } from '../../store/ToolGroupManager';
|
|
|
2
2
|
import BrushTool from '../../tools/segmentation/BrushTool';
|
|
3
3
|
import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds';
|
|
4
4
|
import { getRenderingEngine } from '@cornerstonejs/core';
|
|
5
|
-
import getBrushToolInstances from './utilities';
|
|
5
|
+
import { getBrushToolInstances } from './utilities';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Invalidates the brush cursor for a specific tool group.
|
|
@@ -10,10 +10,7 @@ export type ThresholdInformation = {
|
|
|
10
10
|
upper: number;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
toolGroupId: string,
|
|
15
|
-
toolName?: string
|
|
16
|
-
) {
|
|
13
|
+
export function getBrushToolInstances(toolGroupId: string, toolName?: string) {
|
|
17
14
|
const toolGroup = getToolGroup(toolGroupId);
|
|
18
15
|
|
|
19
16
|
if (toolGroup === undefined) {
|