Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/tools/examples/petCt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ function setUpToolGroups() {
// Only set CT volume to MIP in the fusion viewport
filterActorUIDsToSetSlabThickness: [ctVolumeId],
});
fusionToolGroup.addTool(RectangleROITool.toolName);
fusionToolGroup.addTool(RectangleROITool.toolName, { volumeId: ptVolumeId });

// Here is the difference in the toolGroups used, that we need to specify the
// volume to use for the WindowLevelTool for the fusion viewports
Expand Down
18 changes: 16 additions & 2 deletions packages/tools/src/tools/annotation/CircleROITool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,6 @@ class CircleROITool extends AnnotationTool {
return renderStatus;
}

const targetId = this.getTargetId(viewport);

const renderingEngine = viewport.getRenderingEngine();

const styleSpecifier: StyleSpecifier = {
Expand All @@ -625,6 +623,22 @@ class CircleROITool extends AnnotationTool {

styleSpecifier.annotationUID = annotationUID;

let targetId: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these in the this.getTargetId so that you don't need to repeat yourself, i think that was a parent method

const allTargetIds = Object.keys(data.cachedStats);
const preferredVolumeId = this.configuration.volumeId; // Configured preferred volumeId

if (preferredVolumeId) {
//Check if preferredVolumeId is directly a targetId
targetId = allTargetIds.find((targetIdToFind) =>
targetIdToFind.includes(preferredVolumeId)
);
}

// If preferred volumeId is not found, use default targetId
if (!targetId) {
targetId = this.getTargetId(viewport);
}

const { color, lineWidth, lineDash } = this.getAnnotationStyle({
annotation,
styleSpecifier,
Expand Down
18 changes: 16 additions & 2 deletions packages/tools/src/tools/annotation/EllipticalROITool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,6 @@ class EllipticalROITool extends AnnotationTool {
return renderStatus;
}

const targetId = this.getTargetId(viewport);

const renderingEngine = viewport.getRenderingEngine();

const styleSpecifier: StyleSpecifier = {
Expand All @@ -791,6 +789,22 @@ class EllipticalROITool extends AnnotationTool {

styleSpecifier.annotationUID = annotationUID;

let targetId: string;
const allTargetIds = Object.keys(data.cachedStats);
const preferredVolumeId = this.configuration.volumeId; // Configured preferred volumeId

if (preferredVolumeId) {
//Check if preferredVolumeId is directly a targetId
targetId = allTargetIds.find((targetIdToFind) =>
targetIdToFind.includes(preferredVolumeId)
);
}

// If preferred volumeId is not found, use default targetId
if (!targetId) {
targetId = this.getTargetId(viewport);
}

const { color, lineWidth, lineDash } = this.getAnnotationStyle({
annotation,
styleSpecifier,
Expand Down
17 changes: 16 additions & 1 deletion packages/tools/src/tools/annotation/PlanarFreehandROITool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,22 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
svgDrawingHelper
) => {
const { data } = <PlanarFreehandROIAnnotation>annotation;
const targetId = this.getTargetId(viewport);

let targetId: string;
const allTargetIds = Object.keys(data.cachedStats);
const preferredVolumeId = this.configuration.volumeId; // Configured preferred volumeId

if (preferredVolumeId) {
//Check if preferredVolumeId is directly a targetId
targetId = allTargetIds.find((targetIdToFind) =>
targetIdToFind.includes(preferredVolumeId)
);
}

// If preferred volumeId is not found, use default targetId
if (!targetId) {
targetId = this.getTargetId(viewport);
}

const styleSpecifier: AnnotationStyle.StyleSpecifier = {
toolGroupId: this.toolGroupId,
Expand Down
17 changes: 16 additions & 1 deletion packages/tools/src/tools/annotation/RectangleROITool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ class RectangleROITool extends AnnotationTool {
return renderStatus;
}

const targetId = this.getTargetId(viewport);
const renderingEngine = viewport.getRenderingEngine();

const styleSpecifier: StyleSpecifier = {
Expand All @@ -624,6 +623,22 @@ class RectangleROITool extends AnnotationTool {

styleSpecifier.annotationUID = annotationUID;

let targetId: string;
const allTargetIds = Object.keys(data.cachedStats);
const preferredVolumeId = this.configuration.volumeId; // Configured preferred volumeId

if (preferredVolumeId) {
//Check if preferredVolumeId is directly a targetId
targetId = allTargetIds.find((targetIdToFind) =>
targetIdToFind.includes(preferredVolumeId)
);
}

// If preferred volumeId is not found, use default targetId
if (!targetId) {
targetId = this.getTargetId(viewport);
}

const { color, lineWidth, lineDash } = this.getAnnotationStyle({
annotation,
styleSpecifier,
Expand Down
Loading