X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tests%2Fimage%2FRegionGrow_BinaryThreshold.cxx;fp=tests%2Fimage%2FRegionGrow_BinaryThreshold.cxx;h=0000000000000000000000000000000000000000;hb=3c639e5da479c7216a0a302ffa156ac6762caeed;hp=b40f25a10d8f083a350c973bc7b6f4867d273462;hpb=5bf766068f54d061d3816f4950a076c3cf3a4d8b;p=FrontAlgorithms.git diff --git a/tests/image/RegionGrow_BinaryThreshold.cxx b/tests/image/RegionGrow_BinaryThreshold.cxx deleted file mode 100644 index b40f25a..0000000 --- a/tests/image/RegionGrow_BinaryThreshold.cxx +++ /dev/null @@ -1,91 +0,0 @@ -#include "BaseFunctions.h" -#include -#include -#include - -// ------------------------------------------------------------------------- -const unsigned int Dim = 3; -typedef short TInputPixel; -typedef unsigned char TOutputPixel; - -typedef itk::Image< TInputPixel, Dim > TInputImage; -typedef itk::Image< TOutputPixel, Dim > TOutputImage; -typedef fpa::Image::RegionGrow< TInputImage, TOutputImage > TFilter; -typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputPixel > TPredicate; - -// ------------------------------------------------------------------------- -int main( int argc, char* argv[] ) -{ - // Get arguments - if( argc < 8 + Dim ) - { - std::cerr - << "Usage: " << argv[ 0 ] - << " input_image output_image output_marks" - << " lower upper strict [index/point] ..." - << 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 ]; - TInputPixel lower = TInputPixel( std::atof( argv[ 4 ] ) ); - TInputPixel upper = TInputPixel( std::atof( argv[ 5 ] ) ); - bool strict = ( argv[ 6 ][ 0 ] == '1' ); - std::string seeds_type = argv[ 7 ]; - - // Create image - TInputImage::Pointer input_image; - std::string err0 = - fpa::tests::image::Read( input_image, input_image_filename ); - if( err0 != "" ) std::cerr << err0 << std::endl; - - // Prepare predicate - TPredicate::Pointer predicate = TPredicate::New( ); - predicate->SetLower( lower ); - predicate->SetUpper( upper ); - predicate->SetStrict( strict ); - - // Prepare filter - TFilter::Pointer filter = TFilter::New( ); - filter->SetInput( input_image ); - filter->SetPredicate( predicate ); - filter->SetInsideValue( 255 ); - filter->SetOutsideValue( 0 ); - - // Get all seeds - for( int i = 8; i < argc; i += Dim ) - { - if( seeds_type == "index" ) - { - TInputImage::IndexType seed; - for( unsigned int d = 0; d < Dim; ++d ) - seed[ d ] = std::atoi( argv[ i + d ] ); - filter->AddSeed( seed ); - } - else - { - TInputImage::PointType seed; - for( unsigned int d = 0; d < Dim; ++d ) - seed[ d ] = std::atof( argv[ i + d ] ); - 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 << err1 << std::endl; - if( err2 != "" ) std::cerr << err2 << std::endl; - - return( 0 ); -} - -// eof - $RCSfile$