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

Dan Mueller dan.muel at gmail.com
Fri May 20 09:01:31 EDT 2011


Hi Quan,

You are correct -- "image" equals the contour image.

You should be able to use reader2->GetOutput().

Good luck.

Regards, Dan

2011/5/20 Quan <mrvillage at 163.com>:
> hi Dan:
> this line code
> IteratorType it( image, image->GetLargestPossibleRegion() );
> does the argument 'image' means the contour image i get ?
> in my code ,i write:
> ...................................//something
> reader2->SetFileName('Contour.png');//Contour.png is an Image that include a
> initial contour.
> IteratorType it( reader2->GetOutput(),
> reader->GetOutput()->GetLargestPossibleRegion() );
> am i wrong when i using reader2->GetOutPut() as  the argument?
> thanks
> Quan
>
> At 2011-05-20 16:38:17,"Dan Mueller" <dan.muel at gmail.com> wrote:
>
>>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