# Need help with volume rendering Preset

**URL:** https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587
**Category:** Web
**Created:** [May 25, 2022, 8:35am UTC](https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587 "2022-05-25T08:35:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gzt036](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gzt036/32/5960_2.png) [@gzt036](https://discourse.vtk.org/u/gzt036)
#### Post date: [May 25, 2022, 8:35am UTC](https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587/1 "2022-05-25T08:35:06Z")

</div>

In presets.js it has a collection of parameters to be used to create a 3D actor by calling  
applyPreset(actor, preset);

My question is how to adjust these parameters to make a proper 3D volume rendering. For example, the CT-Bone preset below will pick up Bone pixels and show it in red-orange color and in semi transparent way. I would like to be able to disable the transparency and show it in a more nature color (e.g,. yellow or gray). How should I change the preset?  
{  
name: ‘CT-Bone’,  
gradientOpacity: ‘4 0 1 255 1’,  
specularPower: ‘10’,  
scalarOpacity: ‘8 -3024 0 -16.4458 0 641.385 0.715686 3071 0.705882’,  
id: ‘vtkMRMLVolumePropertyNode3’,  
specular: ‘0.2’,  
shade: ‘1’,  
ambient: ‘0.1’,  
colorTransfer:  
‘16 -3024 0 0 0 -16.4458 0.729412 0.254902 0.301961 641.385 0.905882 0.815686 0.552941 3071 1 1 1’,  
selectable: ‘true’,  
diffuse: ‘0.9’,  
interpolation: ‘1’,  
effectiveRange: ‘-16.4458 641.385’,  
}

Is there any place explain these parameters and how it should be defined? Please help, Thanks!

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [May 26, 2022, 8:25pm UTC](https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587/2 "2022-05-26T20:25:30Z")

</div>

You can change the scalarOpacity to adjust your transparency. It’s in the format `K v1 op1 ... vN opN`, where `K` is equal to `2*N`, and `v_i` is the voxel value that gets mapped to opacity value `op_i`.

The colorTransfer is similar, except each voxel value maps to a 3-tuple of rgb.

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [May 26, 2022, 11:45pm UTC](https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587/3 "2022-05-26T23:45:03Z")

</div>

I recommend you try Slicer’s module VolumeRendering so you can edit your opacity or color transfer functions with live feedback. There are also preset examples available.

Slicer uses vtk internally and it has a python interactor for you to test scripts (ie. changing those transfer functions through code)

---

<div class="post-metadata">

### Author: ![gzt036](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gzt036/32/5960_2.png) [@gzt036](https://discourse.vtk.org/u/gzt036)
#### Post date: [May 27, 2022, 6:48pm UTC](https://discourse.vtk.org/t/need-help-with-volume-rendering-preset/8587/4 "2022-05-27T18:48:40Z")

</div>

Got it, the 3D rendering looks good now. Thanks.
