@cornerstonejs/adapters 1.53.0 → 1.54.1
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/adapters.es.js +204 -97
- package/dist/adapters.es.js.map +1 -1
- package/package.json +5 -5
package/dist/adapters.es.js
CHANGED
|
@@ -5097,6 +5097,7 @@ var Events$2;
|
|
|
5097
5097
|
Events["GEOMETRY_CACHE_GEOMETRY_ADDED"] = "CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED";
|
|
5098
5098
|
Events["VOLUME_SCROLL_OUT_OF_BOUNDS"] = "CORNERSTONE_VOLUME_SCROLL_OUT_OF_BOUNDS";
|
|
5099
5099
|
Events["CLIPPING_PLANES_UPDATED"] = "CORNERSTONE_CLIPPING_PLANES_UPDATED";
|
|
5100
|
+
Events["WEB_WORKER_PROGRESS"] = "CORNERSTONE_WEB_WORKER_PROGRESS";
|
|
5100
5101
|
})(Events$2 || (Events$2 = {}));
|
|
5101
5102
|
var EVENTS = Events$2;
|
|
5102
5103
|
|
|
@@ -14331,7 +14332,7 @@ class RequestPoolManager {
|
|
|
14331
14332
|
interaction: 6,
|
|
14332
14333
|
thumbnail: 6,
|
|
14333
14334
|
prefetch: 5,
|
|
14334
|
-
compute:
|
|
14335
|
+
compute: 1000
|
|
14335
14336
|
};
|
|
14336
14337
|
}
|
|
14337
14338
|
setMaxSimultaneousRequests(type, maxNumRequests) {
|
|
@@ -27700,6 +27701,15 @@ class ImageVolume {
|
|
|
27700
27701
|
getScalarDataArrays() {
|
|
27701
27702
|
return this.isDynamicVolume() ? this.scalarData : [this.scalarData];
|
|
27702
27703
|
}
|
|
27704
|
+
modified() {
|
|
27705
|
+
this.imageData.modified();
|
|
27706
|
+
if (this.isDynamicVolume()) {
|
|
27707
|
+
throw new Error('Not implemented');
|
|
27708
|
+
} else {
|
|
27709
|
+
this.scalarData = this.imageData.getPointData().getScalars().getData();
|
|
27710
|
+
}
|
|
27711
|
+
this.numFrames = this._getNumFrames();
|
|
27712
|
+
}
|
|
27703
27713
|
decache(completelyRemove = false) {
|
|
27704
27714
|
if (completelyRemove) {
|
|
27705
27715
|
this.removeFromCache();
|
|
@@ -27863,8 +27873,11 @@ class ImageVolume {
|
|
|
27863
27873
|
const byteLength = this.sizeInBytes;
|
|
27864
27874
|
if (!this.imageIds?.length) {
|
|
27865
27875
|
const referencedVolumeId = this.referencedVolumeId;
|
|
27866
|
-
|
|
27867
|
-
|
|
27876
|
+
let numSlices = this.dimensions[2];
|
|
27877
|
+
if (referencedVolumeId) {
|
|
27878
|
+
const referencedVolume = cache$1.getVolume(referencedVolumeId);
|
|
27879
|
+
numSlices = referencedVolume?.imageIds?.length ?? numSlices;
|
|
27880
|
+
}
|
|
27868
27881
|
this.imageIds = Array.from({
|
|
27869
27882
|
length: numSlices
|
|
27870
27883
|
}, (_, i) => {
|
|
@@ -27930,6 +27943,12 @@ class ImageVolume {
|
|
|
27930
27943
|
});
|
|
27931
27944
|
});
|
|
27932
27945
|
}
|
|
27946
|
+
const otherVolumes = cache$1.filterVolumesByReferenceId(this.volumeId);
|
|
27947
|
+
if (otherVolumes.length) {
|
|
27948
|
+
otherVolumes.forEach(volume => {
|
|
27949
|
+
volume.referencedImageIds = this.imageIds;
|
|
27950
|
+
});
|
|
27951
|
+
}
|
|
27933
27952
|
this.removeFromCache();
|
|
27934
27953
|
return this.imageIds;
|
|
27935
27954
|
}
|
|
@@ -28073,6 +28092,16 @@ class Cache {
|
|
|
28073
28092
|
cachedVolume.timeStamp = Date.now();
|
|
28074
28093
|
return cachedVolume.volume;
|
|
28075
28094
|
};
|
|
28095
|
+
this.getVolumes = () => {
|
|
28096
|
+
const cachedVolumes = Array.from(this._volumeCache.values());
|
|
28097
|
+
return cachedVolumes.map(cachedVolume => cachedVolume.volume);
|
|
28098
|
+
};
|
|
28099
|
+
this.filterVolumesByReferenceId = volumeId => {
|
|
28100
|
+
const cachedVolumes = this.getVolumes();
|
|
28101
|
+
return cachedVolumes.filter(volume => {
|
|
28102
|
+
return volume.referencedVolumeId === volumeId;
|
|
28103
|
+
});
|
|
28104
|
+
};
|
|
28076
28105
|
this.removeImageLoadObject = imageId => {
|
|
28077
28106
|
if (imageId === undefined) {
|
|
28078
28107
|
throw new Error('removeImageLoadObject: imageId must not be undefined');
|
|
@@ -35630,6 +35659,20 @@ function _processImageCacheOffsetMap(volume, scalarData) {
|
|
|
35630
35659
|
});
|
|
35631
35660
|
}
|
|
35632
35661
|
function _processVolumeImages(volume, scalarData) {
|
|
35662
|
+
let compatibleScalarData = scalarData;
|
|
35663
|
+
const sampleImageIdWithImage = volume.imageIds.find(imageId => {
|
|
35664
|
+
const image = cache$1.getImage(imageId);
|
|
35665
|
+
return image;
|
|
35666
|
+
});
|
|
35667
|
+
if (!sampleImageIdWithImage) {
|
|
35668
|
+
return;
|
|
35669
|
+
}
|
|
35670
|
+
const sampleImage = cache$1.getImage(sampleImageIdWithImage);
|
|
35671
|
+
const samplePixelData = sampleImage.imageFrame?.pixelData || sampleImage.getPixelData();
|
|
35672
|
+
if (scalarData.constructor !== samplePixelData.constructor) {
|
|
35673
|
+
compatibleScalarData = new samplePixelData.constructor(scalarData.length);
|
|
35674
|
+
compatibleScalarData.set(scalarData);
|
|
35675
|
+
}
|
|
35633
35676
|
volume.imageIds.forEach(imageId => {
|
|
35634
35677
|
const image = cache$1.getImage(imageId);
|
|
35635
35678
|
if (!image) {
|
|
@@ -35637,7 +35680,7 @@ function _processVolumeImages(volume, scalarData) {
|
|
|
35637
35680
|
}
|
|
35638
35681
|
const index = volume.getImageIdIndex(imageId);
|
|
35639
35682
|
const offset = index * image.getPixelData().byteLength;
|
|
35640
|
-
_updateImageWithScalarDataView(image,
|
|
35683
|
+
_updateImageWithScalarDataView(image, compatibleScalarData, offset);
|
|
35641
35684
|
cache$1.decrementImageCacheSize(image.sizeInBytes);
|
|
35642
35685
|
});
|
|
35643
35686
|
}
|
|
@@ -39513,13 +39556,11 @@ async function getVOIFromMinMax(imageVolume, useNativeDataType) {
|
|
|
39513
39556
|
scalingParameters: scalingParametersToUse
|
|
39514
39557
|
}
|
|
39515
39558
|
};
|
|
39516
|
-
|
|
39517
|
-
|
|
39518
|
-
|
|
39519
|
-
imageScalarData = _getImageScalarDataFromImageVolume(imageVolume, byteOffset, bytePerPixel, voxelsPerImage);
|
|
39520
|
-
} else {
|
|
39521
|
-
imageScalarData = image.getPixelData();
|
|
39559
|
+
let image = cache$1.getImage(imageId);
|
|
39560
|
+
if (!image?.referencedImageId) {
|
|
39561
|
+
image = await loadAndCacheImage(imageId, options);
|
|
39522
39562
|
}
|
|
39563
|
+
const imageScalarData = image ? image.getPixelData() : _getImageScalarDataFromImageVolume(imageVolume, byteOffset, bytePerPixel, voxelsPerImage);
|
|
39523
39564
|
const {
|
|
39524
39565
|
min,
|
|
39525
39566
|
max
|
|
@@ -40511,7 +40552,6 @@ class Viewport {
|
|
|
40511
40552
|
this.flipHorizontal = false;
|
|
40512
40553
|
this.flipVertical = false;
|
|
40513
40554
|
this.viewportStatus = ViewportStatus$1.NO_DATA;
|
|
40514
|
-
this.newActorAdded = false;
|
|
40515
40555
|
this._suppressCameraModifiedEvents = false;
|
|
40516
40556
|
this.hasPixelSpacing = true;
|
|
40517
40557
|
this.id = props.id;
|
|
@@ -40706,7 +40746,6 @@ class Viewport {
|
|
|
40706
40746
|
const renderer = this.getRenderer();
|
|
40707
40747
|
renderer.addActor(actor);
|
|
40708
40748
|
this._actors.set(actorUID, Object.assign({}, actorEntry));
|
|
40709
|
-
this.newActorAdded = true;
|
|
40710
40749
|
}
|
|
40711
40750
|
removeAllActors() {
|
|
40712
40751
|
this.getRenderer().removeAllViewProps();
|
|
@@ -40853,6 +40892,7 @@ class Viewport {
|
|
|
40853
40892
|
radius = w1 + w2 + w3;
|
|
40854
40893
|
radius = radius === 0 ? 1.0 : radius;
|
|
40855
40894
|
radius = Math.sqrt(radius) * 0.5;
|
|
40895
|
+
radius = this.type === ViewportType$1.VOLUME_3D ? radius * 10 : radius;
|
|
40856
40896
|
const distance = this.insetImageMultiplier * radius;
|
|
40857
40897
|
const viewUpToSet = Math.abs(vtkMath.dot(viewUp, viewPlaneNormal)) > 0.999 ? [-viewUp[2], viewUp[0], viewUp[1]] : viewUp;
|
|
40858
40898
|
const focalPointToSet = this._getFocalPointForResetCamera(focalPoint, previousCamera, {
|
|
@@ -41057,7 +41097,7 @@ class Viewport {
|
|
|
41057
41097
|
if (viewUp) {
|
|
41058
41098
|
viewUpHasChanged = !isEqual$2(currentViewUp, prevViewUp);
|
|
41059
41099
|
}
|
|
41060
|
-
if (cameraModifiedOutOfPlane || viewUpHasChanged
|
|
41100
|
+
if (cameraModifiedOutOfPlane || viewUpHasChanged) {
|
|
41061
41101
|
const actorEntry = this.getDefaultActor();
|
|
41062
41102
|
if (!actorEntry?.actor) {
|
|
41063
41103
|
return;
|
|
@@ -41065,7 +41105,7 @@ class Viewport {
|
|
|
41065
41105
|
if (!actorIsA(actorEntry, 'vtkActor')) {
|
|
41066
41106
|
this.updateClippingPlanesForActors(updatedCamera);
|
|
41067
41107
|
}
|
|
41068
|
-
if (actorIsA(actorEntry, 'vtkImageSlice')) {
|
|
41108
|
+
if (actorIsA(actorEntry, 'vtkImageSlice') || this.type === ViewportType$1.VOLUME_3D) {
|
|
41069
41109
|
const renderer = this.getRenderer();
|
|
41070
41110
|
renderer.resetCameraClippingRange();
|
|
41071
41111
|
}
|
|
@@ -41116,10 +41156,6 @@ class Viewport {
|
|
|
41116
41156
|
viewport: this
|
|
41117
41157
|
});
|
|
41118
41158
|
});
|
|
41119
|
-
this.posProcessNewActors();
|
|
41120
|
-
}
|
|
41121
|
-
posProcessNewActors() {
|
|
41122
|
-
this.newActorAdded = false;
|
|
41123
41159
|
}
|
|
41124
41160
|
setOrientationOfClippingPlanes(vtkPlanes, slabThickness, viewPlaneNormal, focalPoint) {
|
|
41125
41161
|
if (vtkPlanes.length < 2) {
|
|
@@ -41136,6 +41172,20 @@ class Viewport {
|
|
|
41136
41172
|
vtkMath.add(focalPoint, scaledDistance, newOrigin2);
|
|
41137
41173
|
vtkPlanes[1].setOrigin(newOrigin2);
|
|
41138
41174
|
}
|
|
41175
|
+
getClippingPlanesForActor(actorEntry) {
|
|
41176
|
+
if (!actorEntry) {
|
|
41177
|
+
actorEntry = this.getDefaultActor();
|
|
41178
|
+
}
|
|
41179
|
+
if (!actorEntry.actor) {
|
|
41180
|
+
throw new Error('Invalid actor entry: Actor is undefined');
|
|
41181
|
+
}
|
|
41182
|
+
const mapper = actorEntry.actor.getMapper();
|
|
41183
|
+
let vtkPlanes = actorEntry?.clippingFilter ? actorEntry.clippingFilter.getClippingPlanes() : mapper.getClippingPlanes();
|
|
41184
|
+
if (vtkPlanes.length === 0 && actorEntry?.clippingFilter) {
|
|
41185
|
+
vtkPlanes = [vtkPlane$1.newInstance(), vtkPlane$1.newInstance()];
|
|
41186
|
+
}
|
|
41187
|
+
return vtkPlanes;
|
|
41188
|
+
}
|
|
41139
41189
|
_getWorldDistanceViewUpAndViewRight(bounds, viewUp, viewPlaneNormal) {
|
|
41140
41190
|
const viewUpCorners = this._getCorners(bounds);
|
|
41141
41191
|
const viewRightCorners = this._getCorners(bounds);
|
|
@@ -42094,7 +42144,7 @@ async function convertVolumeToStackViewport({
|
|
|
42094
42144
|
});
|
|
42095
42145
|
imageIdIndexToJump = minDistanceIndex;
|
|
42096
42146
|
}
|
|
42097
|
-
await stackViewport.setStack(stack, imageIdIndexToJump);
|
|
42147
|
+
await stackViewport.setStack(stack, imageIdIndexToJump ?? 0);
|
|
42098
42148
|
stackViewport.render();
|
|
42099
42149
|
return stackViewport;
|
|
42100
42150
|
}
|
|
@@ -42221,6 +42271,9 @@ class VoxelManager {
|
|
|
42221
42271
|
bounds[2][1] = Math.max(point[2], bounds[2][1]);
|
|
42222
42272
|
}
|
|
42223
42273
|
static createVolumeVoxelManager(dimensions, scalarData) {
|
|
42274
|
+
if (dimensions.length !== 3) {
|
|
42275
|
+
throw new Error('Dimensions must be provided as [number, number, number] for [width, height, depth]');
|
|
42276
|
+
}
|
|
42224
42277
|
const voxels = new VoxelManager(dimensions, index => scalarData[index], (index, v) => {
|
|
42225
42278
|
const isChanged = scalarData[index] !== v;
|
|
42226
42279
|
scalarData[index] = v;
|
|
@@ -42302,6 +42355,17 @@ function convertToGrayscale(scalarData, width, height) {
|
|
|
42302
42355
|
}
|
|
42303
42356
|
}
|
|
42304
42357
|
|
|
42358
|
+
function getViewportImageIds(viewport) {
|
|
42359
|
+
if (viewport instanceof VolumeViewport$1) {
|
|
42360
|
+
const defaultActor = viewport.getDefaultActor();
|
|
42361
|
+
const volumeId = defaultActor.uid;
|
|
42362
|
+
const volume = cache$1.getVolume(volumeId);
|
|
42363
|
+
return volume.imageIds;
|
|
42364
|
+
} else if (viewport.getImageIds) {
|
|
42365
|
+
return viewport.getImageIds();
|
|
42366
|
+
}
|
|
42367
|
+
}
|
|
42368
|
+
|
|
42305
42369
|
function linePlaneIntersection(p0, p1, plane) {
|
|
42306
42370
|
const [x0, y0, z0] = p0;
|
|
42307
42371
|
const [x1, y1, z1] = p1;
|
|
@@ -42412,6 +42476,7 @@ var utilities = /*#__PURE__*/Object.freeze({
|
|
|
42412
42476
|
getSpacingInNormalDirection: getSpacingInNormalDirection,
|
|
42413
42477
|
getTargetVolumeAndSpacingInNormalDir: getTargetVolumeAndSpacingInNormalDir,
|
|
42414
42478
|
getViewportImageCornersInWorld: getViewportImageCornersInWorld,
|
|
42479
|
+
getViewportImageIds: getViewportImageIds,
|
|
42415
42480
|
getViewportModality: getViewportModality,
|
|
42416
42481
|
getViewportsWithImageURI: getViewportsWithImageURI,
|
|
42417
42482
|
getViewportsWithVolumeId: getViewportsWithVolumeId,
|
|
@@ -42463,6 +42528,12 @@ class VolumeViewport extends BaseVolumeViewport$1 {
|
|
|
42463
42528
|
} = getImageSliceDataForVolumeViewport(this);
|
|
42464
42529
|
return numberOfSlices;
|
|
42465
42530
|
};
|
|
42531
|
+
this.getSliceIndex = () => {
|
|
42532
|
+
const {
|
|
42533
|
+
imageIndex
|
|
42534
|
+
} = getImageSliceDataForVolumeViewport(this);
|
|
42535
|
+
return imageIndex;
|
|
42536
|
+
};
|
|
42466
42537
|
this.getCurrentImageIdIndex = volumeId => {
|
|
42467
42538
|
const {
|
|
42468
42539
|
viewPlaneNormal,
|
|
@@ -42503,6 +42574,37 @@ class VolumeViewport extends BaseVolumeViewport$1 {
|
|
|
42503
42574
|
} = this.getCamera();
|
|
42504
42575
|
return getClosestImageId(volume, focalPoint, viewPlaneNormal);
|
|
42505
42576
|
};
|
|
42577
|
+
this.getSlicePlaneCoordinates = () => {
|
|
42578
|
+
const actorEntry = this.getDefaultActor();
|
|
42579
|
+
if (!actorEntry?.actor) {
|
|
42580
|
+
console.warn('No image data found for calculating vtkPlanes.');
|
|
42581
|
+
return [];
|
|
42582
|
+
}
|
|
42583
|
+
const volumeId = actorEntry.uid;
|
|
42584
|
+
const imageVolume = cache$1.getVolume(volumeId);
|
|
42585
|
+
const camera = this.getCamera();
|
|
42586
|
+
const {
|
|
42587
|
+
focalPoint,
|
|
42588
|
+
position,
|
|
42589
|
+
viewPlaneNormal
|
|
42590
|
+
} = camera;
|
|
42591
|
+
const spacingInNormalDirection = getSpacingInNormalDirection(imageVolume, viewPlaneNormal);
|
|
42592
|
+
const sliceRange = getSliceRange(actorEntry.actor, viewPlaneNormal, focalPoint);
|
|
42593
|
+
const numSlicesBackward = Math.round((sliceRange.current - sliceRange.min) / spacingInNormalDirection);
|
|
42594
|
+
const numSlicesForward = Math.round((sliceRange.max - sliceRange.current) / spacingInNormalDirection);
|
|
42595
|
+
const currentSliceIndex = this.getSliceIndex();
|
|
42596
|
+
const focalPoints = [];
|
|
42597
|
+
for (let i = -numSlicesBackward; i <= numSlicesForward; i++) {
|
|
42598
|
+
const {
|
|
42599
|
+
newFocalPoint: point
|
|
42600
|
+
} = snapFocalPointToSlice(focalPoint, position, sliceRange, viewPlaneNormal, spacingInNormalDirection, i);
|
|
42601
|
+
focalPoints.push({
|
|
42602
|
+
sliceIndex: currentSliceIndex + i,
|
|
42603
|
+
point
|
|
42604
|
+
});
|
|
42605
|
+
}
|
|
42606
|
+
return focalPoints;
|
|
42607
|
+
};
|
|
42506
42608
|
const {
|
|
42507
42609
|
orientation
|
|
42508
42610
|
} = this.options;
|
|
@@ -42536,25 +42638,33 @@ class VolumeViewport extends BaseVolumeViewport$1 {
|
|
|
42536
42638
|
}
|
|
42537
42639
|
setOrientation(orientation, immediate = true) {
|
|
42538
42640
|
let viewPlaneNormal, viewUp;
|
|
42539
|
-
if (
|
|
42540
|
-
({
|
|
42641
|
+
if (typeof orientation === 'string') {
|
|
42642
|
+
if (MPR_CAMERA_VALUES$1[orientation]) {
|
|
42643
|
+
({
|
|
42644
|
+
viewPlaneNormal,
|
|
42645
|
+
viewUp
|
|
42646
|
+
} = MPR_CAMERA_VALUES$1[orientation]);
|
|
42647
|
+
} else if (orientation === 'acquisition') {
|
|
42648
|
+
({
|
|
42649
|
+
viewPlaneNormal,
|
|
42650
|
+
viewUp
|
|
42651
|
+
} = this._getAcquisitionPlaneOrientation());
|
|
42652
|
+
} else {
|
|
42653
|
+
throw new Error(`Invalid orientation: ${orientation}. Use Enums.OrientationAxis instead.`);
|
|
42654
|
+
}
|
|
42655
|
+
this.setCamera({
|
|
42541
42656
|
viewPlaneNormal,
|
|
42542
42657
|
viewUp
|
|
42543
|
-
}
|
|
42544
|
-
|
|
42658
|
+
});
|
|
42659
|
+
this.viewportProperties.orientation = orientation;
|
|
42660
|
+
this.resetCamera();
|
|
42661
|
+
} else {
|
|
42545
42662
|
({
|
|
42546
42663
|
viewPlaneNormal,
|
|
42547
42664
|
viewUp
|
|
42548
|
-
} =
|
|
42549
|
-
|
|
42550
|
-
throw new Error(`Invalid orientation: ${orientation}. Use Enums.OrientationAxis instead.`);
|
|
42665
|
+
} = orientation);
|
|
42666
|
+
this.applyViewOrientation(orientation);
|
|
42551
42667
|
}
|
|
42552
|
-
this.setCamera({
|
|
42553
|
-
viewPlaneNormal,
|
|
42554
|
-
viewUp
|
|
42555
|
-
});
|
|
42556
|
-
this.viewportProperties.orientation = orientation;
|
|
42557
|
-
this.resetCamera();
|
|
42558
42668
|
if (immediate) {
|
|
42559
42669
|
this.render();
|
|
42560
42670
|
}
|
|
@@ -42711,6 +42821,27 @@ class VolumeViewport extends BaseVolumeViewport$1 {
|
|
|
42711
42821
|
this.resetCamera(resetPan, resetZoom, resetToCenter, resetCameraRotation);
|
|
42712
42822
|
triggerEvent(this.element, EVENTS.VOI_MODIFIED, eventDetails);
|
|
42713
42823
|
}
|
|
42824
|
+
getSlicesClippingPlanes() {
|
|
42825
|
+
const focalPoints = this.getSlicePlaneCoordinates();
|
|
42826
|
+
const {
|
|
42827
|
+
viewPlaneNormal
|
|
42828
|
+
} = this.getCamera();
|
|
42829
|
+
const slabThickness = RENDERING_DEFAULTS$1.MINIMUM_SLAB_THICKNESS;
|
|
42830
|
+
return focalPoints.map(({
|
|
42831
|
+
point,
|
|
42832
|
+
sliceIndex
|
|
42833
|
+
}) => {
|
|
42834
|
+
const vtkPlanes = [vtkPlane$1.newInstance(), vtkPlane$1.newInstance()];
|
|
42835
|
+
this.setOrientationOfClippingPlanes(vtkPlanes, slabThickness, viewPlaneNormal, point);
|
|
42836
|
+
return {
|
|
42837
|
+
sliceIndex,
|
|
42838
|
+
planes: vtkPlanes.map(plane => ({
|
|
42839
|
+
normal: plane.getNormal(),
|
|
42840
|
+
origin: plane.getOrigin()
|
|
42841
|
+
}))
|
|
42842
|
+
};
|
|
42843
|
+
});
|
|
42844
|
+
}
|
|
42714
42845
|
}
|
|
42715
42846
|
var VolumeViewport$1 = VolumeViewport;
|
|
42716
42847
|
|
|
@@ -45853,13 +45984,6 @@ class VolumeViewport3D extends BaseVolumeViewport$1 {
|
|
|
45853
45984
|
this.resetVolumeViewportClippingRange();
|
|
45854
45985
|
return;
|
|
45855
45986
|
}
|
|
45856
|
-
posProcessNewActors() {
|
|
45857
|
-
if (this.newActorAdded) {
|
|
45858
|
-
const renderer = this.getRenderer();
|
|
45859
|
-
renderer.resetCameraClippingRange();
|
|
45860
|
-
}
|
|
45861
|
-
super.posProcessNewActors();
|
|
45862
|
-
}
|
|
45863
45987
|
setSlabThickness(slabThickness, filterActorUIDs) {
|
|
45864
45988
|
return null;
|
|
45865
45989
|
}
|
|
@@ -46562,6 +46686,13 @@ class RenderingEngine {
|
|
|
46562
46686
|
});
|
|
46563
46687
|
this.setVtkjsDrivenViewports(vtkDrivenViewportInputEntries);
|
|
46564
46688
|
this.setCustomViewports(customRenderingViewportInputEntries);
|
|
46689
|
+
viewportInputEntries.forEach(vp => {
|
|
46690
|
+
const canvas = getOrCreateCanvas(vp.element);
|
|
46691
|
+
const {
|
|
46692
|
+
background
|
|
46693
|
+
} = vp.defaultOptions;
|
|
46694
|
+
this.fillCanvasWithBackgroundColor(canvas, background);
|
|
46695
|
+
});
|
|
46565
46696
|
}
|
|
46566
46697
|
resize(immediate = true, keepCamera = true) {
|
|
46567
46698
|
this._throwIfDestroyed();
|
|
@@ -47539,6 +47670,9 @@ class FrameOfReferenceSpecificAnnotationManager {
|
|
|
47539
47670
|
this.annotations = cloneDeep(state);
|
|
47540
47671
|
}
|
|
47541
47672
|
};
|
|
47673
|
+
this.getAllAnnotations = () => {
|
|
47674
|
+
return Object.values(this.annotations).map(frameOfReferenceSpecificAnnotations => Object.values(frameOfReferenceSpecificAnnotations)).flat(2);
|
|
47675
|
+
};
|
|
47542
47676
|
this.getNumberOfAllAnnotations = () => {
|
|
47543
47677
|
let count = 0;
|
|
47544
47678
|
const annotations = this.annotations;
|
|
@@ -47682,51 +47816,17 @@ var contourFinder = {
|
|
|
47682
47816
|
findContoursFromReducedSet
|
|
47683
47817
|
};
|
|
47684
47818
|
|
|
47685
|
-
function
|
|
47686
|
-
let index = -1;
|
|
47687
|
-
for (let i = 0; i < array.length; i++) {
|
|
47688
|
-
if (isSamePoint(pt, array[i])) {
|
|
47689
|
-
index = i;
|
|
47690
|
-
}
|
|
47691
|
-
}
|
|
47692
|
-
return index;
|
|
47693
|
-
}
|
|
47694
|
-
function isSamePoint(ptA, ptB) {
|
|
47695
|
-
if (ptA[0] == ptB[0] && ptA[1] == ptB[1] && ptA[2] == ptB[2]) {
|
|
47696
|
-
return true;
|
|
47697
|
-
} else {
|
|
47698
|
-
return false;
|
|
47699
|
-
}
|
|
47700
|
-
}
|
|
47701
|
-
function replacePointIndexReferences(linesArray, oldIndex, newIndex) {
|
|
47702
|
-
for (let i = 0; i < linesArray.length; i++) {
|
|
47703
|
-
const line = linesArray[i];
|
|
47704
|
-
if (line.a == oldIndex) {
|
|
47705
|
-
line.a = newIndex;
|
|
47706
|
-
} else if (line.b == oldIndex) {
|
|
47707
|
-
line.b = newIndex;
|
|
47708
|
-
}
|
|
47709
|
-
}
|
|
47710
|
-
}
|
|
47711
|
-
function removeDuplicatePoints(polyData, bypass = false) {
|
|
47819
|
+
function getDeduplicatedVTKPolyDataPoints(polyData, bypass = false) {
|
|
47712
47820
|
const points = polyData.getPoints();
|
|
47713
47821
|
const lines = polyData.getLines();
|
|
47714
|
-
const pointsArray =
|
|
47715
|
-
|
|
47716
|
-
const pt = points.getPoint(i).slice();
|
|
47717
|
-
pointsArray.push(pt);
|
|
47718
|
-
}
|
|
47719
|
-
const linesArray = [];
|
|
47720
|
-
for (let i = 0; i < lines.getNumberOfCells(); i++) {
|
|
47822
|
+
const pointsArray = new Array(points.getNumberOfPoints()).fill(0).map((_, i) => points.getPoint(i).slice());
|
|
47823
|
+
const linesArray = new Array(lines.getNumberOfCells()).fill(0).map((_, i) => {
|
|
47721
47824
|
const cell = lines.getCell(i * 3).slice();
|
|
47722
|
-
|
|
47723
|
-
|
|
47724
|
-
|
|
47725
|
-
a,
|
|
47726
|
-
b
|
|
47825
|
+
return {
|
|
47826
|
+
a: cell[0],
|
|
47827
|
+
b: cell[1]
|
|
47727
47828
|
};
|
|
47728
|
-
|
|
47729
|
-
}
|
|
47829
|
+
});
|
|
47730
47830
|
if (bypass) {
|
|
47731
47831
|
return {
|
|
47732
47832
|
points: pointsArray,
|
|
@@ -47734,31 +47834,38 @@ function removeDuplicatePoints(polyData, bypass = false) {
|
|
|
47734
47834
|
};
|
|
47735
47835
|
}
|
|
47736
47836
|
const newPoints = [];
|
|
47737
|
-
for (
|
|
47738
|
-
const
|
|
47739
|
-
let index = ptInArray(newPoints, pt);
|
|
47837
|
+
for (const [i, pt] of pointsArray.entries()) {
|
|
47838
|
+
const index = newPoints.findIndex(point => point[0] === pt[0] && point[1] === pt[1] && point[2] === pt[2]);
|
|
47740
47839
|
if (index >= 0) {
|
|
47741
|
-
|
|
47840
|
+
linesArray.map(line => {
|
|
47841
|
+
if (line.a === i) {
|
|
47842
|
+
line.a = index;
|
|
47843
|
+
}
|
|
47844
|
+
if (line.b === i) {
|
|
47845
|
+
line.b = index;
|
|
47846
|
+
}
|
|
47847
|
+
return line;
|
|
47848
|
+
});
|
|
47742
47849
|
} else {
|
|
47743
|
-
|
|
47850
|
+
const newIndex = newPoints.length;
|
|
47744
47851
|
newPoints.push(pt);
|
|
47745
|
-
|
|
47852
|
+
linesArray.map(line => {
|
|
47853
|
+
if (line.a === i) {
|
|
47854
|
+
line.a = newIndex;
|
|
47855
|
+
}
|
|
47856
|
+
if (line.b === i) {
|
|
47857
|
+
line.b = newIndex;
|
|
47858
|
+
}
|
|
47859
|
+
return line;
|
|
47860
|
+
});
|
|
47746
47861
|
}
|
|
47747
47862
|
}
|
|
47748
|
-
const newLines =
|
|
47749
|
-
linesArray.forEach(line => {
|
|
47750
|
-
if (line.a != line.b) {
|
|
47751
|
-
newLines.push(line);
|
|
47752
|
-
}
|
|
47753
|
-
});
|
|
47863
|
+
const newLines = linesArray.filter(line => line.a !== line.b);
|
|
47754
47864
|
return {
|
|
47755
47865
|
points: newPoints,
|
|
47756
47866
|
lines: newLines
|
|
47757
47867
|
};
|
|
47758
47868
|
}
|
|
47759
|
-
var mergePoints = {
|
|
47760
|
-
removeDuplicatePoints
|
|
47761
|
-
};
|
|
47762
47869
|
|
|
47763
47870
|
const getIsPointInsidePolygon = (point, vertices) => {
|
|
47764
47871
|
const x = point[0];
|
|
@@ -48251,7 +48358,7 @@ function generateContourSetsFromLabelmap$2({
|
|
|
48251
48358
|
mSquares.setContourValues(cValues);
|
|
48252
48359
|
mSquares.setMergePoints(false);
|
|
48253
48360
|
const msOutput = mSquares.getOutputData();
|
|
48254
|
-
const reducedSet =
|
|
48361
|
+
const reducedSet = getDeduplicatedVTKPolyDataPoints(msOutput);
|
|
48255
48362
|
if (reducedSet.points?.length) {
|
|
48256
48363
|
const contours = findContoursFromReducedSet(reducedSet.lines);
|
|
48257
48364
|
sliceContours.push({
|
|
@@ -49428,8 +49535,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
49428
49535
|
generateContourSetsFromLabelmap: generateContourSetsFromLabelmap$2,
|
|
49429
49536
|
getContourHolesDataCanvas: getContourHolesDataCanvas,
|
|
49430
49537
|
getContourHolesDataWorld: getContourHolesDataWorld,
|
|
49538
|
+
getDeduplicatedVTKPolyDataPoints: getDeduplicatedVTKPolyDataPoints,
|
|
49431
49539
|
interpolation: index$1,
|
|
49432
|
-
mergePoints: mergePoints,
|
|
49433
49540
|
updateContourPolyline: updateContourPolyline
|
|
49434
49541
|
});
|
|
49435
49542
|
|