Using the ConnectedThresholdImageFilter, the [low, high] threshold must be set to a constant value for the whole growing process.  Using the ConfidenceConnectedImageFilter, the statistics of the entire region that has been formed so far is used in determining if the next pixel should be added to the region. What I am looking for is a way to add the next pixel to the region based on a test that only uses the query pixel&#39;s neighbors that are already in the region. <br>
<br>In  a 1D example, if the pixels are:<br>1 2 3 4 5 6 15 16 17<br><br>the neighborhood test is set to:<br>&quot;is the query pixel less than 2 away from all of its neighbors that are already in the region&quot;<br><br>and the seed pixel is the left-most pixel, then &quot;1 2 3 4 5 6&quot; would be the result of the region growth.<br>
<br>Looking at ConnectedThresholdImageFilter.txx, it seems like maybe I have to define my own *Function class, so<br>
<br>  typedef BinaryThresholdImageFunction&lt;InputImageType, double&gt; FunctionType;<br>could be changed to something like:<br>  typedef RegionBoundaryDifferenceFunction&lt;InputImageType, double&gt; FunctionType;<br><br>
Then the growing would remain identical:<br>  typename FunctionType::Pointer function = FunctionType::New();<br>    <br>    typedef FloodFilledImageFunctionConditionalIterator&lt;OutputImageType, FunctionType&gt; IteratorType;<br>
    IteratorType it ( outputImage, function, m_SeedList );<br>    it.GoToBegin();<br><br>    while( !it.IsAtEnd())<br>      {<br>      it.Set(m_ReplaceValue);<br>      ++it;<br>      progress.CompletedPixel();  // potential exception thrown here<br>
      }<br>    }<br><br>The details of RegionBoundaryDifferenceFunction would just be finding the boundary points in the existing region that are neighbors of the query pixel and seeing if they all meet a criteria. Is this close to where I should be headed? Is there an existing framework that lets me override this part without actually having to edit/add itk source?<br>
<br clear="all">Thanks,<br><br>David<br>