当前位置:网站首页>vtk.js滚动切片

vtk.js滚动切片

2022-11-24 21:43:01小江江12

关于滚动切片,官方有一个很好的例子,如下图:

关键代码

const mapper = vtkImageMapper.newInstance();
mapper.setInputConnection(rtSource.getOutputPort());
mapper.setSliceAtFocalPoint(true);//这一行切片的光照焦点必须要设置为true,否则滚动会失效
mapper.setSlicingMode(SlicingMode.Z);

 

const actor = vtkImageSlice.newInstance();
actor.getProperty().setColorWindow(255);
actor.getProperty().setColorLevel(127);
// Uncomment this if you want to use a fixed colorwindow/level
// actor.getProperty().setRGBTransferFunction(rgb);
actor.getProperty().setPiecewiseFunction(ofun);
actor.setMapper(mapper);
renderer.addActor(actor);

const iStyle = vtkInteractorStyleImage.newInstance();
iStyle.setInteractionMode('IMAGE_SLICING');
renderWindow.getInteractor().setInteractorStyle(iStyle);
renderer.resetCamera();
renderWindow.render();

设置后即可进行滚动切片

原网站

版权声明
本文为[小江江12]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_39966730/article/details/128002195

随机推荐