X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fimage%2FRandomWalker%2FGaussian.cxx;fp=tests%2Fimage%2FRandomWalker%2FGaussian.cxx;h=0000000000000000000000000000000000000000;hb=a8ac405fe1422bc0792a810f7f0693096a22c20e;hp=be6016e5c806edc9478d60a4a1d979853bce4ffa;hpb=8abe87eaa0d29ba667d5cbf35f4ca1ca2e38c6c4;p=FrontAlgorithms.git diff --git a/tests/image/RandomWalker/Gaussian.cxx b/tests/image/RandomWalker/Gaussian.cxx deleted file mode 100644 index be6016e..0000000 --- a/tests/image/RandomWalker/Gaussian.cxx +++ /dev/null @@ -1,94 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#include -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -const unsigned int Dim = 2; -typedef unsigned char TInputPixel; -typedef unsigned char TInputLabel; -typedef float TOutputPixel; -typedef itk::Image< TInputPixel, Dim > TInputImage; -typedef itk::Image< TInputLabel, Dim > TInputLabelImage; -typedef itk::Image< TOutputPixel, Dim > TOutputImage; - -// ------------------------------------------------------------------------- -int main( int argc, char* argv[] ) -{ - // Get arguments - if( argc < 7 ) - { - std::cerr - << "Usage: " << argv[ 0 ] - << " input_image input_labels output_image output_costs alpha beta" - << std::endl; - return( 1 ); - - } // fi - std::string input_image_filename = argv[ 1 ]; - std::string input_labels_filename = argv[ 2 ]; - std::string output_image_filename = argv[ 3 ]; - std::string output_costs_filename = argv[ 4 ]; - double alpha = std::atof( argv[ 5 ] ); - double beta = std::atof( argv[ 6 ] ); - - // Read image - typedef itk::ImageFileReader< TInputImage > TInputImageReader; - TInputImageReader::Pointer input_image_reader = TInputImageReader::New( ); - input_image_reader->SetFileName( input_image_filename ); - - // Read labels - typedef itk::ImageFileReader< TInputLabelImage > TInputLabelImageReader; - TInputLabelImageReader::Pointer input_labels_reader = - TInputLabelImageReader::New( ); - input_labels_reader->SetFileName( input_labels_filename ); - - // Prepare weight functor - typedef fpa::Functors::Dijkstra::Image::Gaussian< TInputImage, TOutputPixel > TWeight; - TWeight::Pointer weight = TWeight::New( ); - weight->SetAlpha( alpha ); - weight->SetBeta( beta ); - - // Prepare filter - typedef fpa::Filters::Image::RandomWalker< TInputImage, TInputLabelImage, TOutputImage > TFilter; - TFilter::Pointer filter = TFilter::New( ); - filter->SetInputImage( input_image_reader->GetOutput( ) ); - filter->SetInputLabels( input_labels_reader->GetOutput( ) ); - filter->SetWeightFunction( weight ); - - // Execute filter - filter->Update( ); - - // Save results - typedef itk::ImageFileWriter< TFilter::TOutputLabels > TOutputWriter; - TOutputWriter::Pointer output_writer = TOutputWriter::New( ); - output_writer->SetInput( filter->GetOutputLabels( ) ); - output_writer->SetFileName( output_image_filename ); - - typedef itk::ImageFileWriter< TFilter::TCostsImage > TCostsWriter; - TCostsWriter::Pointer costs_writer = TCostsWriter::New( ); - costs_writer->SetInput( filter->GetOutputCosts( ) ); - costs_writer->SetFileName( output_costs_filename ); - - try - { - output_writer->Update( ); - costs_writer->Update( ); - } - catch( std::exception& err ) - { - std::cerr << "Error caught: " << err.what( ) << std::endl; - return( 1 ); - - } // yrt - - return( 0 ); -} - -// eof - $RCSfile$