@cornerstonejs/tools 5.5.0 → 5.6.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/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/tools/annotation/BidirectionalTool.js +0 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +4 -1
- package/dist/esm/tools/annotation/CircleROITool.js +34 -34
- package/dist/esm/tools/annotation/DragProbeTool.js +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +2 -2
- package/dist/esm/tools/annotation/RectangleROITool.js +31 -57
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +3 -3
- package/dist/esm/tools/base/AnnotationTool.js +6 -4
- package/dist/esm/tools/base/BaseTool.d.ts +15 -4
- package/dist/esm/tools/base/BaseTool.js +127 -6
- package/dist/esm/tools/base/index.d.ts +3 -1
- package/dist/esm/tools/base/index.js +3 -1
- package/dist/esm/tools/base/measurementTargetFilters.d.ts +19 -0
- package/dist/esm/tools/base/measurementTargetFilters.js +38 -0
- package/dist/esm/tools/index.d.ts +2 -2
- package/dist/esm/tools/index.js +2 -2
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.d.ts +2 -40
- package/dist/esm/tools/segmentation/CircleROIStartEndThresholdTool.js +1 -2
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts +0 -1
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +0 -1
- package/dist/esm/types/AnnotationTypes.d.ts +34 -1
- package/dist/esm/types/IBaseTool.d.ts +22 -0
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +26 -53
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/utilities/defaultGetTextLines.d.ts +9 -0
- package/dist/esm/utilities/defaultGetTextLines.js +53 -0
- package/dist/esm/utilities/getEllipseWorldCoordinates.d.ts +2 -2
- package/dist/esm/utilities/getEllipseWorldCoordinates.js +2 -2
- package/dist/esm/utilities/index.d.ts +1 -0
- package/dist/esm/utilities/index.js +1 -0
- package/dist/esm/utilities/planar/filterAnnotationsWithinSlice.js +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { utilities as csUtils } from '@cornerstonejs/core';
|
|
2
|
+
const { isEqual } = csUtils;
|
|
3
|
+
export const AREA_METRICS = [
|
|
4
|
+
{ name: 'Area', attribute: 'area', unitAttribute: 'areaUnit' },
|
|
5
|
+
{ name: 'Mean', attribute: 'mean', unitAttribute: 'modalityUnit' },
|
|
6
|
+
{ name: 'Max', attribute: 'max', unitAttribute: 'modalityUnit' },
|
|
7
|
+
{ name: 'Min', attribute: 'min', unitAttribute: 'modalityUnit' },
|
|
8
|
+
{ name: 'Std Dev', attribute: 'stdDev', unitAttribute: 'modalityUnit' },
|
|
9
|
+
];
|
|
10
|
+
export function createGetTextLines(metrics) {
|
|
11
|
+
return function (data, targetId) {
|
|
12
|
+
const targetIds = Array.isArray(targetId) ? targetId : [targetId];
|
|
13
|
+
const cachedVolumeStats = targetIds
|
|
14
|
+
.map((id) => data.cachedStats[id])
|
|
15
|
+
.filter((stats) => metrics.some(({ attribute }) => stats?.[attribute] !== undefined && stats?.[attribute] !== null));
|
|
16
|
+
if (!cachedVolumeStats.length) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const textLines = [];
|
|
20
|
+
for (const metric of metrics) {
|
|
21
|
+
pushResult(textLines, createMultiResultLine(cachedVolumeStats, targetIds, metric.name, metric.attribute, metric.unitAttribute));
|
|
22
|
+
}
|
|
23
|
+
return textLines;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const defaultAreaGetTextLines = createGetTextLines(AREA_METRICS);
|
|
27
|
+
function pushResult(textLines, value) {
|
|
28
|
+
if (value) {
|
|
29
|
+
textLines.push(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function createMultiResultLine(cachedVolumeStats, targetIds, name, attribute, unitAttribute) {
|
|
33
|
+
const result = [`${name}:`];
|
|
34
|
+
let lastValue = null;
|
|
35
|
+
let lastUnit = null;
|
|
36
|
+
for (const stats of cachedVolumeStats) {
|
|
37
|
+
if (!csUtils.isNumber(stats?.[attribute])) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const attributeValue = stats[attribute];
|
|
41
|
+
const unitValue = stats[unitAttribute];
|
|
42
|
+
if (isEqual(lastValue, attributeValue) && lastUnit === unitValue) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
result.push(`${csUtils.roundNumber(attributeValue)} ${unitValue}`);
|
|
46
|
+
lastValue = attributeValue;
|
|
47
|
+
lastUnit = unitValue;
|
|
48
|
+
}
|
|
49
|
+
if (result.length <= 1) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return result.join(' ');
|
|
53
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export default function getEllipseWorldCoordinates(points: [Types.Point3, Types.Point3], viewport: Types.
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
export default function getEllipseWorldCoordinates(points: [Types.Point3, Types.Point3], viewport: Types.IViewport): Types.Point3[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import getViewportICamera from './getViewportICamera.js';
|
|
2
3
|
export default function getEllipseWorldCoordinates(points, viewport) {
|
|
3
|
-
const
|
|
4
|
-
const { viewUp, viewPlaneNormal } = camera;
|
|
4
|
+
const { viewUp, viewPlaneNormal } = getViewportICamera(viewport);
|
|
5
5
|
const viewRight = vec3.create();
|
|
6
6
|
vec3.cross(viewRight, viewUp, viewPlaneNormal);
|
|
7
7
|
const [centerWorld, endWorld] = points;
|
|
@@ -46,4 +46,5 @@ import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume.js';
|
|
|
46
46
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction.js';
|
|
47
47
|
import { jumpToFocalPoint } from './genericViewportToolHelpers.js';
|
|
48
48
|
import pickIntensityPointInSlab, { getSlabIntensityPickContext } from './pickIntensityPointInSlab.js';
|
|
49
|
+
export * from './defaultGetTextLines.js';
|
|
49
50
|
export { math, planar, spatial, 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, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, jumpToFocalPoint, pickIntensityPointInSlab, getSlabIntensityPickContext, };
|
|
@@ -46,4 +46,5 @@ import getOrCreateImageVolume from './segmentation/getOrCreateImageVolume.js';
|
|
|
46
46
|
import * as usFanExtraction from '../tools/annotation/UltrasoundPleuraBLineTool/utils/fanExtraction.js';
|
|
47
47
|
import { jumpToFocalPoint } from './genericViewportToolHelpers.js';
|
|
48
48
|
import pickIntensityPointInSlab, { getSlabIntensityPickContext, } from './pickIntensityPointInSlab.js';
|
|
49
|
+
export * from './defaultGetTextLines.js';
|
|
49
50
|
export { math, planar, spatial, 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, draw3D, rectangleROITool, planarFreehandROITool, stackPrefetch, stackContextPrefetch, roundNumber, pointToString, polyDataUtils, voi, AnnotationMultiSlice, contourSegmentation, annotationHydration, getClosestImageIdForStackViewport, pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, geometricSurfaceUtils, usFanExtraction, setAnnotationLabel, moveAnnotationToViewPlane, safeStructuredClone, getOrCreateImageVolume, jumpToFocalPoint, pickIntensityPointInSlab, getSlabIntensityPickContext, };
|
|
@@ -49,7 +49,7 @@ export default function filterAnnotationsWithinSlice(annotations, camera, spacin
|
|
|
49
49
|
if (!annotationsWithParallelNormals.length) {
|
|
50
50
|
return [];
|
|
51
51
|
}
|
|
52
|
-
const halfSpacingInNormalDirection = spacingInNormalDirection / 2;
|
|
52
|
+
const halfSpacingInNormalDirection = spacingInNormalDirection / 2 + EPSILON;
|
|
53
53
|
const { focalPoint } = camera;
|
|
54
54
|
const annotationsWithinSlice = [];
|
|
55
55
|
for (const annotation of annotationsWithParallelNormals) {
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.6.0";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.6.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -126,11 +126,11 @@
|
|
|
126
126
|
"lodash.get": "4.4.2"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@cornerstonejs/core": "5.
|
|
129
|
+
"@cornerstonejs/core": "5.6.0",
|
|
130
130
|
"canvas": "3.2.0"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
|
-
"@cornerstonejs/core": "5.
|
|
133
|
+
"@cornerstonejs/core": "5.6.0",
|
|
134
134
|
"@kitware/vtk.js": "35.5.3",
|
|
135
135
|
"@types/d3-array": "3.2.1",
|
|
136
136
|
"@types/d3-interpolate": "3.0.4",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"type": "individual",
|
|
150
150
|
"url": "https://ohif.org/donate"
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "bca909b8af25305cc850f52b43d5834b55fcf011"
|
|
153
153
|
}
|