# Apply presets to certain tissue segment of a volume rendering

**URL:** https://discourse.slicer.org/t/apply-presets-to-certain-tissue-segment-of-a-volume-rendering/45067
**Category:** Support
**Created:** [November 13, 2025, 3:40pm UTC](https://discourse.slicer.org/t/apply-presets-to-certain-tissue-segment-of-a-volume-rendering/45067 "2025-11-13T15:40:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sogo](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sogo](https://discourse.slicer.org/u/sogo)
#### Post date: [November 13, 2025, 3:40pm UTC](https://discourse.slicer.org/t/apply-presets-to-certain-tissue-segment-of-a-volume-rendering/45067/1 "2025-11-13T15:40:21Z")

</div>

Hi, I am working on writing a visualization function that applies a different color to a 3D rendering of a volume to only an area masked with tissue segment.

I am using split volume function to split segments into scalar volume nodes. The idea I am using so far is to use one of the split volume, apply a different preset to that split volume and use the color and component from split volume to set color on original volume scan. In example of screenshot below, I have the original volume and bone tissue split volume from the original scan with a different preset and I want to apply this preset to only bone covered areas of original volume.

Below is the code I have written so far and it is crashing as it calls the “setColor” to set different color transfer function to bone segment of original volume components. I wanted to ask if this is right way to do it or if there is any other efficient method to do something like this.

```auto
// -----------------------------------------------------------------------------------
void qSegmenterAppModuleWidget::testFunction() {
    Q_D(qTestApp);

    //volume nodes
    vtkMRMLScalarVolumeNode* vnodeOriginal = vtkMRMLScalarVolumeNode::SafeDownCast(qSlicerApplication::application()->mrmlScene()->GetNodeByID("vtkMRMLScalarVolumeNode1"));
    vtkMRMLScalarVolumeNode* vnodeSplit = vtkMRMLScalarVolumeNode::SafeDownCast(qSlicerApplication::application()->mrmlScene()->GetNodeByID("vtkMRMLScalarVolumeNode2"));

    vtkSlicerVolumeRenderingLogic* rlo = vtkSlicerVolumeRenderingLogic::SafeDownCast(qSlicerApplication::application()->moduleLogic("VolumeRendering"));
    
    //volume rendering display nodes
    vtkMRMLVolumeRenderingDisplayNode* displayNode3DSplit = rlo->GetFirstVolumeRenderingDisplayNode(vnodeSplit);
    vtkMRMLVolumeRenderingDisplayNode* displayNode3DOriginal = rlo->GetFirstVolumeRenderingDisplayNode(vnodeOriginal);

    //volume property nodes
    vtkMRMLVolumePropertyNode* volPropertyNodeSplit = displayNode3DSplit->GetVolumePropertyNode();
    vtkMRMLVolumePropertyNode* volPropertyNodeOriginal = displayNode3DOriginal->GetVolumePropertyNode();

    vtkDataArray* volArraySplit = vnodeSplit->GetImageData()->GetPointData()->GetScalars();

    for (int i = 0; i < volArraySplit->GetNumberOfTuples(); i++)
    {
        if (volArraySplit->GetComponent(i, 0) > 0)
        {
            vtkColorTransferFunction* function = volPropertyNodeSplit->GetColor(volArraySplit->GetComponent(i, 0));
            volPropertyNodeOriginal->SetColor(function, i);
        }
    }
}

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/4/4481e9cee1fc2a8ff8cb601074c922772d98a650.jpeg)

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [November 13, 2025, 4:01pm UTC](https://discourse.slicer.org/t/apply-presets-to-certain-tissue-segment-of-a-volume-rendering/45067/2 "2025-11-13T16:01:49Z")

</div>

You can have a look at the ColorizeVolume module in the Sandbox extension. You can completely control the volume rendering using segments.

> [@New Colorize Volume module](https://discourse.slicer.org/t/new-colorize-volume-module/32254):
>
> Just added to 3D Slicer 5.5 is the new Colorize Volume module! I tried it on a fully segmented rattlesnake skull with really nice results comparable to the expensive proprietary software VGStudio Max. I played around with the Volume Rendering settings, as well as Lights module (from the SandBox extension), and cropping to an ROI in the Volume Rendering module to bisect and view the inside of the skull. I am still exploring the various functions of this module but I am excited to see what else I …

---

<div class="post-metadata">

### Author: ![sogo](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sogo](https://discourse.slicer.org/u/sogo)
#### Post date: [November 13, 2025, 5:01pm UTC](https://discourse.slicer.org/t/apply-presets-to-certain-tissue-segment-of-a-volume-rendering/45067/3 "2025-11-13T17:01:40Z")

</div>

Thank you @pieper for the quick response, I will take a look at Colorize Volume module.
