# Setting the volume property to be used when a volume is rendered automatically

**URL:** https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653
**Category:** Support
**Created:** [March 20, 2021, 4:20am UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653 "2021-03-20T04:20:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 20, 2021, 4:20am UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653/1 "2021-03-20T04:20:54Z")

</div>

When I drag and drop volume to the 3D render, it automatically renders with the volume property MR. I would like it to use one of my custom presets that are registered via the .slicerrc.py (as per this instructions [Volume rendering — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/modules/volumerendering.html#how-to-register-custom-volume-rendering-presets))

How can I set this up?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [March 20, 2021, 4:57am UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653/2 "2021-03-20T04:57:00Z")

</div>

Drag-and-drop to views are handled by the subject hierarchy owner plugin associated with the node.

One option is to create a custom subject hierarchy plugin that will recognize your special volume and “claim” it for itself by returning high confidence value for it in `canOwnSubjectHierarchyItem` method. Then implement in the plugin’s `showItemInView` any behavior that you need.

Another option is to override the [default low/medium/high-dynamic-range volume rendering presets](https://github.com/Slicer/Slicer/blob/431eba37b11025c6e2b43937dc0567714fbd018e/Modules/Loadable/VolumeRendering/Logic/vtkSlicerVolumeRenderingLogic.cxx#L1436-L1480) (US-Fetal/MR-Default/CT-Chest-Contrast-Enhanced) with your by removing these presets and registering your custom ones with the same names.

There could be many more ways of making this more configurable. Can you write a bit more about your use case?

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 20, 2021, 5:14am UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653/3 "2021-03-20T05:14:00Z")

</div>

I have about 60 mouse skulls that are scanned and reconstructed the same way. I designed a custom volume property that renders them nicely. I have bunch of LMs to review. I load each volume and the markups file and then I am trying to cut down the number of click I get from loading the volume to rendering it in 3D.

I registered mine as SM\_mouse, and is available as a preset now. But when I drag and drop my mouse volume into 3D viewer, it still renders with MR-Default, and I still have to choose my preset from the available preset. The goal is minimizing the interactions.

---

<div class="post-metadata">

### Author: ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)
#### Post date: [March 21, 2021, 5:27am UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653/4 "2021-03-21T05:27:49Z")

</div>

> [@lassoan](#):
>
> Another option is to override the [default low/medium/high-dynamic-range volume rendering presets](https://github.com/Slicer/Slicer/blob/431eba37b11025c6e2b43937dc0567714fbd018e/Modules/Loadable/VolumeRendering/Logic/vtkSlicerVolumeRenderingLogic.cxx#L1436-L1480) (US-Fetal/MR-Default/CT-Chest-Contrast-Enhanced) with your by removing these presets and registering your custom ones with the same names.

I ended up going with this route and it works quite well for my challenge.

However, this is slightly ‘hacky’ as in, if I distribute a presets.xml that contains various overwritten presets optimized for data that comes out of our scanner (so that my collaborators have the same settings), it is likely to confuse people (since I simply overwrote the MR-Default, and created a copy of it called MR-Default2 in case I do need it for MR datasets).

It would be great if the presets can be more easily added, and that defaults used for drag and dropping can be customizable…

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [March 25, 2021, 1:51pm UTC](https://discourse.slicer.org/t/setting-the-volume-property-to-be-used-when-a-volume-is-rendered-automatically/16653/5 "2021-03-25T13:51:38Z")

</div>

> [@muratmaga](#):
>
> It would be great if the presets can be more easily added

There is an issue for this already. If it gets enough [upvotes](https://discourse.slicer.org/t/about-the-feature-requests-category/30) then we’ll get to it:

> <https://github.com/Slicer/Slicer/issues/5505>
>
> \## Is your feature request related to a problem? Please describe.
> 
> I always st…art creating my volume rendering from scratch, however, that takes a long time and a lot of time and guessing 
> 
> \## Describe the solution you'd like
> 
> creat a simple " create a custom preset " in the volume rendering module

> [@muratmaga](#):
>
> defaults used for drag and dropping can be customizable

We could allow users to choose 3 custom default presets in the application settings. You can add a feature request in the issue tracker and see how much upvotes it gets.

In general, extensions should not modify user preferences (without explicitly getting approval from the user). So, probably the most appropriate level where an extension can inject its custom behavior into the application is to add a subject hierarchy plugin that recognizes certain volume types where the default VR preset is not optimal (e.g., I can imagine that you can create better preset for dry bone), claims those volumes (gives higher confidence value than all other plugins), and uses your custom volume rendering preset when display in 3D view is requested.

If the problem is that in general you don’t find the default VR presets optimal then we can change those presets or add new presets that will be used as default.
