[vtkusers] Ray Casting - creating mesh from vtkImageData
    Joseph1001 
    joseph.bendahan at gmail.com
       
    Tue Feb  6 12:21:50 EST 2018
    
    
  
The application is to Raycast a line unto a 3D rectilinear voxelized volume
to determine the intersected voxel IDs and the path length (distance)
through each voxel. I was able to do this with
“obbTree.IntersectWithLine()". I used a mesh exported from Rhino to an stl
file and read the stl file (circuitous process). Here it is the working
code:
import vtk
mesh = loadSTL("Voxels.stl")
obbTree = vtk.vtkOBBTree()
obbTree.SetDataSet(mesh)
obbTree.BuildLocator()
points = vtk.vtkPoints()     # List of intersected points
cellIds = vtk.vtkIdList()     # vtkList with cell IDs
code = obbTree.IntersectWithLine((0.5, 3.0, -0.5), (10.5, 0.5, 5.0), points,
cellIds)
Do you know how to create the mesh from vtkImageData? 
I tried the following:
imgID = vtk.vtkImageData()
....   # Calls to configure Image Data
flt = vtk.vtkImageDataGeometryFilter()
flt.SetInputData(imgID)   
flt.Update()
but obbTree.SetDataSet(flt) complains that method requires a vtkDataSet".
Thank you very much.
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
    
    
More information about the vtkusers
mailing list