@cornerstonejs/tools 4.20.1 → 4.20.2

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,4 +1,4 @@
1
- import { getEnabledElement, eventTarget } from '@cornerstonejs/core';
1
+ import { getEnabledElement, eventTarget, Enums } from '@cornerstonejs/core';
2
2
  import { vec3, vec2 } from 'gl-matrix';
3
3
  import { Events, ToolModes, StrategyCallbacks } from '../../enums';
4
4
  import { fillInsideSphere, thresholdInsideSphere, thresholdInsideSphereIsland, } from './strategies/fillSphere';
@@ -9,6 +9,7 @@ import { resetElementCursor, hideElementCursor, } from '../../cursors/elementCur
9
9
  import triggerAnnotationRenderForViewportUIDs from '../../utilities/triggerAnnotationRenderForViewportIds';
10
10
  import LabelmapBaseTool from './LabelmapBaseTool';
11
11
  import { getStrategyData } from './strategies/utils/getStrategyData';
12
+ import { getActiveSegmentation } from '../../stateManagement/segmentation/getActiveSegmentation';
12
13
  class BrushTool extends LabelmapBaseTool {
13
14
  constructor(toolProps = {}, defaultToolProps = {
14
15
  supportedInteractionTypes: ['Mouse', 'Touch'],
@@ -94,6 +95,18 @@ class BrushTool extends LabelmapBaseTool {
94
95
  const { element, currentPoints } = eventData;
95
96
  const enabledElement = getEnabledElement(element);
96
97
  const { viewport } = enabledElement;
98
+ const activeSegmentation = getActiveSegmentation(viewport.id);
99
+ if (!activeSegmentation) {
100
+ const event = new CustomEvent(Enums.Events.ERROR_EVENT, {
101
+ detail: {
102
+ type: 'Segmentation',
103
+ message: 'No active segmentation detected, create a segmentation representation before using the brush tool',
104
+ },
105
+ cancelable: true,
106
+ });
107
+ eventTarget.dispatchEvent(event);
108
+ return false;
109
+ }
97
110
  this._editData = this.createEditData(element);
98
111
  this._activateDraw(element);
99
112
  hideElementCursor(element);
@@ -86,14 +86,6 @@ export default class LabelmapBaseTool extends BaseTool {
86
86
  const { viewport } = enabledElement;
87
87
  const activeSegmentation = getActiveSegmentation(viewport.id);
88
88
  if (!activeSegmentation) {
89
- const event = new CustomEvent(Enums.Events.ERROR_EVENT, {
90
- detail: {
91
- type: 'Segmentation',
92
- message: 'No active segmentation detected, create a segmentation representation before using the brush tool',
93
- },
94
- cancelable: true,
95
- });
96
- eventTarget.dispatchEvent(event);
97
89
  return null;
98
90
  }
99
91
  const { segmentationId } = activeSegmentation;
@@ -1 +1 @@
1
- export declare const version = "4.20.1";
1
+ export declare const version = "4.20.2";
@@ -1 +1 @@
1
- export const version = '4.20.1';
1
+ export const version = '4.20.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.20.1",
3
+ "version": "4.20.2",
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.2.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "4.20.1",
111
+ "@cornerstonejs/core": "4.20.2",
112
112
  "@kitware/vtk.js": "34.15.1",
113
113
  "@types/d3-array": "3.2.1",
114
114
  "@types/d3-interpolate": "3.0.4",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "67fb3a5cec834cdac65dec315c6d25553e935cce"
130
+ "gitHead": "039f844e7a2e18c9e985785673123f2e52fc0f5e"
131
131
  }