Color display error on 3D Volume

Hello everyone

I’m developing an application based on Trame-Slicer, specifically a 3D ROI Cropping feature. Trame-Slicer already supports displaying the ROI box, but when I enable it, my 3D block displays incorrect colors. I’m not sure why; it might be due to a mistake or something missing in my setup code. Please give me your opinion.
Here is my setup code:
```

def cropVolume(self) -> None:
        if not self.volume_node:
            logging.warning("[Volume] No volume node found for cropping")
            return

        # 1. Get Display node
        display_node = self.slicer_app.volume_rendering.get_vr_display_node(self.volume_node)
        if not display_node:
            logging.warning("[Volume] No VR display node found")
            return

        # 2. Get ROI node and toggle logic
        is_enabled = not display_node.GetCroppingEnabled()
        roi_node = self.slicer_app.volume_rendering.get_cropping_roi_node(self.volume_node)

        self.slicer_app.volume_rendering.set_cropping_enabled(
            self.volume_node, 
            roi_node, 
            is_enabled
        )

        self.slicer_app.volume_rendering.set_cropping_roi_node_visibile(self.volume_node, is_enabled)

        # 3. Update
        self.view3D.render()
        if self.controller:
            self.controller.volume_update()


The corrupted colors are a transfer function reset issue. When cropping is toggled, Trame-Slicer internally touches the display node and wipes your color/opacity mapping.

Quick thing to check first: are you saving the VolumePropertyNode before calling set_cropping_enabled? If not, that is almost certainly your problem. The fix involves reapplying it after the toggle fires.

The full solution also depends on your Trame-Slicer version and how your volume rendering pipeline is initialized, because there are a couple of different ways this can break depending on the setup.
Rather than write a wall of code here that may or may not match your setup, feel free to DM me. I can take a quick look at your full pipeline and point you to the exact fix. Should not take long.