<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi David,<br>
    <br>
    thank you. I'll take a look at your class.<br>
    <br>
    Regards<br>
    Imre<br>
    <br>
    <div class="moz-cite-prefix">Am 29.12.2015 um 13:07 schrieb David
      Gobbi:<br>
    </div>
    <blockquote
cite="mid:CANwS1=Hf4iWqET_B8miyx-KBL=GYopGeTWpCBm-0c=VMwheNyw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Imre,
        <div><br>
        </div>
        <div>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:</div>
        <div><a moz-do-not-send="true"
href="https://github.com/dgobbi/AIRS/blob/master/ImageSegmentation/vtkImageConnectivityFilter.h">https://github.com/dgobbi/AIRS/blob/master/ImageSegmentation/vtkImageConnectivityFilter.h</a></div>
        <div>I'll probably be contributing this filter to VTK sometime
          in the near future.</div>
        <div><br>
        </div>
        <div> - David</div>
        <div><br>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On Tue, Dec 29, 2015 at 4:02 AM,
              Imre Goretzki <span dir="ltr"><<a
                  moz-do-not-send="true"
                  href="mailto:goretzki.imre@gmail.com" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:goretzki.imre@gmail.com">goretzki.imre@gmail.com</a></a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                <div bgcolor="#FFFFFF" text="#000000"> Is there an
                  easier way in ITK?<br>
                  <br>
                  Thanks<span class=""><font color="#888888"><br>
                      Imre</font></span>
                  <div>
                    <div class="h5"><br>
                      <br>
                      <div>Am 28.12.2015 um 23:38 schrieb Imre Goretzki:<br>
                      </div>
                      <blockquote type="cite"> Hey guys,<br>
                        <br>
                        I use the vtkPolyDataConnectivityFilter from
                        polydata to extract several different and more
                        or less unknown regions. <br>
                        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:<br>
                        <br>
                        filter->SetExtractionModeToAllRegions();<br>
                        filter->Update();<br>
                        ...<br>
                        <br>
                        for (int i = 0; i <
                        filter->GetNumberOfExtractedRegions(); i++)<br>
                        {<br>
                           
                        extractFilter->InitializeSpecifiedRegionList();<br>
                            extractFilter->AddSpecifiedRegion(i);<br>
                            extractFilter->Modified();<br>
                            extractFilter->Update();<br>
                           
                        extractRegionData->DeepCopy(extractFilter->GetOutput());<br>
                        }<br>
extractFilter->InitializeSpecifiedRegionList();<br>
                        <br>
                        Background for this: I want to use the points of
                        each region to check whether they lie within an
                        object in my binary<br>
                        mask image. So the pipeline would be like this:<br>
                        <br>
                        1) Get all Regions <br>
                            2) get region <i>i</i><br>
                                 3) get points of region <i>i</i><br>
                                     4) check if point <i>j</i> lies
                        within the binary mask <i>B</i>     (<i>B</i>_<i>j</i>
                        == 255)<br>
                                         4a) if true then add region to
                        the extractFilter and break (-> next region <i>i</i>)<br>
                                         4b) if false then continue with
                        next point <i>j</i><br>
                        5) Mark all regions red (done easily)<br>
                        6) Mark some regions green that are above a
                        specific size (can be accessed with
                        filter->GetRegionSizes() )<br>
                        7) Mark some regions yellow (the regions that
                        are extracted during step 1-4a) <br>
                        <br>
                        I do not know if the PolyDataConnectivityFilter
                        is the right class for this, I think it is. <br>
                        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).<br>
                        <br>
                        I would now try to get the points from the cells
                        and check the binary mask, because the <br>
                        <br>
                        vtkPolyData->GetNumberOfPoints()<br>
                        <br>
                        and<br>
                        <br>
                        vtkPolyData->GetPoint(pointCounter, point); <br>
                        <br>
                        are not working correctly in this scenario (all
                        regions are extracted because every single
                        region has every point?<br>
                        i did not verify my guess but I think there
                        would be the problem)<br>
                        <br>
                        The binary mask is a vtkImageData, that could be
                        transformed to vtkPolyData.<br>
                        The input image (already filtered with
                        vtkMarchingCubes) and the binary mask have the
                        same dimensions (x,y,z).<br>
                        <br>
                        I hope you can imagine what I'm trying to do and
                        have some tips for me, if my approach is
                        correct.<br>
                        <br>
                        Regards<br>
                        Imre<br>
                      </blockquote>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
            <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>