Hello everyone, i am using cornerstonejs to experiment Stack and Volume loading in a simple viewport with local file () and not with a enhanced DICOM server.
For the StackViewport , it’s working , just loading the file and creating imageIds
using
...
const imageId =
cornerstoneDICOMImageLoader.wadouri.fileManager.add(file);
...
await prefetchMetadataInformation(imageIds);
const stack = convertMultiframeImageIds(imageIds);
viewport
.setStack(stack)
viewport.render()
But for Volume rendering it’s not working
here is my loadVolume function code :
const loadVolume = async (imageIds: any) => {
try {
const volume = await volumeLoader.createAndCacheVolume(
activeViewportId,
{
imageIds
}
);
console.log("volume", volume);
const re = getRenderingEngine(activeRenderingEngineId);
const viewport = re?.getViewport(activeViewportId) as VolumeViewport;
if (!viewport) return;
// Set the volume to load
volume.load();
const windowWidth = 400;
const windowCenter = 40;
const lower = windowCenter - windowWidth / 2.0;
const upper = windowCenter + windowWidth / 2.0;
// Set the volume on the viewport and it's default properties
viewport
.setVolumes([
{
volumeId: activeViewportId,
callback: ({ volumeActor }) => {
volumeActor
.getProperty()
.getRGBTransferFunction(0)
.setMappingRange(lower, upper);
}
}
])
.then(() => {
viewport.setProperties({
voiRange: { lower: -160, upper: 240 },
VOILUTFunction: VOILUTFunctionType.LINEAR,
colormap: { name: "Grayscale" },
slabThickness: 0.1
});
});
// Render the image
viewport.render();
} catch (error) {
console.error("error occured while loading the volume", error)
}
};
Any idea why ?