fix: colormap for stack viewports via HangingProtocol (#3866)

This commit is contained in:
Celian-abd 2024-01-08 18:28:22 +01:00 committed by GitHub
parent eb7c950d7e
commit e8858f3eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -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,
@ -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(() => {
@ -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;

View File

@ -71,7 +71,7 @@ export type DisplaySetOptions = {
voiInverted: boolean;
blendMode?: Enums.BlendModes;
slabThickness?: number;
colormap?: string;
colormap?: { name: string, opacity?: number };
displayPreset?: string;
};