Skip to content

Commit

Permalink
fix: colormap for stack viewports via HangingProtocol (#3866)
Browse files Browse the repository at this point in the history
  • Loading branch information
Celian-abd authored Jan 8, 2024
1 parent eb7c950 commit e8858f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi

const properties = { ...presentations.lutPresentation?.properties };
if (!presentations.lutPresentation?.properties) {
const { voi, voiInverted } = displaySetOptions[0];
const { voi, voiInverted, colormap } = displaySetOptions[0];
if (voi && (voi.windowWidth || voi.windowCenter)) {
const { lower, upper } = csUtils.windowLevel.toLowHighRange(
voi.windowWidth,
Expand All @@ -352,6 +352,10 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
if (voiInverted !== undefined) {
properties.invert = voiInverted;
}

if (colormap !== undefined) {
properties.colormap = colormap;
}
}

return viewport.setStack(imageIds, initialImageIndexToUse).then(() => {
Expand Down Expand Up @@ -736,8 +740,8 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
const { dimensions } = imageVolume;
const slabThickness = Math.sqrt(
dimensions[0] * dimensions[0] +
dimensions[1] * dimensions[1] +
dimensions[2] * dimensions[2]
dimensions[1] * dimensions[1] +
dimensions[2] * dimensions[2]
);

return slabThickness;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export type DisplaySetOptions = {
voiInverted: boolean;
blendMode?: Enums.BlendModes;
slabThickness?: number;
colormap?: string;
colormap?: { name: string, opacity?: number };
displayPreset?: string;
};

Expand Down

0 comments on commit e8858f3

Please sign in to comment.