# resliceMapper.setLookupTable is not a function

**URL:** https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003
**Category:** Web
**Created:** [March 7, 2022, 1:19pm UTC](https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003 "2022-03-07T13:19:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dexter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@dexter](https://discourse.vtk.org/u/dexter)
#### Post date: [March 7, 2022, 1:19pm UTC](https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003/1 "2022-03-07T13:19:07Z")

</div>

Hey, how to set the Lookup Table for a resliceActor (`vtkImageSlice`)?  
Because we can use `setLookupTable` method for a `vtkMapper` object but not for `vtkImageMapper`.  
I need to set the LookupTable to make the black zone in the resliceActor transparent, is there a way to achieve this?

Thank you

---

<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: [March 7, 2022, 2:48pm UTC](https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003/2 "2022-03-07T14:48:58Z")

</div>

You can use `imageSlice.getProperty().setPiecewiseFunction(pwf)` to translate voxel values into opacity levels. You can see an example here: [vtk.js](https://kitware.github.io/vtk-js/examples/ImageMapper.html)

---

<div class="post-metadata">

### Author: ![dexter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@dexter](https://discourse.vtk.org/u/dexter)
#### Post date: [March 7, 2022, 3:45pm UTC](https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003/3 "2022-03-07T15:45:03Z")

</div>

> [@Forrest](#):
>
> setPiecewiseFunction

Thank you for your answer, I did what you told me, it is working fine!

```auto
  const ofun = vtkPiecewiseFunction.newInstance();
  ofun.addPoint(0, 1);
  ofun.addPoint(150, 1);
  ofun.addPoint(180, 0);
  ofun.addPoint(255, 0);
  obj.resliceActor1.getProperty().setPiecewiseFunction(ofun)

```

---

<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: [March 7, 2022, 5:37pm UTC](https://discourse.vtk.org/t/reslicemapper-setlookuptable-is-not-a-function/8003/4 "2022-03-07T17:37:44Z")

</div>

**Edit update** : the email contents don’t match up with the actual post contents, so ignore this post. I’ll leave it for posterity, but it answers a question that is no longer being asked.

* * *

> What you’ve just defined is the following:
> 
> - voxels with values 0-150 have opacity 1
> - voxels with values 150-180 have linearly decreasing opacity from 1 to 0
> - voxels with values 80-255 have opacity 0
> 
> If you want black (typically taken to be value 0), to be transparent, then set it to opacity 0.
