@ohif/app 3.14.0-beta.55 → 3.14.0-beta.57

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.
Files changed (37) hide show
  1. package/dist/{9187.bundle.47a04a89.js → 1283.bundle.56abacf4.js} +162 -137
  2. package/dist/{4262.bundle.0c550b7f.js → 1558.bundle.03d5783b.js} +36 -11
  3. package/dist/{1566.bundle.8d90bb15.js → 1566.bundle.e9f5d851.js} +5 -1
  4. package/dist/{1645.bundle.65cff869.js → 1645.bundle.618a2886.js} +700 -389
  5. package/dist/{1724.bundle.b4757283.js → 1724.bundle.59b20c59.js} +1184 -1139
  6. package/dist/{1788.bundle.5b78672d.js → 1788.bundle.3f1349d2.js} +101 -43
  7. package/dist/1975.bundle.53cf5d7c.js +8216 -0
  8. package/dist/{5922.bundle.46b3e037.js → 2894.bundle.db3f8686.js} +240 -151
  9. package/dist/{6567.bundle.cc57e572.js → 3044.bundle.039294b9.js} +105 -76
  10. package/dist/{3386.bundle.7665dd43.js → 3386.bundle.25140fec.js} +92 -23
  11. package/dist/{4004.bundle.da822fd2.js → 4018.bundle.48c288e5.js} +128 -253
  12. package/dist/{2894.bundle.d612efb2.js → 513.bundle.9c0548cf.js} +1 -1
  13. package/dist/{5143.bundle.62bcf4ee.js → 5143.bundle.67167d39.js} +219 -147
  14. package/dist/{5895.bundle.b4892e1b.js → 5320.bundle.0c7b2cb7.js} +1473 -617
  15. package/dist/{5383.bundle.d393d2f5.js → 5383.bundle.79243338.js} +26 -4
  16. package/dist/{4324.bundle.8645d6b4.js → 5888.bundle.cd717f42.js} +1364 -8004
  17. package/dist/{8128.bundle.2afe5a05.js → 5914.bundle.00f408d2.js} +419 -49
  18. package/dist/{1284.bundle.a489bd1d.js → 5989.bundle.f8096a4e.js} +1175 -616
  19. package/dist/{6255.bundle.ee378f1c.js → 6255.bundle.521051c1.js} +42 -18
  20. package/dist/{829.bundle.e60fee3a.js → 641.bundle.4627a8e1.js} +472 -483
  21. package/dist/{1568.bundle.474a5a93.js → 9187.bundle.237037e4.js} +1 -1
  22. package/dist/{6711.bundle.baba2ccd.js → 9232.bundle.3b0caf8e.js} +10 -10
  23. package/dist/{1895.bundle.923d0bd4.js → 9620.bundle.67375c83.js} +82 -24
  24. package/dist/{app.bundle.3a861c86.js → app.bundle.b9e31304.js} +44 -44
  25. package/dist/{compute.bundle.caab94e6.js → compute.bundle.a8f26c49.js} +10 -10
  26. package/dist/index.html +1 -1
  27. package/dist/{interpolation.bundle.eed65b60.js → interpolation.bundle.aef2f614.js} +5 -5
  28. package/dist/{polySeg.bundle.34a58c4f.js → polySeg.bundle.ba052ac3.js} +11 -11
  29. package/dist/static/wasm/{27ff970b98.module.wasm → 0e14aeab30.module.wasm} +0 -0
  30. package/dist/static/wasm/58a146bc8c.module.wasm +0 -0
  31. package/dist/static/wasm/99a2672e64.module.wasm +0 -0
  32. package/dist/static/wasm/{11f8dc2413.module.wasm → d8b213f3ea.module.wasm} +0 -0
  33. package/dist/sw.js +1 -1
  34. package/package.json +6 -6
  35. package/dist/0.bundle.485115b4.js +0 -4498
  36. package/dist/static/wasm/58769f1d7d.module.wasm +0 -0
  37. /package/dist/{1895.bundle.css → 9620.bundle.css} +0 -0
@@ -918,6 +918,7 @@ function defaultGetTextLines(data, targetId) {
918
918
  /* import */ var _stateManagement_annotation_config_helpers_js__rspack_import_21 = __webpack_require__(91336);
919
919
  /* import */ var _utilities_defaultGetTextLines_js__rspack_import_22 = __webpack_require__(73131);
920
920
  /* import */ var _utilities_sampleAreaAnnotationVoxels_js__rspack_import_23 = __webpack_require__(72821);
921
+ /* import */ var _utilities_areaAnnotationShapeUtils_js__rspack_import_24 = __webpack_require__(98512);
921
922
  var _a;
922
923
 
923
924
 
@@ -942,6 +943,7 @@ var _a;
942
943
 
943
944
 
944
945
 
946
+
945
947
 
946
948
 
947
949
  const cs3dLogger = _cornerstonejs_core__rspack_import_1.utilities.logger.toolsLog.getLogger('tools.annotation.RectangleROITool');
@@ -1395,7 +1397,7 @@ class RectangleROITool extends _base_index_js__rspack_import_0/* .AnnotationTool
1395
1397
  const majorAxis = gl_matrix__rspack_import_2/* .vec3.sub */.eR.jb(gl_matrix__rspack_import_2/* .vec3.create */.eR.vt(), worldHandles[1], worldHandles[0]);
1396
1398
  const majorHalfLength = gl_matrix__rspack_import_2/* .vec3.distance */.eR.Io(worldHandles[0], worldHandles[1]) / 2;
1397
1399
  const minorHalfLength = gl_matrix__rspack_import_2/* .vec3.distance */.eR.Io(worldHandles[0], worldHandles[2]) / 2;
1398
- if (!(majorHalfLength > 0) || !(minorHalfLength > 0)) {
1400
+ if (!(0,_utilities_areaAnnotationShapeUtils_js__rspack_import_24/* .hasValidAreaAnnotationDimensions */.k)(majorHalfLength, minorHalfLength)) {
1399
1401
  return null;
1400
1402
  }
1401
1403
  return createRectangleShape({
@@ -1701,6 +1703,13 @@ class AnnotationTool extends _AnnotationDisplayTool_js__rspack_import_2/* ["defa
1701
1703
  const scalingModule = imageId && _cornerstonejs_core__rspack_import_0.metaData.get('scalingModule', imageId);
1702
1704
  return typeof scalingModule?.suvbw === 'number';
1703
1705
  }
1706
+ getTargetVolume(viewport) {
1707
+ const targetId = this.getTargetId(viewport);
1708
+ const imageVolume = targetId
1709
+ ? _cornerstonejs_core__rspack_import_0.cache.getVolume(_cornerstonejs_core__rspack_import_0.utilities.getVolumeId(targetId))
1710
+ : undefined;
1711
+ return imageVolume ? { targetId, imageVolume } : null;
1712
+ }
1704
1713
  getAnnotationStyle(context) {
1705
1714
  const { annotation, styleSpecifier } = context;
1706
1715
  const getStyle = (property) => this.getStyle(property, styleSpecifier, annotation);
@@ -1882,14 +1891,17 @@ AnnotationTool.toolName = 'AnnotationTool';
1882
1891
  /* import */ var _utilities_segmentation_createLabelmapMemo_js__rspack_import_10 = __webpack_require__(89725);
1883
1892
  /* import */ var _stateManagement_annotation_annotationState_js__rspack_import_11 = __webpack_require__(77864);
1884
1893
  /* import */ var _utilities_planar_index_js__rspack_import_12 = __webpack_require__(84468);
1885
- /* import */ var _utilities_math_polyline_index_js__rspack_import_13 = __webpack_require__(58232);
1894
+ /* import */ var _strategies_utils_contourVoxelSlab_js__rspack_import_13 = __webpack_require__(53976);
1886
1895
  /* import */ var _stateManagement_segmentation_triggerSegmentationEvents_js__rspack_import_14 = __webpack_require__(11815);
1887
1896
  /* import */ var _strategies_index_js__rspack_import_15 = __webpack_require__(70978);
1888
1897
  /* import */ var _stateManagement_segmentation_helpers_getViewportLabelmapRenderMode_js__rspack_import_16 = __webpack_require__(15422);
1889
1898
  /* import */ var _stateManagement_segmentation_helpers_labelmapSegmentationState_js__rspack_import_17 = __webpack_require__(92996);
1890
1899
  /* import */ var _utilities_getViewportICamera_js__rspack_import_18 = __webpack_require__(40196);
1891
- /* import */ var _utilities_triggerAnnotationRenderForViewportIds_js__rspack_import_19 = __webpack_require__(74128);
1892
- /* import */ var _cursors_elementCursor_js__rspack_import_20 = __webpack_require__(30905);
1900
+ /* import */ var _stateManagement_segmentation_config_segmentationVisibility_js__rspack_import_19 = __webpack_require__(64540);
1901
+ /* import */ var _utilities_contourSegmentation_removeContourSegmentationAnnotation_js__rspack_import_20 = __webpack_require__(24618);
1902
+ /* import */ var _utilities_triggerAnnotationRenderForViewportIds_js__rspack_import_21 = __webpack_require__(74128);
1903
+ /* import */ var _cursors_elementCursor_js__rspack_import_22 = __webpack_require__(30905);
1904
+
1893
1905
 
1894
1906
 
1895
1907
 
@@ -1911,6 +1923,8 @@ AnnotationTool.toolName = 'AnnotationTool';
1911
1923
 
1912
1924
 
1913
1925
 
1926
+
1927
+ const { asUnitNormal } = _cornerstonejs_core__rspack_import_0.utilities.voxelSlab;
1914
1928
  class LabelmapBaseTool extends _base_index_js__rspack_import_1/* .BaseTool */.oS {
1915
1929
  constructor(toolProps, defaultToolProps) {
1916
1930
  super(toolProps, defaultToolProps);
@@ -1929,11 +1943,11 @@ class LabelmapBaseTool extends _base_index_js__rspack_import_1/* .BaseTool */.oS
1929
1943
  }
1930
1944
  const viewportIdsToRender = this.editData?.viewportIdsToRender;
1931
1945
  this._deactivateDraw(element);
1932
- (0,_cursors_elementCursor_js__rspack_import_20.resetElementCursor)(element);
1946
+ (0,_cursors_elementCursor_js__rspack_import_22.resetElementCursor)(element);
1933
1947
  this.editData = null;
1934
1948
  this.isDrawing = false;
1935
1949
  if (viewportIdsToRender) {
1936
- (0,_utilities_triggerAnnotationRenderForViewportIds_js__rspack_import_19/* ["default"] */.A)(viewportIdsToRender);
1950
+ (0,_utilities_triggerAnnotationRenderForViewportIds_js__rspack_import_21/* ["default"] */.A)(viewportIdsToRender);
1937
1951
  }
1938
1952
  }
1939
1953
  _historyRedoHandler(evt) {
@@ -2215,12 +2229,15 @@ class LabelmapBaseTool extends _base_index_js__rspack_import_1/* .BaseTool */.oS
2215
2229
  static viewportContoursToLabelmap(viewport, options) {
2216
2230
  const removeContours = options?.removeContours ?? true;
2217
2231
  const annotations = (0,_stateManagement_annotation_annotationState_js__rspack_import_11.getAllAnnotations)();
2218
- const viewAnnotations = (0,_utilities_planar_index_js__rspack_import_12.filterAnnotationsForDisplay)(viewport, annotations);
2219
- if (!viewAnnotations?.length) {
2232
+ const polylineAnnotations = annotations.filter((annotation) => annotation.data.contour?.polyline?.length);
2233
+ const contourAnnotations = options?.annotationFilter
2234
+ ? options.annotationFilter(polylineAnnotations)
2235
+ : polylineAnnotations;
2236
+ if (!contourAnnotations.length) {
2220
2237
  return;
2221
2238
  }
2222
- const contourAnnotations = viewAnnotations.filter((annotation) => annotation.data.contour?.polyline?.length);
2223
- if (!contourAnnotations.length) {
2239
+ const viewAnnotations = (0,_utilities_planar_index_js__rspack_import_12.filterAnnotationsForDisplay)(viewport, contourAnnotations);
2240
+ if (!viewAnnotations?.length) {
2224
2241
  return;
2225
2242
  }
2226
2243
  const brushInstance = new LabelmapBaseTool({}, {
@@ -2235,31 +2252,25 @@ class LabelmapBaseTool extends _base_index_js__rspack_import_1/* .BaseTool */.oS
2235
2252
  const { memo, segmentationId } = preview;
2236
2253
  const previewVoxels = memo?.voxelManager;
2237
2254
  const segmentationVoxels = previewVoxels.sourceVoxelManager || previewVoxels;
2238
- const { dimensions } = previewVoxels;
2239
2255
  const imageData = viewport
2240
2256
  .getDefaultActor()
2241
2257
  .actor.getMapper()
2242
2258
  .getInputData();
2243
- for (const annotation of contourAnnotations) {
2244
- const boundsIJK = [
2245
- [Infinity, -Infinity],
2246
- [Infinity, -Infinity],
2247
- [Infinity, -Infinity],
2248
- ];
2259
+ const volume = {
2260
+ dimensions: imageData.getDimensions(),
2261
+ direction: imageData.getDirection(),
2262
+ spacing: imageData.getSpacing(),
2263
+ origin: imageData.getOrigin(),
2264
+ };
2265
+ const isSegmentEditable = createSegmentEditableLookup(viewport.id, segmentationId);
2266
+ for (const annotation of viewAnnotations) {
2249
2267
  const { polyline } = annotation.data.contour;
2250
- for (const point of polyline) {
2251
- const indexPoint = imageData.worldToIndex(point);
2252
- indexPoint.forEach((v, idx) => {
2253
- boundsIJK[idx][0] = Math.min(boundsIJK[idx][0], v);
2254
- boundsIJK[idx][1] = Math.max(boundsIJK[idx][1], v);
2255
- });
2256
- }
2257
- boundsIJK.forEach((bound, idx) => {
2258
- bound[0] = Math.round(Math.max(0, bound[0]));
2259
- bound[1] = Math.round(Math.min(dimensions[idx] - 1, bound[1]));
2260
- });
2268
+ const camera = viewport.getCamera();
2269
+ const viewPlaneNormal = asUnitNormal(annotation.metadata?.viewPlaneNormal ?? camera.viewPlaneNormal);
2261
2270
  const activeIndex = (0,_stateManagement_segmentation_getActiveSegmentIndex_js__rspack_import_8/* .getActiveSegmentIndex */.Q)(segmentationId);
2262
- const startPoint = annotation.data.handles?.[0] || polyline[0];
2271
+ const startPoint = options?.strokeStartPoint ||
2272
+ annotation.data.handles?.[0] ||
2273
+ polyline[0];
2263
2274
  const startIndex = imageData.worldToIndex(startPoint).map(Math.round);
2264
2275
  const startValue = segmentationVoxels.getAtIJKPoint(startIndex) || 0;
2265
2276
  let hasZeroIndex = false;
@@ -2275,28 +2286,39 @@ class LabelmapBaseTool extends _base_index_js__rspack_import_1/* .BaseTool */.oS
2275
2286
  }
2276
2287
  }
2277
2288
  const hasBoth = hasZeroIndex && hasPositiveIndex;
2278
- const segmentIndex = hasBoth
2289
+ let segmentIndex = hasBoth
2279
2290
  ? startValue
2280
2291
  : startValue === 0
2281
2292
  ? activeIndex
2282
2293
  : 0;
2283
- for (let i = boundsIJK[0][0]; i <= boundsIJK[0][1]; i++) {
2284
- for (let j = boundsIJK[1][0]; j <= boundsIJK[1][1]; j++) {
2285
- for (let k = boundsIJK[2][0]; k <= boundsIJK[2][1]; k++) {
2286
- const worldPoint = imageData.indexToWorld([i, j, k]);
2287
- const isContained = (0,_utilities_math_polyline_index_js__rspack_import_13.isPointInsidePolyline3D)(worldPoint, polyline);
2288
- if (isContained) {
2289
- previewVoxels.setAtIJK(i, j, k, segmentIndex);
2290
- }
2291
- }
2294
+ if (!isSegmentEditable(segmentIndex)) {
2295
+ segmentIndex = activeIndex;
2296
+ }
2297
+ if (!isSegmentEditable(segmentIndex)) {
2298
+ if (removeContours) {
2299
+ removeContourAnnotation(annotation);
2300
+ }
2301
+ continue;
2302
+ }
2303
+ for (const ijk of (0,_strategies_utils_contourVoxelSlab_js__rspack_import_13/* .iterateContourFillVoxels */.x)({
2304
+ volume,
2305
+ polyline,
2306
+ viewPlaneNormal,
2307
+ imageData,
2308
+ })) {
2309
+ const currentSegmentIndex = segmentationVoxels.getAtIJK(ijk[0], ijk[1], ijk[2]);
2310
+ if (!isSegmentEditable(currentSegmentIndex)) {
2311
+ continue;
2292
2312
  }
2313
+ previewVoxels.setAtIJK(ijk[0], ijk[1], ijk[2], segmentIndex);
2293
2314
  }
2294
2315
  if (removeContours) {
2295
- (0,_stateManagement_annotation_annotationState_js__rspack_import_11.removeAnnotation)(annotation.annotationUID);
2316
+ removeContourAnnotation(annotation);
2296
2317
  }
2297
2318
  }
2298
2319
  const slices = previewVoxels.getArrayOfModifiedSlices();
2299
2320
  (0,_stateManagement_segmentation_triggerSegmentationEvents_js__rspack_import_14.triggerSegmentationDataModified)(segmentationId, slices);
2321
+ brushInstance.doneEditMemo();
2300
2322
  }
2301
2323
  }
2302
2324
  LabelmapBaseTool.previewData = {
@@ -2308,6 +2330,41 @@ LabelmapBaseTool.previewData = {
2308
2330
  isDrag: false,
2309
2331
  };
2310
2332
  /* export default */ __webpack_exports__.A = (LabelmapBaseTool);
2333
+ const SEGMENT_UNKNOWN = 0;
2334
+ const SEGMENT_EDITABLE = 1;
2335
+ const SEGMENT_BLOCKED = 2;
2336
+ function createSegmentEditableLookup(viewportId, segmentationId) {
2337
+ const segments = (0,_stateManagement_segmentation_getSegmentation_js__rspack_import_5/* .getSegmentation */.T)(segmentationId)?.segments;
2338
+ const hiddenSegmentIndices = (0,_stateManagement_segmentation_config_segmentationVisibility_js__rspack_import_19.getHiddenSegmentIndices)(viewportId, {
2339
+ segmentationId,
2340
+ type: _enums_SegmentationRepresentations_js__rspack_import_2/* ["default"].Labelmap */.A.Labelmap,
2341
+ });
2342
+ let cache = new Uint8Array(64);
2343
+ return function isSegmentEditable(segmentIndex) {
2344
+ if (!(segmentIndex > 0)) {
2345
+ return true;
2346
+ }
2347
+ if (segmentIndex >= cache.length) {
2348
+ const grown = new Uint8Array(Math.max(segmentIndex + 1, cache.length * 2));
2349
+ grown.set(cache);
2350
+ cache = grown;
2351
+ }
2352
+ const cached = cache[segmentIndex];
2353
+ if (cached !== SEGMENT_UNKNOWN) {
2354
+ return cached === SEGMENT_EDITABLE;
2355
+ }
2356
+ const isEditable = segments?.[segmentIndex]?.locked !== true &&
2357
+ !hiddenSegmentIndices.has(segmentIndex);
2358
+ cache[segmentIndex] = isEditable ? SEGMENT_EDITABLE : SEGMENT_BLOCKED;
2359
+ return isEditable;
2360
+ };
2361
+ }
2362
+ function removeContourAnnotation(annotation) {
2363
+ (0,_stateManagement_annotation_annotationState_js__rspack_import_11.removeAnnotation)(annotation.annotationUID);
2364
+ if (annotation.data?.segmentation) {
2365
+ (0,_utilities_contourSegmentation_removeContourSegmentationAnnotation_js__rspack_import_20/* .removeContourSegmentationAnnotation */.M)(annotation);
2366
+ }
2367
+ }
2311
2368
  function lightenColor(r, g, b, a, factor = 0.4) {
2312
2369
  return [
2313
2370
  Math.round(r + (255 - r) * factor),
@@ -3221,7 +3278,7 @@ function sampleAreaAnnotationVoxels({ annotation, image, voxelManager, points, b
3221
3278
  planePoint,
3222
3279
  viewPlaneNormal,
3223
3280
  referencePlaneThickness: slabThickness,
3224
- bounds: getAnnotationIndexBounds(points, volume, imageData, viewPlaneNormal, getMembershipHalfWidth(slabThickness, voxelThickness), boundsMargin),
3281
+ bounds: getShapeIndexBounds(points, volume, imageData, viewPlaneNormal, getMembershipHalfWidth(slabThickness, voxelThickness), boundsMargin),
3225
3282
  getShapeRuns: shape.getRuns,
3226
3283
  voxelManager,
3227
3284
  onSample,
@@ -3242,7 +3299,7 @@ function resolveAnnotationNormal(metadata) {
3242
3299
  ? asUnitNormal(normal)
3243
3300
  : undefined;
3244
3301
  }
3245
- function getAnnotationIndexBounds(points, volume, imageData, viewPlaneNormal, halfWidth, margin) {
3302
+ function getShapeIndexBounds(points, volume, imageData, viewPlaneNormal, halfWidth, margin = 0) {
3246
3303
  const { dimensions, direction, spacing } = volume;
3247
3304
  const indexPoints = points.map((point) => imageData.worldToIndex(point));
3248
3305
  const boundingBox = (0,_boundingBox_index_js__rspack_import_2.getBoundingBoxAroundShapeIJK)(indexPoints);
@@ -3259,7 +3316,8 @@ function getAnnotationIndexBounds(points, volume, imageData, viewPlaneNormal, ha
3259
3316
  }
3260
3317
 
3261
3318
  __webpack_require__.d(__webpack_exports__, {
3262
- A: () => (sampleAreaAnnotationVoxels)
3319
+ A: () => (sampleAreaAnnotationVoxels),
3320
+ V: () => (getShapeIndexBounds)
3263
3321
  });
3264
3322
 
3265
3323