Skip to content

Commit

Permalink
fix(createImageRenderingActor): only clear color ranges if dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Mar 27, 2023
1 parent 0fdc16a commit a11ef22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/compare-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

const fixedImage = new URL(
// 'test-data/HeadMRVolume.nrrd',
// 'test-data/HeadMRVolumeLabels.nrrd',
'test-data/HeadMRVolumeLabels.nrrd',
// 'test-data/HeadMRVolumeLabelsSmaller.nrrd',
'test-data/HeadMRVolume2Components.nrrd',
// 'test-data/HeadMRVolume2Components.nrrd',
window.location.origin
)

Expand Down
6 changes: 4 additions & 2 deletions src/Rendering/Images/createImageRenderingActor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ const dirtyColorRanges = (c, { data: { name } }) => {

const cleanColorRanges = (c, { data: { name } }) => {
const actorContext = c.images.actorContext.get(name)
actorContext.colorRanges = new Map()
actorContext.dirtyColorRanges = false
if (actorContext.dirtyColorRanges) {
actorContext.colorRanges = new Map()
actorContext.dirtyColorRanges = false
}
}

const assignUpdateRenderedName = assign({
Expand Down
6 changes: 0 additions & 6 deletions src/Rendering/VTKJS/Images/applyRenderedImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@ function applyRenderedImage(context, { data: { name } }) {
context.images.colorTransferFunctions.get(component) ??
vtkColorTransferFunction.newInstance()

if (actorContext.colorRanges.has(component)) {
const range = actorContext.colorRanges.get(component)
colorTransferFunction.setMappingRange(range[0], range[1])
colorTransferFunction.updateRange()
}

context.images.colorTransferFunctions.set(component, colorTransferFunction)

if (!context.images.piecewiseFunctions.has(component)) {
Expand Down

0 comments on commit a11ef22

Please sign in to comment.