I am writing a function to segmentate some parts of a vtkImageData using vtkImageConnectivityFilter.
Please bear in mind I am new to vtk.
I have had relatively good results with the filter just by setting the right bounds and scalar range of thresholding, but can not get the seeds to work properly.
By default, this algorithm filters by checking the scalar data of the image within a stencil, when no seeds are given, or the seeds don’t have scalar data.
I’ve tried setting the seeds (ijk coordinates of the points) as vtkPointSets but then the filter extracts no regions. My only suspicion is that the algorithm is expecting scalars and since the seeds have none, then no region is extracted.
vtk_points = self.__get_seeds_as_vtkPoints() seeds = vtk.vtkUnstructuredGrid() #or vtk.vtkStructuredGrid seeds.EditableOn() seeds.SetPoints(vtk_points) seeds.Modified() connectivity_filter.SetSeedData(seeds)
How can I do to input seeds (with or without scalars) into this filter?
Thanks in advance.