Hi to everyone. A quick question for today 
My goal is to know what points (contained in a fiducialsNode) are in/out  one segment. Like in the photo: 
At this moment I use the labelmap representation of the segment and the points in IJK coordinates. I’m wondering if exist a way to do it directly using the points in RAS coordinates and the segment.
Thanks.
             
            
               
               
               
            
            
           
          
            
              
                bserrano  
                (Belen Serrano Antón)
               
              
                  
                    January 10, 2025,  7:48am
                   
                   
              2 
               
             
            
              Hi,
This is a very interesting topic. I find it particularly useful for cleaning geometries and point clouds. Please let me know if you’ve managed to resolve the issue.
Thanks.
             
            
               
               
              1 Like 
            
            
           
          
            
              
                chir.set  
                (SET)
               
              
                  
                    January 10, 2025,  8:13am
                   
                   
              3 
               
             
            
              
 SANTIAGO_PENDON_MING:
 
are in/out
 
 
You may investigate vtkExtractEnclosedPoints and vtkSelectEnclosedPoints.
             
            
               
               
               
            
            
           
          
            
            
              
 chir.set:
 
vtkSelectEnclosedPoints
 
 
That was the solution!
The vtkExtractEnclosedPoints I couldn’t make it work by the way. The basic code I made is:
segmentNode = slicer.mrmlScene.GetFirstNodeByClass("vtkMRMLSegmentationNode")  
segmentId = segmentNode.GetSegmentation().GetNthSegmentID(0)  
geometry = vtk.vtkPolyData()
segmentNode.GetClosedSurfaceRepresentation(segmentId, geometry)
points_array = np.load("puntos.npy")  
points = vtk.vtkPoints()
for point in points_array:
    points.InsertNextPoint(point)
pointCloud = vtk.vtkPolyData()
pointCloud.SetPoints(points)
enclosedPointsFilter = vtk.vtkSelectEnclosedPoints()
enclosedPointsFilter.SetInputData(pointCloud)
enclosedPointsFilter.SetSurfaceData(geometry)  
enclosedPointsFilter.Update()
inside_mask = []
for i in range(points.GetNumberOfPoints()):
    is_inside = enclosedPointsFilter.IsInside(i)  fuera
    inside_mask.append(is_inside)
    print(f"Point{i}: {'Inside' if is_inside else 'Outside'}")