Skip to content

Commit

Permalink
fix(createlayerinterface): overwrite layer entry when label image is …
Browse files Browse the repository at this point in the history
…reset

When a label image was set the old label image was replaced but a new layer entry was still being
created. This implied all label images were available but that is not the case. If the label image
is changed the label image layer is simply updated now.
  • Loading branch information
bnmajor committed May 29, 2023
1 parent 69ef702 commit d7b7e10
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/createViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,16 @@ const createViewer = async (

const imageName =
layerImageName ?? context.images.selectedName ?? multiscaleLabelImage.name
service.send({
type: 'ADD_LABEL_IMAGE',
data: { imageName, labelImage: multiscaleLabelImage },
})
const actorContext = context.images.actorContext.get(imageName)
if (actorContext?.labelImageName === multiscaleLabelImage.name) {
actorContext.labelImage = multiscaleLabelImage
service.send({ type: 'LABEL_IMAGE_ASSIGNED', data: imageName })
} else {
service.send({
type: 'ADD_LABEL_IMAGE',
data: { imageName, labelImage: multiscaleLabelImage },
})
}
publicAPI.setImageInterpolationEnabled(false, imageName)
})

Expand Down

0 comments on commit d7b7e10

Please sign in to comment.