[Insight-users] Floodfill segmentation or is there an other possibillity in itk

Luis Ibanez luis.ibanez at kitware.com
Tue Mar 25 10:22:58 EDT 2008


Hi Oliver,


You probably should use the FloodFilledImageFunctionConditionalIterator.


Please read the code of the itkConnectedThresholdImageFilter.txx file
in the directory Insight/Code/BasicFilters.


You should pay particular attention to lines 255-275:


   typedef BinaryThresholdImageFunction<
     InputImageType, double> FunctionType;

   typedef FloodFilledImageFunctionConditionalIterator<
     OutputImageType, FunctionType> IteratorType;

   typename FunctionType::Pointer function = FunctionType::New();
   function->SetInputImage ( inputImage );
   function->ThresholdBetween ( m_Lower, m_Upper );

   ProgressReporter progress(this, 0, region.GetNumberOfPixels());

   IteratorType it ( outputImage, function, m_SeedList );
   it.GoToBegin();

   while( !it.IsAtEnd())
     {
     it.Set(m_ReplaceValue);
     ++it;
     progress.CompletedPixel();  // potential exception thrown here
     }




You can implement your variation of flood-filling by defining a new
ImageFunction to replace the BinaryThresholdImageFunction. Your new
image function will define the criteria that allows to accept a new
pixel into the region.



   Regards,



      Luis



---------------------------
Oliver Trebbe wrote:
> Hello Guys,
> 
> i have a problem, i want to segment 3d images in a special way, using 
> floodfilling with integrated neighborhood checking, but i don´t get an 
> idea using the iterator´s for this problem, maybe someone can help me 
> getting my mind ready or can give me some tips or ideas using the 
> iterators right...
> the problem is i want to use the x y z dimensions but cant read them 
> anywhere...
> and just iterating through the voxels isnt the right way...
> can i use pointers to the previous iterator? or next (or so)
> how to define or use them?
> would be thankfull if someone can help me
> 
> Thanks
> 
> Oliver
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list