Picking for 3D Volumes

I’m loading in a vtkVolume and I need to get the value of the voxel a user is clicking on. I’m struggling to figure out the correct way to do this. I gather that the CellPicker and PointPicker are for geometry, not volumes. The only example I’ve found for the Hardware Picker is also built around geometry and I’ve had no luck with it. How does one do picking for Volumes?

There is a class in vtk called vtkVolumePicker. But as far as I know, the cell picker and hardware picker should work on volumes, too.

Since vtkVolumePicker is a subclass of vtkCellPicker, you can use GetPointId() to get an index into the volume’s point scalars (scalars = image->GetPointData()->GetScalars()). This will allow you to get the value under the cursor.

Thanks for the response - has the vtkVolumePicker been ported to the vtk.js implementation?

Ah, sorry, I missed that this was a web question. I’m fairly certain it hasn’t been ported to vtk-js.