Skip to content

Commit 7a19880

Browse files
committed
feat(ColorMaps): support setting aboveRangeColor and belowRangeColor in presets
1 parent 27ebab5 commit 7a19880

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@
534534
"Name" : "Grayscale-DICOM-sigmoid",
535535
"Notes": "This is a 16 point sample of a sigmoid grayscale colormap described in the DICOM standard. See equation C.11-1 in section C.11.2",
536536
"NanColor" : [ 1, 0, 0 ],
537+
"BelowRangeColor" : [ 0, 0, 0 ],
538+
"AboveRangeColor" : [ 1, 1, 1 ],
537539
"RGBPoints" : [
538540
-1,
539541
0.01798620996209156,

Sources/Rendering/Core/ColorTransferFunction/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,21 @@ function vtkColorTransferFunction(publicAPI, model) {
12601260
}
12611261
isModified = isModified || oldNanColor !== JSON.stringify(model.nanColor);
12621262

1263+
if (colorMap.BelowRangeColor) {
1264+
if (colorMap.BelowRangeColor.length == 3) {
1265+
publicAPI.setBelowRangeColor([...colorMap.BelowRangeColor, 1]);
1266+
} else {
1267+
publicAPI.setBelowRangeColor(colorMap.BelowRangeColor);
1268+
}
1269+
}
1270+
if (colorMap.AboveRangeColor) {
1271+
if (colorMap.AboveRangeColor.length == 3) {
1272+
publicAPI.setAboveRangeColor([...colorMap.AboveRangeColor, 1]);
1273+
} else {
1274+
publicAPI.setAboveRangeColor(colorMap.AboveRangeColor);
1275+
}
1276+
}
1277+
12631278
const oldNodes = isModified || JSON.stringify(model.nodes);
12641279
if (colorMap.RGBPoints) {
12651280
const size = colorMap.RGBPoints.length;

0 commit comments

Comments
 (0)