X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tests%2Fimage%2FRegionGrow%2FTautology.cxx;fp=tests%2Fimage%2FRegionGrow%2FTautology.cxx;h=0000000000000000000000000000000000000000;hb=a8ac405fe1422bc0792a810f7f0693096a22c20e;hp=0bbdc4519cc8b2f011f18623d7111695e1546782;hpb=8abe87eaa0d29ba667d5cbf35f4ca1ca2e38c6c4;p=FrontAlgorithms.git diff --git a/tests/image/RegionGrow/Tautology.cxx b/tests/image/RegionGrow/Tautology.cxx deleted file mode 100644 index 0bbdc45..0000000 --- a/tests/image/RegionGrow/Tautology.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -const unsigned int Dim = 2; -typedef unsigned char TPixel; -typedef itk::Image< TPixel, Dim > TImage; - -// ------------------------------------------------------------------------- -int main( int argc, char* argv[] ) -{ - // Get arguments - if( argc < 4 ) - { - std::cerr - << "Usage: " << argv[ 0 ] - << " output_image output_marks size [seeds]" - << std::endl; - return( 1 ); - - } // fi - std::string output_image_filename = argv[ 1 ]; - std::string output_marks_filename = argv[ 2 ]; - TImage::SizeType size; - size.Fill( std::atoi( argv[ 3 ] ) ); - - // Create image - TImage::Pointer image = TImage::New( ); - image->SetRegions( size ); - image->Allocate( ); - image->FillBuffer( TPixel( 0 ) ); - - // Prepare predicate - typedef fpa::Functors::RegionGrow::Tautology< TPixel > TPredicate; - TPredicate::Pointer predicate = TPredicate::New( ); - - // Prepare filter - typedef fpa::Filters::Image::RegionGrow< TImage, TImage > TFilter; - TFilter::Pointer filter = TFilter::New( ); - filter->SetInput( image ); - filter->SetPredicate( predicate ); - filter->SetInsideValue( std::numeric_limits< TPixel >::max( ) ); - filter->SetOutsideValue( TPixel( 0 ) ); - - // Get all seeds - for( int i = 4; i < argc; i += Dim ) - { - TImage::IndexType seed; - for( int j = 0; j < Dim; ++j ) - if( i + j < argc ) - seed[ j ] = std::atoi( argv[ i + j ] ); - filter->AddSeed( seed ); - - } // rof - - // Execute filter - filter->Update( ); - - // Save results - typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter; - TOutputWriter::Pointer output_writer = TOutputWriter::New( ); - output_writer->SetInput( filter->GetOutput( ) ); - output_writer->SetFileName( output_image_filename ); - - typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter; - TMarksWriter::Pointer marks_writer = TMarksWriter::New( ); - marks_writer->SetInput( filter->GetMarks( ) ); - marks_writer->SetFileName( output_marks_filename ); - - try - { - output_writer->Update( ); - marks_writer->Update( ); - } - catch( std::exception& err ) - { - std::cerr << "Error caught: " << err.what( ) << std::endl; - return( 1 ); - - } // yrt - - return( 0 ); -} - -// eof - $RCSfile$