Error occurs when using vtkImageResliceMapper

Dear VTK team

here is my code:

const slicePlane = vtkPlane.newInstance();
slicePlane.setNormal([1, 0, 0]);
slicePlane.setOrigin([-177, -172, -22]);
const imageResliceMapper = vtkImageResliceMapper.newInstance();
const actor = vtkImageSlice.newInstance();

but the actor need a mapper type of vtkImageMapper,the error occurs at the last line:

Argument of type ‘vtkImageResliceMapper’ is not assignable to parameter of type ‘vtkImageMapper’.
Type ‘vtkImageResliceMapper’ is missing the following properties from type ‘vtkImageMapper’: getSliceAtPosition, getClosestIJKAxis, getBoundsForSlice, getRenderToRectangle, and 15 more.ts(2345)

I followed the api and the example,and the example works: vtk.js.

Could you please answer why is so?
Thank you so much for the help.

Best regards

Thanks for reporting the issue. It looks like we need to update vtkImageReslice and vtkImageResliceMapper ts definitions for typescript related errors. I will log this as an issue on GitHub. Hopefully, we can get this fixed soon.

Got it
Thanks for reply

Is there any other way to achieve the same function



Is there any other way to achieve the same function


Sorry for the delay and thanks for waiting patiently. I have posted a pull-request to address this issue:
Fix vtkImageSlice typescript definitions by jadh4v · Pull Request #2896 · Kitware/vtk-js (

This should get merged and released quickly once accepted.


there is another problem, can you give me more help?

  1. I download the source from github and test the ImageResliceMapper by:
    npm run example – ImageResliceMapper
    it works

  2. I tried the [Script usage] by:
    script type=“text/javascript” src=“”></script
    it works

  3. I import the module by:
    npm install @kitware/vtk.js
    the ImageSliceMapper dosenot work

Best regards

I have install the latest version at 28.8.2