# How to assign default color table to a node

**URL:** <https://discourse.slicer.org/t/how-to-assign-default-color-table-to-a-node/7936>\
**Category:** Support\
**Tags:** color\
**Created:** [August 8, 2019, 9:48am UTC](https://discourse.slicer.org/t/how-to-assign-default-color-table-to-a-node/7936 "2019-08-08T09:48:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [August 8, 2019, 9:48am UTC](https://discourse.slicer.org/t/how-to-assign-default-color-table-to-a-node/7936/1 "2019-08-08T09:48:22Z")

</div>

I wonder if this is too trivial for appearing here but I struggle for weeks before realizing that you can easily assign a color table to a node in python

```python
# First access the color table by name, the name is the one that appears in the combobox
PETnodeColor = slicer.util.getFirstNodeByName('PET-Heat')
# Now you get your node display, the node is any vtkMRMLScalarVolumeNode that you have already loaded
displaynode = node.GetScalarVolumeDisplayNode()
# Finally the assignment
displaynode.SetAndObserveColorNodeID(PETnodeColor.GetID())

```

This does not even appear in the documentation nor the wiki and is really hard to find

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [August 8, 2019, 12:38pm UTC](https://discourse.slicer.org/t/how-to-assign-default-color-table-to-a-node/7936/2 "2019-08-08T12:38:27Z")

</div>

There was an example for setting colormap of a volume in the Slicer script repository. This page has a lot of examples for python scripting.

It was in an example titled “Change window/level (brightness/contrast) or colormap of a volume”.  
[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Change\_window.2Flevel\_.28brightness.2Fcontrast.29\_or\_colormap\_of\_a\_volume](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Change_window.2Flevel_.28brightness.2Fcontrast.29_or_colormap_of_a_volume)
