I am writing a small C++ program, which contains:
- a voxel grid (nX * nY * nZ)
- a voxel (i,j,k) to 3D point (x,y,z) conversion matrix
- an array of 3D points (x,y,z) defining a closed surface
As I am new to VTK, I was looking for help to see what would be the most efficient / shortest way to compute a boolean 3D matrix that tells me which points of the 3D voxel grid are inside the contour, and which ones are not. I would prefer not to use external batch-processes, just C++ API libraries like VTK or ITK.
I was taking a look at different examples (see below), and wanted to ask about what would be in your opinion the best way to go.
https://vtk.org/Wiki/VTK/Examples/Cxx/Utilities/PointInPolygon
Note: the original XYZ contour data are coming from a DICOM RTstruct, so they are arranged as a stack of 2D closed contour slices. Maybe the PointInPolygon2D function might be the most straightforward solution?
Thanks in advance.