I am trying to create a slider that rotates a 3D Volumes using the vtk.js api
I have already implemented sliders to move the object along the x,y,z axes, which looks like this:
changePosition({ activeLayer, value, coord }) {
const currentPosition = api.volumes[activeLayer].getPosition()
switch (coord) {
case coord = 'X':
api.volumes[layer].setPosition(
value,
currentPosition[1],
currentPosition[2])
break;
case coord = 'Y':
api.volumes[layer].setPosition(
currentPosition[0],
value,
currentPosition[2])
break;
case coord = 'Z':
api.volumes[layer].setPosition(
currentPosition[0],
currentPosition[1],
value)
break;
default:
break;
}
const renderWindow = api.genericRenderWindow.getRenderWindow();
renderWindow.render()
},
VTK.js also offers another 2 methods similar to getPosition and setPosition called getOrientation and setOrientation
So one would assume this would work:
changeOrientation({ activeLayer, value, coord }) {
const currentOrientation = api.volumes[activeLayer].getOrientation()
switch (coord) {
case coord = 'X':
api.volumes[layer].setOrientation(
value,
currentOrientation[1],
currentOrientation[2])
break;
case coord = 'Y':
api.volumes[layer].setOrientation(
currentOrientation[0],
value,
currentOrientation[2])
break;
case coord = 'Z':
api.volumes[layer].setOrientation(
currentOrientation[0],
currentOrientation[1],
value)
break;
default:
break;
}
const renderWindow = api.genericRenderWindow.getRenderWindow();
renderWindow.render()
})
},
Yet getOrientation returns [undefined] (note the brackets), and setOrientation returns:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'forEach')
I've been stuck on this for a few days now, thanks for any help it is much appreciated