]> Creatis software - FrontAlgorithms.git/blob - appli/examples/example_ImageAlgorithmFastMarching_00.cxx
...
[FrontAlgorithms.git] / appli / examples / example_ImageAlgorithmFastMarching_00.cxx
1 #include <iostream>
2 #include <itkImage.h>
3
4 #include <fpa/Image/FastMarching.h>
5
6 // -------------------------------------------------------------------------
7 const unsigned int Dim = 2;
8 typedef unsigned char TPixel;
9 typedef double        TCost;
10 typedef itk::Image< TPixel, Dim > TImage;
11
12 typedef fpa::Image::FastMarching< TImage, TCost > TFrontAlgorithm;
13
14 // -------------------------------------------------------------------------
15 int main( int argc, char* argv[] )
16 {
17   // Create a dummy image
18   TImage::SizeType imageSize;
19   imageSize.Fill( 100 );
20
21   TImage::SpacingType imageSpacing;
22   imageSpacing.Fill( 1 );
23
24   TImage::Pointer image = TImage::New( );
25   image->SetRegions( imageSize );
26   image->SetSpacing( imageSpacing );
27   image->Allocate( );
28   image->FillBuffer( TPixel( 1 ) );
29
30   // Seed
31   TImage::IndexType seed;
32   seed.Fill( 50 );
33
34   // Configure algorithm
35   TFrontAlgorithm::Pointer algorithm = TFrontAlgorithm::New( );
36   algorithm->AddSeed( seed, TCost( 0 ) );
37   algorithm->SetInput( image );
38   algorithm->SetNeighborhoodOrder( 1 );
39   algorithm->Update( );
40
41   return( 0 );
42 }
43
44 // eof - $RCSfile$