[vtkusers] method to extract regions
David Gobbi
david.gobbi at gmail.com
Tue Dec 29 07:07:23 EST 2015
Hi Imre,
I have a connectivity filter that works directly on images, it can label
connected regions according to size and it should be much faster (probably
1000x) than doing voxel checks via polydata:
https://github.com/dgobbi/AIRS/blob/master/ImageSegmentation/vtkImageConnectivityFilter.h
I'll probably be contributing this filter to VTK sometime in the near
future.
- David
On Tue, Dec 29, 2015 at 4:02 AM, Imre Goretzki <goretzki.imre at gmail.com>
wrote:
> Is there an easier way in ITK?
>
> Thanks
> Imre
>
>
> Am 28.12.2015 um 23:38 schrieb Imre Goretzki:
>
> Hey guys,
>
> I use the vtkPolyDataConnectivityFilter from polydata to extract several
> different and more or less unknown regions.
> My problem is that I want to extract regions from this filter, but if I do
> this, the update process for all regions takes up to 10minutes:
>
> filter->SetExtractionModeToAllRegions();
> filter->Update();
> ...
>
> for (int i = 0; i < filter->GetNumberOfExtractedRegions(); i++)
> {
> extractFilter->InitializeSpecifiedRegionList();
> extractFilter->AddSpecifiedRegion(i);
> extractFilter->Modified();
> extractFilter->Update();
> extractRegionData->DeepCopy(extractFilter->GetOutput());
> }
> extractFilter->InitializeSpecifiedRegionList();
>
> Background for this: I want to use the points of each region to check
> whether they lie within an object in my binary
> mask image. So the pipeline would be like this:
>
> 1) Get all Regions
> 2) get region *i*
> 3) get points of region *i*
> 4) check if point *j* lies within the binary mask *B* (
> *B*_*j* == 255)
> 4a) if true then add region to the extractFilter and
> break (-> next region *i*)
> 4b) if false then continue with next point *j*
> 5) Mark all regions red (done easily)
> 6) Mark some regions green that are above a specific size (can be accessed
> with filter->GetRegionSizes() )
> 7) Mark some regions yellow (the regions that are extracted during step
> 1-4a)
>
> I do not know if the PolyDataConnectivityFilter is the right class for
> this, I think it is.
> If I store the extractRegionData in a vector, all regions have the same
> number of points (which is kind of strange) but different number of cells
> (region size == number of cells is correct).
>
> I would now try to get the points from the cells and check the binary
> mask, because the
>
> vtkPolyData->GetNumberOfPoints()
>
> and
>
> vtkPolyData->GetPoint(pointCounter, point);
>
> are not working correctly in this scenario (all regions are extracted
> because every single region has every point?
> i did not verify my guess but I think there would be the problem)
>
> The binary mask is a vtkImageData, that could be transformed to
> vtkPolyData.
> The input image (already filtered with vtkMarchingCubes) and the binary
> mask have the same dimensions (x,y,z).
>
> I hope you can imagine what I'm trying to do and have some tips for me, if
> my approach is correct.
>
> Regards
> Imre
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151229/e08406ae/attachment.html>
More information about the vtkusers
mailing list