通过 SetSampleDistance ()
来设置每条射线的采样步长,默认值为1,单位为世界坐标系单位,数值越小越精细
通过 SetImageSampleDistance ()
来设置图像采样距离,默认值为1,即投射光线的间隔数值越小越精细
核心代码如下
const cropFilter = vtkImageCropFilter.newInstance();
const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });
const actor = vtkVolume.newInstance(); const mapper = vtkVolumeMapper.newInstance(); mapper.setSampleDistance(1); actor.setMapper(mapper);
actor.getProperty().setUseGradientOpacity(0, true);//设置渐变色
cropFilter.setInputConnection(reader.getOutputPort()); mapper.setInputConnection(cropFilter.getOutputPort());
增加功能前
增加功能后