URGENT : Converting 2D ROI to 3D VOI

We are creating an automated surgical planning system. We have 2D ROIs slice wise. We want to stitch it together to find a possible trajectory in 3D space. Can someone give any inputs/solutions regarding this?

Slicer does everything in 3D. If you segment 2D slices then Slicer displays them in correct physical position in 3D.

How those ROIs are created?