Synchronizing segmentations across viewports

Synchronizing segmentations across viewports

In my extension, I am creating a segmentation with

loadSegmentationsForViewport

and then modifying it with

const volumeObject = segmentationService.getLabelmapVolume('1');
const { voxelManager } = volumeObject;
voxelManager?.setCompleteScalarDataArray(myData);

similar to what the MONAILabel extension is doing. I have noticed the following:

  • when I am in MPR view when I call loadSegmentationsForViewport, it will only display the segmentation in the current viewport.
  • when I am in single viewport mode, call loadSegmentationsForViewport, switch to MPR, and then edit the volumeObject it will show the seg in all viewports.

How can I make sure to always synchronize the segmentation across viewports ?

There is a property on hanging protocol called HYDRATE_SEG_SYNC_GROUP see if that helps

extensions/cornerstone/src/hps/mpr.ts