@cornerstonejs/adapters 1.61.7 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.es.js +52 -1
- package/dist/adapters.es.js.map +1 -1
- package/package.json +5 -5
package/dist/adapters.es.js
CHANGED
|
@@ -41368,7 +41368,7 @@ class BaseVolumeViewport extends Viewport$1 {
|
|
|
41368
41368
|
return;
|
|
41369
41369
|
}
|
|
41370
41370
|
const {
|
|
41371
|
-
colormap,
|
|
41371
|
+
colormap: latestColormap,
|
|
41372
41372
|
VOILUTFunction,
|
|
41373
41373
|
interpolationType,
|
|
41374
41374
|
invert,
|
|
@@ -41393,6 +41393,13 @@ class BaseVolumeViewport extends Viewport$1 {
|
|
|
41393
41393
|
};
|
|
41394
41394
|
}).filter(Boolean);
|
|
41395
41395
|
const voiRange = voiRanges.length ? voiRanges[0].voiRange : null;
|
|
41396
|
+
const volumeColormap = this.getColormap(applicableVolumeActorInfo);
|
|
41397
|
+
let colormap;
|
|
41398
|
+
if (volumeId && volumeColormap) {
|
|
41399
|
+
colormap = volumeColormap;
|
|
41400
|
+
} else {
|
|
41401
|
+
colormap = latestColormap;
|
|
41402
|
+
}
|
|
41396
41403
|
return {
|
|
41397
41404
|
colormap: colormap,
|
|
41398
41405
|
voiRange: voiRange,
|
|
@@ -41403,6 +41410,50 @@ class BaseVolumeViewport extends Viewport$1 {
|
|
|
41403
41410
|
rotation: rotation
|
|
41404
41411
|
};
|
|
41405
41412
|
};
|
|
41413
|
+
this.getColormap = applicableVolumeActorInfo => {
|
|
41414
|
+
const {
|
|
41415
|
+
volumeActor
|
|
41416
|
+
} = applicableVolumeActorInfo;
|
|
41417
|
+
const cfun = volumeActor.getProperty().getRGBTransferFunction(0);
|
|
41418
|
+
const {
|
|
41419
|
+
nodes
|
|
41420
|
+
} = cfun.getState();
|
|
41421
|
+
const RGBPoints = nodes.reduce((acc, node) => {
|
|
41422
|
+
acc.push(node.x, node.r, node.g, node.b);
|
|
41423
|
+
return acc;
|
|
41424
|
+
}, []);
|
|
41425
|
+
const colormaps = vtkColorMaps.rgbPresetNames.map(presetName => vtkColorMaps.getPresetByName(presetName));
|
|
41426
|
+
const matchedColormap = colormaps.find(colormap => {
|
|
41427
|
+
const {
|
|
41428
|
+
RGBPoints: presetRGBPoints
|
|
41429
|
+
} = colormap;
|
|
41430
|
+
if (presetRGBPoints.length !== RGBPoints.length) {
|
|
41431
|
+
return false;
|
|
41432
|
+
}
|
|
41433
|
+
for (let i = 0; i < presetRGBPoints.length; i += 4) {
|
|
41434
|
+
if (!isEqual$2(presetRGBPoints.slice(i + 1, i + 4), RGBPoints.slice(i + 1, i + 4))) {
|
|
41435
|
+
return false;
|
|
41436
|
+
}
|
|
41437
|
+
}
|
|
41438
|
+
return true;
|
|
41439
|
+
});
|
|
41440
|
+
if (!matchedColormap) {
|
|
41441
|
+
return null;
|
|
41442
|
+
}
|
|
41443
|
+
const opacityPoints = volumeActor.getProperty().getScalarOpacity(0).getDataPointer();
|
|
41444
|
+
const opacity = [];
|
|
41445
|
+
for (let i = 0; i < opacityPoints.length; i += 2) {
|
|
41446
|
+
opacity.push({
|
|
41447
|
+
value: opacityPoints[i],
|
|
41448
|
+
opacity: opacityPoints[i + 1]
|
|
41449
|
+
});
|
|
41450
|
+
}
|
|
41451
|
+
const colormap = {
|
|
41452
|
+
name: matchedColormap.Name,
|
|
41453
|
+
opacity: opacity
|
|
41454
|
+
};
|
|
41455
|
+
return colormap;
|
|
41456
|
+
};
|
|
41406
41457
|
this.getRotation = () => {
|
|
41407
41458
|
const {
|
|
41408
41459
|
viewUp: currentViewUp,
|