# Exploring VTK-Based 3D Modeling of Floating-Point RTStruct Contours in 3D Slicer

We are exploring how 3D Slicer handles the conversion of RTStruct contour data to 3D models, specifically concerning the handling of floating-point coordinates for each slice’s contour. Our primary questions are as follows:

Does 3D Slicer use a VTK process that inherently requires integer-based coordinates, or can it work directly with the floating-point values present in RTStruct files? We’ve observed that traditional methods like the marching cubes algorithm typically utilize an integer-indexed 3D grid.

In our own experiments, converting the floating-point contour data to an image representation necessitates rounding to whole numbers, as each pixel can only be a binary value (255 or 0). This rounding alters the resulting STL shape when meshing via the marching cubes algorithm. However, we’ve noticed that 3D Slicer appears not to round the contour points. Could you clarify whether 3D Slicer’s VTK process operates directly on contour data or if it first converts to an image representation?

If 3D Slicer uses the contours directly, how does it fill the surface between the inner and outer contours to create a complete 3D model?

Hi Ranjan,

Some resources about segmentation representation conversion:

The short answer to your question is that the RTStruct 2D contours are triangulated to closed surfaces for each segment (i.e. RT structure), thus there is no need for discretization. As long as you do not change the source representation, the closed surface representation will be a lossless interpolation of the original contour sets.

Thank you for your reply. That makes sense that we need to triangulate 2D contours to closed surfaces without the need for discretization. I have been trying a few methods such as delaunay after interpolation and surface reconstruction filter. Delaunay works well in 2D when trying to convert from point cloud per slice to a 2D surface as shown in the image but the interpolation when converting them to 3D doesnt work as well. Is there a recommended method for triangulating in 3D?

I don’t understand why you are trying custom methods. The built-in conversion pipeline is well tested and robust, I recommend using that. Is there a reason that it is not good enough? As we established, the floating point coordinates are preserved for the closed surface.