[Insight-users] set the initial seeds in fast marching filter

Dan Mueller dan.muel at gmail.com
Fri May 20 04:38:17 EDT 2011


Hi Quan,

What version of ITK are you using?

If you are using the git ITKv4, then you can simply use
FastMarchingImageToNodePairContainerAdaptor. See the commit here:
    http://itk.org/gitweb?p=ITK.git;a=commit;h=6271a744582c413c7db57456c8ee0149930e5fd9
or a good example here:
    http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Filtering/FastMarching/test/itkFastMarchingImageFilterRealTest2.cxx

If you are using ITK 3.20, you have to manually iterate the image
yourself, and create a node container. Here is a code snippet to get
you going:
  // Setup
  typedef ImageRegionConstIteratorWithIndex< LabelImageType > IteratorType;
  NodeContainer::Pointer nodes = NodeContainer::New();
  nodes->Initialize();
  IteratorType it( image, image->GetLargestPossibleRegion() );

  // Walk image
  unsigned int count = 0;
  for (it.GoToBegin(); !it.IsAtEnd(); ++it)
    {
    if (it.Get() > NumericTraits< LabelPixelType >::Zero)
      {
      NodeType node;
      node.SetIndex( it.GetIndex() );
      nodes->InsertElement( count, node );
      count++;
      }
    }

  // Set nodes
  fastMarching->SetTrialPoints( nodes );

(See http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/LevelSetFilters/itkFastMarchingImageFilter.txx?r=2)

HTH

Cheers, Dan

2011/5/20 Quan <mrvillage at 163.com>:
> hello everyone:
>     after i preprocessed a 2-D image and got an initial contour (saved as an
> image)while doing image segmentation,i wanna set the pixels on this contour
> as the initial seeds of the itk::FastMarchingImageFilter.what should i do
> next?


More information about the Insight-users mailing list