@ohif/app 3.14.0-beta.90 → 3.14.0-beta.92

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,5 +1,5 @@
1
1
  "use strict";
2
- (globalThis["rspackChunk_ohif_app"] ||= []).push([[5914], {
2
+ (globalThis["rspackChunk_ohif_app"] ||= []).push([[8923], {
3
3
  45376(__unused_rspack___webpack_module__, __webpack_exports__) {
4
4
  const CORNERSTONE_COLOR_LUT = [
5
5
  [0, 0, 0, 0],
@@ -774,7 +774,9 @@ function getVolumeViewportLabelmapImageMapperState(viewport) {
774
774
  const slabThickness = getCompatibilitySlabThickness(viewport);
775
775
  const orientationKey = [
776
776
  normalizedNormal.map((value) => value.toFixed(3)).join(','),
777
- normalizedViewUp.map((value) => value.toFixed(3)).join(','),
777
+ ...(isLegacyVolumeViewport
778
+ ? [normalizedViewUp.map((value) => value.toFixed(3)).join(',')]
779
+ : []),
778
780
  ].join('|');
779
781
  if (isLegacyVolumeViewport && !isSupportedImageMapperBlendMode(blendMode)) {
780
782
  return {
@@ -2846,7 +2848,7 @@ function getUpdateFunction(viewport) {
2846
2848
 
2847
2849
 
2848
2850
  },
2849
- 95140(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
2851
+ 37125(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
2850
2852
 
2851
2853
  // EXPORTS
2852
2854
  __webpack_require__.d(__webpack_exports__, {
@@ -2971,8 +2973,7 @@ function getVolumeAxes(volume) {
2971
2973
  [direction[6], direction[7], direction[8]],
2972
2974
  ];
2973
2975
  }
2974
- function getSliceState(viewport, volume) {
2975
- const camera = getSliceRenderingCamera(viewport);
2976
+ function getSliceState(viewport, volume, camera = getSliceRenderingCamera(viewport)) {
2976
2977
  if (!camera) {
2977
2978
  return;
2978
2979
  }
@@ -3012,8 +3013,8 @@ function getSliceState(viewport, volume) {
3012
3013
  sliceIndex,
3013
3014
  };
3014
3015
  }
3015
- function createSliceImageData(volume, viewport) {
3016
- const state = getSliceState(viewport, volume);
3016
+ function createSliceImageData(volume, viewport, camera = getSliceRenderingCamera(viewport)) {
3017
+ const state = camera && getSliceState(viewport, volume, camera);
3017
3018
  if (!state) {
3018
3019
  return;
3019
3020
  }
@@ -3043,10 +3044,6 @@ function createSliceImageData(volume, viewport) {
3043
3044
  originIndex[state.yAxis] = state.ySign > 0 ? 0 : height - 1;
3044
3045
  const xDirection = axisVectors[state.xAxis].map((value) => value * state.xSign);
3045
3046
  const yDirection = axisVectors[state.yAxis].map((value) => value * state.ySign);
3046
- const camera = getSliceRenderingCamera(viewport);
3047
- if (!camera) {
3048
- return;
3049
- }
3050
3047
  const zDirection = gl_matrix_esm/* .vec3.normalize */.eR.S8(gl_matrix_esm/* .vec3.create */.eR.vt(), camera.viewPlaneNormal);
3051
3048
  const dataType = DataArray/* ["default"].getDataType */.Ay.getDataType(pixelData);
3052
3049
  const scalarArray = DataArray/* ["default"].newInstance */.Ay.newInstance({
@@ -3076,6 +3073,224 @@ function createSliceImageData(volume, viewport) {
3076
3073
  }
3077
3074
 
3078
3075
 
3076
+ ;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Labelmap/volumeLabelmapResampledSliceData.js
3077
+
3078
+
3079
+
3080
+
3081
+
3082
+ const MAX_RESAMPLED_SLICE_SIZE = 2048;
3083
+ const SLICE_INDEX_EPSILON = 1e-6;
3084
+ const MINIMUM_PLANE_INTERSECTION_POINTS = 3;
3085
+ const EXACT_SLICE_ALIGNMENT = 1 - 1e-8;
3086
+ function createVector() {
3087
+ return [0, 0, 0];
3088
+ }
3089
+ function getExactSliceAxis(volume, viewPlaneNormal) {
3090
+ const axes = getVolumeAxes(volume);
3091
+ const sliceAxis = matchAxis(viewPlaneNormal, axes);
3092
+ if (!sliceAxis) {
3093
+ return;
3094
+ }
3095
+ const axisDirection = axes[sliceAxis.axis];
3096
+ const alignment = Math.abs(gl_matrix_esm/* .vec3.dot */.eR.Om(viewPlaneNormal, axisDirection)) /
3097
+ (gl_matrix_esm/* .vec3.length */.eR.Bw(viewPlaneNormal) *
3098
+ gl_matrix_esm/* .vec3.length */.eR.Bw(axisDirection));
3099
+ return alignment >= EXACT_SLICE_ALIGNMENT ? sliceAxis.axis : undefined;
3100
+ }
3101
+ function stepAlong(start, direction, distance) {
3102
+ return gl_matrix_esm/* .vec3.scaleAndAdd */.eR.Ln(createVector(), start, direction, distance);
3103
+ }
3104
+ function getPlaneVolumeIntersectionPoints(volume, planePoint, planeNormal) {
3105
+ const { dimensions, imageData } = volume;
3106
+ const corners = [];
3107
+ const distances = [];
3108
+ for (let cornerIndex = 0; cornerIndex < 8; cornerIndex++) {
3109
+ const corner = esm.utilities.transformIndexToWorld(imageData, [
3110
+ cornerIndex & 1 ? dimensions[0] - 0.5 : -0.5,
3111
+ cornerIndex & 2 ? dimensions[1] - 0.5 : -0.5,
3112
+ cornerIndex & 4 ? dimensions[2] - 0.5 : -0.5,
3113
+ ]);
3114
+ corners.push(corner);
3115
+ distances.push(gl_matrix_esm/* .vec3.dot */.eR.Om(gl_matrix_esm/* .vec3.subtract */.eR.Re(createVector(), corner, planePoint), planeNormal));
3116
+ }
3117
+ const points = [];
3118
+ for (let cornerIndex = 0; cornerIndex < 8; cornerIndex++) {
3119
+ for (let axisBit = 1; axisBit <= 4; axisBit <<= 1) {
3120
+ if (cornerIndex & axisBit) {
3121
+ continue;
3122
+ }
3123
+ const otherIndex = cornerIndex | axisBit;
3124
+ const startDistance = distances[cornerIndex];
3125
+ const endDistance = distances[otherIndex];
3126
+ if (startDistance === 0) {
3127
+ points.push(corners[cornerIndex]);
3128
+ }
3129
+ if (endDistance === 0) {
3130
+ points.push(corners[otherIndex]);
3131
+ }
3132
+ if (startDistance * endDistance < 0) {
3133
+ points.push(gl_matrix_esm/* .vec3.lerp */.eR.Cc(createVector(), corners[cornerIndex], corners[otherIndex], startDistance / (startDistance - endDistance)));
3134
+ }
3135
+ }
3136
+ }
3137
+ return points;
3138
+ }
3139
+ function getInPlaneRotatedSliceGeometry(volume, focalPoint, viewPlaneNormal, sliceAxis) {
3140
+ const { dimensions, imageData, spacing } = volume;
3141
+ const axes = getVolumeAxes(volume);
3142
+ const continuousIndex = esm.utilities.transformWorldToIndexContinuous(imageData, focalPoint);
3143
+ const sliceIndex = Math.floor(continuousIndex[sliceAxis] + 0.5 - SLICE_INDEX_EPSILON);
3144
+ if (sliceIndex < 0 || sliceIndex >= dimensions[sliceAxis]) {
3145
+ return;
3146
+ }
3147
+ const [xAxis, yAxis] = [0, 1, 2].filter((axis) => axis !== sliceAxis);
3148
+ const handedness = gl_matrix_esm/* .vec3.dot */.eR.Om(gl_matrix_esm/* .vec3.cross */.eR.$A(createVector(), axes[xAxis], axes[yAxis]), viewPlaneNormal);
3149
+ const rowsFollowAxis = handedness < 0;
3150
+ const originIndex = [0, 0, 0];
3151
+ originIndex[sliceAxis] = sliceIndex;
3152
+ originIndex[yAxis] = rowsFollowAxis ? 0 : dimensions[yAxis] - 1;
3153
+ return {
3154
+ origin: esm.utilities.transformIndexToWorld(imageData, originIndex),
3155
+ xDirection: axes[xAxis],
3156
+ yDirection: rowsFollowAxis
3157
+ ? axes[yAxis]
3158
+ : gl_matrix_esm/* .vec3.negate */.eR.ze(createVector(), axes[yAxis]),
3159
+ zDirection: viewPlaneNormal,
3160
+ spacing: [spacing[xAxis], spacing[yAxis]],
3161
+ width: dimensions[xAxis],
3162
+ height: dimensions[yAxis],
3163
+ sliceIndex,
3164
+ };
3165
+ }
3166
+ function getObliqueSliceGeometry(volume, focalPoint, viewPlaneNormal) {
3167
+ const { dimensions, imageData } = volume;
3168
+ const sliceAxisDirection = getVolumeAxes(volume)[2];
3169
+ const xDirection = gl_matrix_esm/* .vec3.normalize */.eR.S8(createVector(), gl_matrix_esm/* .vec3.cross */.eR.$A(createVector(), sliceAxisDirection, viewPlaneNormal));
3170
+ const yDirection = gl_matrix_esm/* .vec3.normalize */.eR.S8(createVector(), gl_matrix_esm/* .vec3.cross */.eR.$A(createVector(), xDirection, viewPlaneNormal));
3171
+ const points = getPlaneVolumeIntersectionPoints(volume, focalPoint, viewPlaneNormal);
3172
+ if (points.length < MINIMUM_PLANE_INTERSECTION_POINTS) {
3173
+ return;
3174
+ }
3175
+ const extent = {
3176
+ minX: Infinity,
3177
+ maxX: -Infinity,
3178
+ minY: Infinity,
3179
+ maxY: -Infinity,
3180
+ };
3181
+ points.forEach((point) => {
3182
+ const offset = gl_matrix_esm/* .vec3.subtract */.eR.Re(createVector(), point, focalPoint);
3183
+ const x = gl_matrix_esm/* .vec3.dot */.eR.Om(offset, xDirection);
3184
+ const y = gl_matrix_esm/* .vec3.dot */.eR.Om(offset, yDirection);
3185
+ extent.minX = Math.min(extent.minX, x);
3186
+ extent.maxX = Math.max(extent.maxX, x);
3187
+ extent.minY = Math.min(extent.minY, y);
3188
+ extent.maxY = Math.max(extent.maxY, y);
3189
+ });
3190
+ const extentX = extent.maxX - extent.minX;
3191
+ const extentY = extent.maxY - extent.minY;
3192
+ const width = Math.min(MAX_RESAMPLED_SLICE_SIZE, Math.max(1, Math.ceil(extentX /
3193
+ esm.utilities.getEffectiveSpacingAlongDirection(volume, xDirection))));
3194
+ const height = Math.min(MAX_RESAMPLED_SLICE_SIZE, Math.max(1, Math.ceil(extentY /
3195
+ esm.utilities.getEffectiveSpacingAlongDirection(volume, yDirection))));
3196
+ const pixelSpacing = [extentX / width, extentY / height];
3197
+ if (!(pixelSpacing[0] > 0) || !(pixelSpacing[1] > 0)) {
3198
+ return;
3199
+ }
3200
+ const origin = stepAlong(stepAlong(focalPoint, xDirection, extent.minX + pixelSpacing[0] / 2), yDirection, extent.minY + pixelSpacing[1] / 2);
3201
+ const continuousIndex = esm.utilities.transformWorldToIndexContinuous(imageData, focalPoint);
3202
+ return {
3203
+ origin,
3204
+ xDirection,
3205
+ yDirection,
3206
+ zDirection: viewPlaneNormal,
3207
+ spacing: pixelSpacing,
3208
+ width,
3209
+ height,
3210
+ sliceIndex: Math.min(Math.max(Math.round(continuousIndex[2]), 0), dimensions[2] - 1),
3211
+ };
3212
+ }
3213
+ function getResampledSliceGeometry(viewport, volume, camera = getSliceRenderingCamera(viewport)) {
3214
+ if (!camera) {
3215
+ return;
3216
+ }
3217
+ const viewPlaneNormal = gl_matrix_esm/* .vec3.normalize */.eR.S8(createVector(), camera.viewPlaneNormal);
3218
+ const sliceAxis = getExactSliceAxis(volume, viewPlaneNormal);
3219
+ if (sliceAxis !== undefined) {
3220
+ return getInPlaneRotatedSliceGeometry(volume, camera.focalPoint, viewPlaneNormal, sliceAxis);
3221
+ }
3222
+ return getObliqueSliceGeometry(volume, camera.focalPoint, viewPlaneNormal);
3223
+ }
3224
+ function sampleResampledSlice(volume, geometry) {
3225
+ const { imageData, voxelManager } = volume;
3226
+ const { origin, xDirection, yDirection, spacing, width, height } = geometry;
3227
+ const SliceDataConstructor = voxelManager.getConstructor();
3228
+ const pixelData = new SliceDataConstructor(width * height);
3229
+ const startIndex = esm.utilities.transformWorldToIndexContinuous(imageData, origin);
3230
+ const afterColumn = esm.utilities.transformWorldToIndexContinuous(imageData, stepAlong(origin, xDirection, spacing[0]));
3231
+ const afterRow = esm.utilities.transformWorldToIndexContinuous(imageData, stepAlong(origin, yDirection, spacing[1]));
3232
+ esm.utilities.sampleVolumeGrid({
3233
+ volume,
3234
+ pixelData,
3235
+ width,
3236
+ height,
3237
+ startIndex,
3238
+ columnStep: [0, 1, 2].map((axis) => afterColumn[axis] - startIndex[axis]),
3239
+ rowStep: [0, 1, 2].map((axis) => afterRow[axis] - startIndex[axis]),
3240
+ interpolationType: esm.Enums.InterpolationType.NEAREST,
3241
+ });
3242
+ return pixelData;
3243
+ }
3244
+ function createResampledSliceImageData(volume, viewport, camera = getSliceRenderingCamera(viewport)) {
3245
+ const geometry = getResampledSliceGeometry(viewport, volume, camera);
3246
+ if (!geometry) {
3247
+ return;
3248
+ }
3249
+ const pixelData = sampleResampledSlice(volume, geometry);
3250
+ const dataType = DataArray/* ["default"].getDataType */.Ay.getDataType(pixelData);
3251
+ const scalarArray = DataArray/* ["default"].newInstance */.Ay.newInstance({
3252
+ dataType,
3253
+ name: 'Pixels',
3254
+ numberOfComponents: 1,
3255
+ values: pixelData,
3256
+ });
3257
+ const imageData = ImageData/* ["default"].newInstance */.Ay.newInstance();
3258
+ imageData.set({ dataType, numberOfComponents: 1 }, true);
3259
+ imageData.setDimensions(geometry.width, geometry.height, 1);
3260
+ imageData.setSpacing([geometry.spacing[0], geometry.spacing[1], 1]);
3261
+ imageData.setDirection(new Float32Array([
3262
+ ...geometry.xDirection,
3263
+ ...geometry.yDirection,
3264
+ ...geometry.zDirection,
3265
+ ]));
3266
+ imageData.setOrigin(geometry.origin);
3267
+ imageData.getPointData().setScalars(scalarArray);
3268
+ imageData.modified();
3269
+ return {
3270
+ imageData,
3271
+ sliceIndex: geometry.sliceIndex,
3272
+ };
3273
+ }
3274
+ function createPlanarSliceImageData(volume, viewport, camera = getSliceRenderingCamera(viewport)) {
3275
+ if (!camera) {
3276
+ return;
3277
+ }
3278
+ const alignedSlice = getExactSliceAxis(volume, camera.viewPlaneNormal) !== undefined
3279
+ ? createSliceImageData(volume, viewport, camera)
3280
+ : undefined;
3281
+ if (alignedSlice) {
3282
+ return {
3283
+ imageData: alignedSlice.imageData,
3284
+ sliceIndex: alignedSlice.state.sliceIndex,
3285
+ };
3286
+ }
3287
+ return createResampledSliceImageData(volume, viewport, camera);
3288
+ }
3289
+ function canCreateResampledSliceImageData(volume, viewport, camera = getSliceRenderingCamera(viewport)) {
3290
+ return !!getResampledSliceGeometry(viewport, volume, camera);
3291
+ }
3292
+
3293
+
3079
3294
  ;// CONCATENATED MODULE: ../../node_modules/@cornerstonejs/tools/dist/esm/tools/displayTools/Labelmap/volumeLabelmapImageMapper.js
3080
3295
 
3081
3296
 
@@ -3084,6 +3299,7 @@ function createSliceImageData(volume, viewport) {
3084
3299
 
3085
3300
 
3086
3301
 
3302
+
3087
3303
  const OVERLAY_RENDERER_SUFFIX = 'labelmap-image-mapper-overlay';
3088
3304
  function isPlanarSliceRenderingViewport(viewport) {
3089
3305
  const compatibilityViewport = viewport;
@@ -3149,20 +3365,32 @@ function getVolumeLabelmapImageMapperRepresentationUIDs(viewport, segmentationId
3149
3365
  return [];
3150
3366
  }
3151
3367
  const useStablePlanarUID = isPlanarSliceRenderingViewport(viewport);
3368
+ const sliceViewport = viewport;
3369
+ const camera = getSliceRenderingCamera(sliceViewport);
3152
3370
  return (0,labelmapSegmentationState/* .getLabelmaps */.m)(segmentation)
3153
3371
  .map((layer) => {
3154
3372
  const volume = (0,labelmapSegmentationState/* .getOrCreateLabelmapVolume */.kL)(layer);
3155
3373
  if (!volume) {
3156
3374
  return;
3157
3375
  }
3158
- const state = getSliceState(viewport, volume);
3376
+ const state = getSliceState(sliceViewport, volume, camera);
3377
+ if (useStablePlanarUID) {
3378
+ const canShowSlice = !!state ||
3379
+ canCreateResampledSliceImageData(volume, sliceViewport, camera);
3380
+ return canShowSlice
3381
+ ? (0,labelmapRepresentationUID/* .createLabelmapRepresentationUID */.Ox)({
3382
+ segmentationId,
3383
+ referencedId: layer.labelmapId,
3384
+ })
3385
+ : undefined;
3386
+ }
3159
3387
  if (!state) {
3160
3388
  return;
3161
3389
  }
3162
3390
  return (0,labelmapRepresentationUID/* .createLabelmapRepresentationUID */.Ox)({
3163
3391
  segmentationId,
3164
3392
  referencedId: layer.labelmapId,
3165
- ...(useStablePlanarUID ? {} : { sliceStateKey: state.key }),
3393
+ sliceStateKey: state.key,
3166
3394
  });
3167
3395
  })
3168
3396
  .filter((value) => !!value);
@@ -3273,17 +3501,18 @@ function getLabelmapForActorReference(segmentation, referencedId) {
3273
3501
  }
3274
3502
  async function addPlanarLabelmapImageMapperActors(args) {
3275
3503
  const { viewport, segmentation, segmentationId } = args;
3504
+ const camera = getSliceRenderingCamera(viewport);
3276
3505
  for (const [index, layer] of (0,labelmapSegmentationState/* .getLabelmaps */.m)(segmentation).entries()) {
3277
3506
  const volume = (0,labelmapSegmentationState/* .getOrCreateLabelmapVolume */.kL)(layer);
3278
3507
  if (!volume) {
3279
3508
  continue;
3280
3509
  }
3281
- const sliceData = createSliceImageData(volume, viewport);
3510
+ const sliceData = createPlanarSliceImageData(volume, viewport, camera);
3282
3511
  if (!sliceData) {
3283
3512
  continue;
3284
3513
  }
3285
3514
  const currentImageId = viewport.getCurrentImageId() ??
3286
- volume.imageIds[Math.min(Math.max(sliceData.state.sliceIndex, 0), Math.max(volume.imageIds.length - 1, 0))];
3515
+ volume.imageIds[Math.min(Math.max(sliceData.sliceIndex, 0), Math.max(volume.imageIds.length - 1, 0))];
3287
3516
  if (!currentImageId) {
3288
3517
  continue;
3289
3518
  }
@@ -3306,7 +3535,6 @@ async function addPlanarLabelmapImageMapperActors(args) {
3306
3535
  excludeFromFidelity: true,
3307
3536
  callback: ({ imageActor }) => {
3308
3537
  const mapper = imageActor.getMapper();
3309
- const camera = getSliceRenderingCamera(viewport);
3310
3538
  mapper.setInputData(sliceData.imageData);
3311
3539
  mapper.modified();
3312
3540
  if (camera) {
@@ -3323,6 +3551,7 @@ function updatePlanarLabelmapImageMapperActors(args) {
3323
3551
  const actorEntriesByLabelmapId = new Map((actorEntries ?? viewport.getActors())
3324
3552
  .filter((actorEntry) => (0,labelmapRepresentationUID/* .isLabelmapRepresentationUID */.qV)(actorEntry.representationUID, segmentationId))
3325
3553
  .map((actorEntry) => [actorEntry.referencedId, actorEntry]));
3554
+ const camera = getSliceRenderingCamera(viewport);
3326
3555
  (0,labelmapSegmentationState/* .getLabelmaps */.m)(segmentation).forEach((layer, index) => {
3327
3556
  const actorEntry = actorEntriesByLabelmapId.get(layer.labelmapId);
3328
3557
  if (!actorEntry) {
@@ -3332,14 +3561,13 @@ function updatePlanarLabelmapImageMapperActors(args) {
3332
3561
  if (!volume) {
3333
3562
  return;
3334
3563
  }
3335
- const sliceData = createSliceImageData(volume, viewport);
3564
+ const sliceData = createPlanarSliceImageData(volume, viewport, camera);
3336
3565
  if (!sliceData) {
3337
3566
  return;
3338
3567
  }
3339
3568
  const mapper = actorEntry.actor.getMapper();
3340
3569
  mapper.setInputData(sliceData.imageData);
3341
3570
  mapper.modified();
3342
- const camera = getSliceRenderingCamera(viewport);
3343
3571
  if (camera) {
3344
3572
  applyPlanarOverlayDepthOffset(actorEntry.actor, camera.viewPlaneNormal, index + 1);
3345
3573
  }
@@ -874,7 +874,7 @@ const commandsModule = ({ servicesManager, extensionManager, commandsManager })=
874
874
  },
875
875
  ...getSegmentationSaveOptions(customizationService, dataSourceStoreOverride),
876
876
  ...generateOptions,
877
- ...src/* .utils.getOhifWriterHeader */.Wp.getOhifWriterHeader('@cornerstonejs/adapters', 'CS3D', (/* inlined export .version */"5.18.0"), generateOptions)
877
+ ...src/* .utils.getOhifWriterHeader */.Wp.getOhifWriterHeader('@cornerstonejs/adapters', 'CS3D', (/* inlined export .version */"5.18.3"), generateOptions)
878
878
  }; // A LABELMAP SEG frame stores a single label per voxel, so the labelmap
879
879
  // encoder cannot represent overlapping segments — it keeps only the last
880
880
  // layer written to each voxel. Overlapping segmentations arrive here as
@@ -998,7 +998,7 @@ const commandsModule = ({ servicesManager, extensionManager, commandsManager })=
998
998
  StructureSetDate: structureSetDate,
999
999
  StructureSetTime: structureSetTime,
1000
1000
  ...contourOptions,
1001
- ...src/* .utils.getOhifWriterHeader */.Wp.getOhifWriterHeader('@cornerstonejs/adapters', 'CS3D', (/* inlined export .version */"5.18.0"), contourOptions)
1001
+ ...src/* .utils.getOhifWriterHeader */.Wp.getOhifWriterHeader('@cornerstonejs/adapters', 'CS3D', (/* inlined export .version */"5.18.3"), contourOptions)
1002
1002
  });
1003
1003
  return {
1004
1004
  dataset