# What is the function to extract colormap from volume data?

**URL:** https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721
**Category:** Support
**Created:** [September 9, 2019, 2:02am UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721 "2019-09-09T02:02:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rjsgml5698](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@rjsgml5698](https://discourse.vtk.org/u/rjsgml5698)
#### Post date: [September 9, 2019, 2:02am UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/1 "2019-09-09T02:02:18Z")

</div>

Hello. I have two questions.

language : python

1. Does SetExtractionModeToLargestRegion () not apply to imagedata? only polydata?
2. What is the function to extract colormap from volume data?

Thank you

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [September 9, 2019, 3:05am UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/2 "2019-09-09T03:05:50Z")

</div>

> [@rjsgml5698](#):
>
> Does SetExtractionModeToLargestRegion () not apply to imagedata? only polydata?

Which filter are you using?

> [@rjsgml5698](#):
>
> What is the function to extract colormap from volume data?

Colormap is not “volume data” and not stored in “volume data”. Color map is stored in a [vtkScalarsToColors](https://vtk.org/doc/nightly/html/classvtkScalarsToColors.html)-derived class.

---

<div class="post-metadata">

### Author: ![rjsgml5698](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@rjsgml5698](https://discourse.vtk.org/u/rjsgml5698)
#### Post date: [September 9, 2019, 4:36am UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/4 "2019-09-09T04:36:05Z")

</div>

Thank you for answer.

I converted png to vti (vtkimagedata).

And I want to share png’s colormap with vti (vtkimagedata). This is because I want to see the color of png in vti. Is there a simple example for this? Or is there a conceptual way?

Please understand my lack of English.

Thanks.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [September 9, 2019, 4:53pm UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/5 "2019-09-09T16:53:51Z")

</div>

Just letting the mapper know to don’t interpret the values as scalars. That way the raw value will be used as is without applying a LookupTable to convert a number into a color since you already have the color encoded.

> <https://github.com/Kitware/VTK/blob/master/Rendering/Core/vtkMapper.h#L146-L166>

---

<div class="post-metadata">

### Author: ![rjsgml5698](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@rjsgml5698](https://discourse.vtk.org/u/rjsgml5698)
#### Post date: [September 10, 2019, 5:32am UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/6 "2019-09-10T05:32:10Z")

</div>

> [@Sebastien\_Jourdain](#):
>
> vtkMapper.h

Is there a way for vtkVolumeMapper not to interpret values ​​as scalars?  
There seems to be no ColorMode.

Thank you for always.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [September 10, 2019, 2:29pm UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/7 "2019-09-10T14:29:32Z")

</div>

> [@rjsgml5698](#):
>
> Is there a way for vtkVolumeMapper not to interpret values ​​as scalars?

This may help: [VTK: vtkVolumeProperty Class Reference](https://vtk.org/doc/nightly/html/classvtkVolumeProperty.html#a2534a6dc500be42c9a842d405c4ee0bb)

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 10, 2019, 10:30pm UTC](https://discourse.vtk.org/t/what-is-the-function-to-extract-colormap-from-volume-data/1721/8 "2019-09-10T22:30:05Z")

</div>

> [@rjsgml5698](#):
>
> - oes SetExtractionModeToLargestRegion () not apply to imagedata? only polydata?

Use [vtkImageConnectivityFilter](https://vtk.org/doc/nightly/html/classvtkImageConnectivityFilter.html) or [vtkImageThresholdConnectivity](https://vtk.org/doc/nightly/html/classvtkImageThresholdConnectivity.html).
