OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.37k stars 3.39k forks source link

[3.9-3D] Enable 3D Visualization of Label Maps: Convert and render label map segmentations as 3D surfaces #4109

Closed sedghi closed 1 week ago

sedghi commented 6 months ago

What feature or change would you like to see made?

Why should we prioritize this feature?

Three-dimensional visualization of label maps can provide valuable spatial context and improved understanding of segmented structures, particularly in medical imaging applications involving complex anatomical structures or pathologies. By enabling 3D rendering of label maps as surfaces, OHIF can offer users a more intuitive and immersive experience when working with segmentation data.

robtoth commented 6 months ago

This seems like a great feature!

This type of surface rendering seems already available in cornerstone3d:

Cornerstone Demo: https://www.cornerstonejs.org/live-examples/surfacerendering

Screenshot_20240520_100022

Code in cornerstone that convert labelmap to surface (vtk polydata): https://github.com/cornerstonejs/cornerstone3D/blob/2c4efae4c977bf6df9ca7399b6c6e715ab3f899d/packages/tools/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts#L81

It seems to use the polyseg implementation of the Flying Edges algorithm: https://github.com/cornerstonejs/cornerstone3D/blob/2c4efae4c977bf6df9ca7399b6c6e715ab3f899d/packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts#L44

Specifically calling ICRPolySeg functionality: https://github.com/cornerstonejs/cornerstone3D/blob/2c4efae4c977bf6df9ca7399b6c6e715ab3f899d/packages/tools/src/workers/polySegConverters.js#L56

from the polyseg-wasm library: https://github.com/cornerstonejs/cornerstone3D/blob/2c4efae4c977bf6df9ca7399b6c6e715ab3f899d/packages/tools/src/workers/polySegConverters.js#L4

This uses vtkDiscreteFlyingEdges3D (a faster implementation of the Marching Cubes algorithm) under the hood via the convertLabelmapToSurface function:

https://bitbucket.org/icrimaginginformatics/polyseg-wasm/src/0fdf4f40e089f57e5ff9927a099a58465891ea90/src/ICRPolySeg.cxx#lines-384

Further reading:

cc @sedghi

Cristianzaza commented 1 month ago

Hello, any update on this side? I tried to follow the advices given in the previous answer myself, but didn't manage to have it working.. Thank you

sedghi commented 1 week ago

We released OHIF 3.9 which address this issue.