# Color Transfer Function with indexed colors for vtkImageSlice vtk.js

**URL:** https://discourse.vtk.org/t/color-transfer-function-with-indexed-colors-for-vtkimageslice-vtk-js/12054
**Category:** vtk.js
**Tags:** vtkjs
**Created:** [July 28, 2023, 4:20pm UTC](https://discourse.vtk.org/t/color-transfer-function-with-indexed-colors-for-vtkimageslice-vtk-js/12054 "2023-07-28T16:20:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Andrzej\_Marciniak](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andrzej_marciniak/32/259_2.png) [@Andrzej\_Marciniak](https://discourse.vtk.org/u/Andrzej_Marciniak)
#### Post date: [July 28, 2023, 4:20pm UTC](https://discourse.vtk.org/t/color-transfer-function-with-indexed-colors-for-vtkimageslice-vtk-js/12054/1 "2023-07-28T16:20:15Z")

</div>

I need to display the segmentation of MRI volume with use of Freesurfer LUT color table.  
In my case, only selected regions are represented with different label values (integers) - the data array contains unevenly distributed uint16 values in range [2, 2035],  
eg. [2,4,5,6,7,8,9,10,12,…, 1024,1025, 2034,2035].  
In total this is 114 labels with assigned colors.

I created RGBPoint for each label value and associated color according to Freesurfer LUT.

vtkColorTransferFunction.addRGBPoint(value, r, g, b);

Then I applied vtkColorTransferFunction to vtkImageSlice actor and the result was bad.  
It seems like almost every second color is shifted.  
I tried to set parameters as mappingRange, indexedLookup, annotations but it did not help at all.

Is there a way that I could create (and apply to ImageSlice) Lookup table with indexed colors to labels?  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4e2983c86c44fa321877c8d89028bae22fd3a0b2.jpeg)
