Skip to content

Commit a1ed218

Browse files
authored
fix(AdvancedMagnifyTool): Only set the active segment index if there is a segmentation representation. (#2427)
In AdvancedMagnifyTool, used better detection for segmentation actors.
1 parent ed855a5 commit a1ed218

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/tools/src/stateManagement/segmentation/internalAddSegmentationRepresentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ function internalAddSegmentationRepresentation(
4040
if (segmentKeys.length > 0) {
4141
firstSegmentIndex = segmentKeys.map((k) => Number(k)).sort()[0];
4242
}
43+
setActiveSegmentIndex(segmentationId, firstSegmentIndex);
4344
}
44-
setActiveSegmentIndex(segmentationId, firstSegmentIndex);
4545
}
4646

4747
if (representationInput.type === SegmentationRepresentations.Contour) {

packages/tools/src/tools/AdvancedMagnifyTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const MAGNIFY_VIEWPORT_INITIAL_RADIUS = 125;
6868
const { Events: csEvents } = Enums;
6969

7070
// TODO: find a better to identify segmentation actors
71-
const isSegmentation = (actor) => actor.uid !== actor.referencedId;
71+
const isSegmentation = (actor) => !!actor.representationUID;
7272

7373
export type AutoPanCallbackData = {
7474
points: {
@@ -1355,7 +1355,7 @@ class AdvancedMagnifyViewport {
13551355
const actors = sourceViewport.getActors();
13561356
const volumeInputArray: Types.IVolumeInput[] = actors
13571357
.filter((actor) => !isSegmentation(actor))
1358-
.map((actor) => ({ volumeId: actor.uid }));
1358+
.map((actor) => ({ volumeId: actor.referencedId }));
13591359

13601360
magnifyViewport.setVolumes(volumeInputArray).then(() => {
13611361
this._isViewportReady = true;

0 commit comments

Comments
 (0)