+++ /dev/null
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/Dijkstra.h>
-#include <fpa/Image/Functors/Dijkstra/Gaussian.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short TPixel;
-typedef float TScalar;
-
-typedef itk::Image< TPixel, Dim > TInputImage;
-typedef itk::Image< TScalar, Dim > TScalarImage;
-typedef fpa::Image::Dijkstra< TInputImage, TScalarImage > TFilter;
-typedef fpa::Image::Functors::Dijkstra::Gaussian< TInputImage, TScalar > TWeight;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
- // Get arguments
- if( argc < 7 )
- {
- std::cerr
- << "Usage: " << argv[ 0 ]
- << " input_image output_image output_marks alpha beta"
- << " stop_at_one_front ..."
- << std::endl;
- return( 1 );
-
- } // fi
- std::string input_image_filename = argv[ 1 ];
- std::string output_image_filename = argv[ 2 ];
- std::string output_marks_filename = argv[ 3 ];
- double alpha = std::atoi( argv[ 4 ] );
- double beta = std::atoi( argv[ 5 ] );
- bool stop_at_one_front = ( argv[ 6 ][ 0 ] == '1' );
-
- // Create image
- TInputImage::Pointer image;
- std::string err0 = fpa::tests::image::Read( image, input_image_filename );
- if( err0 != "" )
- {
- std::cerr << "Error caught: " << err0 << std::endl;
- return( 1 );
-
- } // fi
-
- // Prepare weight
- TWeight::Pointer weight = TWeight::New( );
- weight->SetAlpha( alpha );
- weight->SetBeta( beta );
-
- // Prepare filter
- TFilter::Pointer filter = TFilter::New( );
- filter->SetInput( image );
- filter->SetWeightFunction( weight );
- filter->SetStopAtOneFront( stop_at_one_front );
-
- // Get all seeds
- for( int i = 7; i < argc; i += 3 )
- {
- if( i + 1 < argc )
- {
- TInputImage::IndexType seed;
- seed[ 0 ] = std::atoi( argv[ i ] );
- seed[ 1 ] = std::atoi( argv[ i + 1 ] );
- seed[ 2 ] = std::atoi( argv[ i + 2 ] );
- filter->AddSeed( seed );
-
- } // fi
-
- } // rof
-
- // Execute filter
- filter->Update( );
-
- // Save results
- std::string err1 =
- fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
- std::string err2 =
- fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
- if( err1 != "" ) std::cerr << "Error caught: " << err1 << std::endl;
- if( err2 != "" ) std::cerr << "Error caught: " << err2 << std::endl;
-
- return( 0 );
-}
-
-// eof - $RCSfile$