# How to turn off interpolation for discrete label segmentation image?

**URL:** https://discourse.vtk.org/t/how-to-turn-off-interpolation-for-discrete-label-segmentation-image/10706
**Category:** Web
**Created:** [February 15, 2023, 11:12pm UTC](https://discourse.vtk.org/t/how-to-turn-off-interpolation-for-discrete-label-segmentation-image/10706 "2023-02-15T23:12:59Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![jilei-hao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jilei-hao/32/5581_2.png) [@jilei-hao](https://discourse.vtk.org/u/jilei-hao)
#### Post date: [February 16, 2023, 3:52pm UTC](https://discourse.vtk.org/t/how-to-turn-off-interpolation-for-discrete-label-segmentation-image/10706/3 "2023-02-16T15:52:07Z")

</div>

Thanks for the reply!

Just want to confirm that the Nearest Neighbor Interpolation is not taking average of the neighboring voxels, right? I’m asking because now I suspect the issue might be caused by the incorrect interpolation in the downsampling from the upstream data pipeline (not vtk-js related).

Here’s my lut configuration. The original segmentation should only have label 4. But now 1, 2, 3, are also showing up at the border.

![image](https://discourse.vtk.org/uploads/default/original/2X/7/7ac27c5757fa571292dc1b1ab63418ea1be64806.png)

```javascript
const seg_lut = vtkColorTransferFunction.newInstance();
seg_lut.setIndexedLookup(true);
seg_lut.setMappingRange(0, 4);
seg_lut.addRGBPoint(0, 0, 0, 0);
seg_lut.addRGBPoint(1, 1, 0, 0);
seg_lut.addRGBPoint(2, 0, 1, 0);
seg_lut.addRGBPoint(3, 0, 0, 1);
seg_lut.addRGBPoint(4, 1, 0.87, 0.74);

seg_actor.getProperty().setRGBTransferFunction(0, seg_lut);
seg_actor.getProperty().setColorLevel(2);
seg_actor.getProperty().setColorWindow(4);

const ofun = vtkPiecewiseFunction.newInstance();
ofun.addPoint(0, 0);
ofun.addPoint(1, 0.8);

seg_actor.getProperty().setScalarOpacity(ofun);
seg_actor.getProperty().setInterpolationTypeToNearest();

```

---

_[View the full topic](https://discourse.vtk.org/t/how-to-turn-off-interpolation-for-discrete-label-segmentation-image/10706)._
