1 #include "BaseFunctions.h"
3 #include <fpa/Image/Dijkstra.h>
4 #include <fpa/Image/Functors/Dijkstra/Identity.h>
6 // -------------------------------------------------------------------------
7 const unsigned int Dim = 2;
8 typedef unsigned char TPixel;
11 typedef itk::Image< TPixel, Dim > TInputImage;
12 typedef itk::Image< TScalar, Dim > TScalarImage;
13 typedef fpa::Image::Dijkstra< TInputImage, TScalarImage > TFilter;
14 typedef fpa::Image::Functors::Dijkstra::Identity< TInputImage, TScalar > TWeight;
16 // -------------------------------------------------------------------------
17 int main( int argc, char* argv[] )
23 << "Usage: " << argv[ 0 ]
24 << " output_image output_marks width height ..."
29 std::string output_image_filename = argv[ 1 ];
30 std::string output_marks_filename = argv[ 2 ];
31 int width = std::atoi( argv[ 3 ] );
32 int height = std::atoi( argv[ 4 ] );
35 TInputImage::Pointer image;
36 fpa::tests::image::CreateImage( image, 1, width, height, 1.0, 1.0 );
39 TWeight::Pointer weight = TWeight::New( );
42 TFilter::Pointer filter = TFilter::New( );
43 filter->SetInput( image );
44 filter->SetWeightFunction( weight );
47 for( int i = 5; i < argc; i += 2 )
51 TInputImage::IndexType seed;
52 seed[ 0 ] = std::atoi( argv[ i ] );
53 seed[ 1 ] = std::atoi( argv[ i + 1 ] );
54 filter->AddSeed( seed );
65 fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
67 fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
68 if( err1 != "" ) std::cerr << err1 << std::endl;
69 if( err2 != "" ) std::cerr << err2 << std::endl;