Skip to content

Commit

Permalink
fix: get correct imageData with targetId in BaseTool (#294)
Browse files Browse the repository at this point in the history
* limit disabled element not need to render

* Update BaseTool.ts

fix: get correct viewport when there are multiple viewport with same stack data

Co-authored-by: chendingmiao <[email protected]>
  • Loading branch information
DMIAOCHEN and chendingmiao authored Dec 1, 2022
1 parent 70e4ffa commit 6e8e51b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/tools/src/tools/base/BaseTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ abstract class BaseTool implements IBaseTool {
if (targetId.startsWith('imageId:')) {
const imageId = targetId.split('imageId:')[1];
const imageURI = utilities.imageIdToURI(imageId);
const viewports = utilities.getViewportsWithImageURI(
let viewports = utilities.getViewportsWithImageURI(
imageURI,
renderingEngine.id
);
Expand All @@ -153,6 +153,14 @@ abstract class BaseTool implements IBaseTool {
return;
}

viewports = viewports.filter((viewport) => {
return viewport.getCurrentImageId() === imageId;
});

if (!viewports || !viewports.length) {
return;
}

return viewports[0].getImageData();
} else if (targetId.startsWith('volumeId:')) {
const volumeId = targetId.split('volumeId:')[1];
Expand Down

0 comments on commit 6e8e51b

Please sign in to comment.