Here is my code. It is almost identical to this example
function StlModal(props: { ohifDicomSegBlob: any }) {
const vtkContainer = useRef(null);
async function getStl() {
const stlRequest = await fetch('http://localhost:3004/orthanc/get-stl-from-dicom-seg', {
method: "POST",
body: ohifDicomSegBlob,
});
const stlBlob = await stlRequest.blob();
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({
background: [0, 0, 0],
rootContainer: vtkContainer.current,
});
const renderer = fullScreenRenderer.getRenderer();
const renderWindow = fullScreenRenderer.getRenderWindow();
const actor = vtkActor.newInstance();
renderer.addActor(actor);
const mapper = vtkMapper.newInstance({ interpolateScalarBeforeMapping: true });
actor.setMapper(mapper);
const cam = vtkCamera.newInstance();
renderer.setActiveCamera(cam);
cam.setFocalPoint(0, 0, 0);
cam.setPosition(0, 0, 10);
cam.setClippingRange(0.1, 50.0);
const stlReader = vtkSTLReader.newInstance();
const smoothFilter = vtkWindowedSincPolyDataFilter.newInstance({
nonManifoldSmoothing: 0,
numberOfIterations: 100,
passBand: 0.001,
});
const arrayBuffer = await stlBlob.arrayBuffer();
stlReader.parseAsArrayBuffer(arrayBuffer);
smoothFilter.setInputConnection(stlReader.getOutputPort());
mapper.setInputConnection(smoothFilter.getOutputPort());
renderer.resetCamera();
renderWindow.render();
}
return (
<div>
<div>
<button onClick={() => getStl()}>preview</button>
<button onClick={() => {}}>download</button>
</div>
<div ref={vtkContainer}></div>
</div>
);
}
but instead of vtkHttpDataSetReader i use vtkSTLReader.
In this component i get dicom-seg blob generated by OHIF. make request to get STL blob and render it using VTK.
But numberOfIterations: 100 and passBand: 0.001 has no effect. With them or without i see this
non-smooth result
I expected something like this