How to judge whether a point in a space is in the ROI?

How to judge whether a point in a space is in the ROI?


No reply… I change the qestion to … how to get the bounds of the ROI, that is to say the coordinates of the 6 vertices?..

我想把ROI先转换成vtkcube, 再用IsInsideSurface这个方法去判断,可是没成功…哪位大神帮帮我

I want to convert the ROI to vtkcube first, and then use the method IsInsideSurface in VTK: vtkSelectEnclosedPoints Class Reference to judge, but it didn’t work…Which god can help me?

@lassoan@Juicy@jamesobutler @jcfr @pieper


I tried the method GetPolyData() to annotation ROI and got a line segment…

The annotations ROI stores center and corner point (radius) so you can check if the point is inside center +/- radius in each dimension.

If you use the new markups ROI node then you can get an implicit function that you can use to quickly query points (and also use in all VTK filters that take implicit functions as inputs). Example:

roiNode = getNode('R')
point = [73,45,-1181]

planes = vtk.vtkPlanes()
isInside = planes.EvaluateFunction(point) < 0
print(f"Point {point} is {'inside' if isInside else 'outside'}")

The sign of the implicit function returns distance from the ROI boundary. Negative value means that the point is inside.

1 Like

This method is wonderful! Thank you God