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

This commit is contained in:
Celian-abd authored and GitHub committed 2024-01-08 12:28:22 -05:00
1 parent eb7c950d7e
commit e8858f3eb5
2 files changed
+8 -4

No files matched your search

@@ -340,7 +340,7 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
const properties = { ...presentations.lutPresentation?.properties }; const properties = { ...presentations.lutPresentation?.properties };
if (!presentations.lutPresentation?.properties) { if (!presentations.lutPresentation?.properties) {
const { voi, voiInverted } = displaySetOptions[0]; const { voi, voiInverted, colormap } = displaySetOptions[0];
if (voi && (voi.windowWidth || voi.windowCenter)) { if (voi && (voi.windowWidth || voi.windowCenter)) {
const { lower, upper } = csUtils.windowLevel.toLowHighRange( const { lower, upper } = csUtils.windowLevel.toLowHighRange(
voi.windowWidth, voi.windowWidth,
@@ -352,6 +352,10 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
if (voiInverted !== undefined) { if (voiInverted !== undefined) {
properties.invert = voiInverted; properties.invert = voiInverted;
} }
if (colormap !== undefined) {
properties.colormap = colormap;
}
} }
return viewport.setStack(imageIds, initialImageIndexToUse).then(() => { return viewport.setStack(imageIds, initialImageIndexToUse).then(() => {
@@ -736,8 +740,8 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
const { dimensions } = imageVolume; const { dimensions } = imageVolume;
const slabThickness = Math.sqrt( const slabThickness = Math.sqrt(
dimensions[0] * dimensions[0] + dimensions[0] * dimensions[0] +
dimensions[1] * dimensions[1] + dimensions[1] * dimensions[1] +
dimensions[2] * dimensions[2] dimensions[2] * dimensions[2]
); );
return slabThickness; return slabThickness;
@@ -71,7 +71,7 @@ export type DisplaySetOptions = {
voiInverted: boolean; voiInverted: boolean;
blendMode?: Enums.BlendModes; blendMode?: Enums.BlendModes;
slabThickness?: number; slabThickness?: number;
colormap?: string; colormap?: { name: string, opacity?: number };
displayPreset?: string; displayPreset?: string;
}; };