Skip to content

Commit

Permalink
fix(voi): linear transfer function for volume viewport(#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
lscoder authored Feb 22, 2023
1 parent 0b83c50 commit dcec5eb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/core/src/RenderingEngine/BaseVolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
let volumeActor;

if (volumeId) {
const actorEntry = actorEntries.find((entry: ActorEntry) => {
return entry.uid === volumeId;
});

volumeActor = actorEntry?.actor as vtkVolume;
volumeActor = this.getActor(volumeId)?.actor as vtkVolume;
}

// // set it for the first volume (if there are more than one - fusion)
Expand All @@ -241,8 +237,18 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
const cfun = createSigmoidRGBTransferFunction(voiRangeToUse);
volumeActor.getProperty().setRGBTransferFunction(0, cfun);
} else {
const cfun = createLinearRGBTransferFunction(voiRangeToUse);
volumeActor.getProperty().setRGBTransferFunction(0, cfun);
// TODO: refactor and make it work for PET series (inverted/colormap)
// const cfun = createLinearRGBTransferFunction(voiRangeToUse);
// volumeActor.getProperty().setRGBTransferFunction(0, cfun);

// Moving from LINEAR to SIGMOID and back to LINEAR will not
// work until we implement it in a different way because the
// LINEAR transfer function is not recreated.
const { lower, upper } = voiRangeToUse;
volumeActor
.getProperty()
.getRGBTransferFunction(0)
.setRange(lower, upper);
}

if (!suppressEvents) {
Expand Down

0 comments on commit dcec5eb

Please sign in to comment.