Hello, I’m encountering a problem I don’t know how to solve.
I’m creating multiple segmentations of viewport type ortographic, where the user can draw on them, and each segmentation is independent from others.
The problem is the high memory usage, where my computer with 32GB of ram can run without problems, but one computer with 16GB can only add 2 segments before it crashes.
addButtonToToolbar({
title: 'Create New Segmentation',
onClick: async () => {
segmentosCreados = segmentosCreados + 1;
let newSegmentationId = 'SID'+ segmentosCreados;
segmentationIds.push(newSegmentationId);
console.log(segmentationIds);
await volumeLoader.createAndCacheDerivedVolume(volumeId, {
volumeId: newSegmentationId,
targetBuffer: {
type: 'Uint8Array',
},
});
console.log(volumeLoader);
const currentImageId = viewport.getCurrentImageId();
segmentation.addSegmentations([
{
segmentationId: newSegmentationId,
representation: {
type: csToolsEnums.SegmentationRepresentations.Labelmap,
data: {
volumeId: newSegmentationId,
imageIdReferenceMap: new Map([[currentImageId, segmentationIds[segmentosCreados]]]),
},
},
},
]);
// Add the segmentation representation to the toolgroup
let [uid] = await segmentation.addSegmentationRepresentations(
toolGroupId,
[
{
segmentationId: newSegmentationId,
type: csToolsEnums.SegmentationRepresentations.Labelmap,
},
]
);
//ACTIVAR EL NUEVO SEGMENTO
segmentationRepresentationUIDs.push(uid);
segmentation.activeSegmentation.setActiveSegmentationRepresentation(
toolGroupId,
uid
);
let color = selectSegmentColor(newSegmentationId);
segmentation.segmentIndex.setActiveSegmentIndex(
newSegmentationId.toString(),
Number(color)
);
////////////////////////////////////////////////
// update the dropdown
updateSegmentationDropdownOptions(segmentationIds, newSegmentationId);
},
});
Could, you please tell me how to reduce the memory usage of the function createAndCacheDerivedVolume?
I test it if I don’t draw anything I can create multiple segments, so I guess when the user draws something then it stores all in cache.