Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(voi): linear transfer function for volume viewport #444

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Changes from all 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
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