-#include <itkCommand.h>
#include <itkImage.h>
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
typedef itk::ImageFileWriter< TImage > TWriter;
typedef fpa::Image::MoriRegionGrow< TImage, TImage > TFilter;
-// -------------------------------------------------------------------------
-/**
- */
-class MyObserver
- : public itk::Command
-{
-public:
- typedef TFilter::TStartEvent TStartEvent;
- typedef TFilter::TEndEvent TEndEvent;
- typedef TFilter::TStartLoopEvent TStartLoopEvent;
- typedef TFilter::TEndLoopEvent TEndLoopEvent;
- typedef TFilter::TPushEvent TPushEvent;
- typedef TFilter::TPopEvent TPopEvent;
- typedef TFilter::TMarkEvent TMarkEvent;
-
-public:
- itkNewMacro( MyObserver );
-
-public:
- virtual void Execute(
- itk::Object* caller, const itk::EventObject& event
- ) override
- {
- this->Execute( const_cast< const itk::Object* >( caller ), event );
- }
- virtual void Execute(
- const itk::Object* object, const itk::EventObject& event
- ) override
- {
- /* TODO
- if( TStartEvent( ).CheckEvent( &event ) )
- std::cout << "Start" << std::endl;
- else if( TEndEvent( ).CheckEvent( &event ) )
- std::cout << "End" << std::endl;
- else if( TStartLoopEvent( ).CheckEvent( &event ) )
- std::cout << "StartLoop" << std::endl;
- else if( TEndLoopEvent( ).CheckEvent( &event ) )
- std::cout << "EndLoop" << std::endl;
- else if( TMarkEvent( ).CheckEvent( &event ) )
- {
- const TMarkEvent* mark = dynamic_cast< const TMarkEvent* >( &event );
- std::cout << "Mark: " << mark->Vertex << std::endl;
-
- } // fi
- */
- /* TODO
- TPushEvent;
- TPopEvent;
- */
- }
-};
-
// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
- if( argc < 3 )
+ if( argc < 4 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " input_filename output_filename" << std::endl;
+ << " input_filename output_filename sensitivity" << std::endl;
return( 1 );
} // fi
std::string in_fname = argv[ 1 ];
std::string out_fname = argv[ 2 ];
+ double sensitivity = std::atof( argv[ 3 ] );
int seed_x = 111;
int seed_y = 91;
filter->SetStep( 1 );
filter->SetInsideValue( 255 );
filter->SetOutsideValue( 0 );
+ filter->SetSensitivity( sensitivity );
filter->AddSeed( seed, filter->GetInsideValue( ) );
- /* TODO
- MyObserver::Pointer obs = MyObserver::New( );
- filter->AddObserver( itk::AnyEvent( ), obs );
- */
-
TWriter::Pointer writer = TWriter::New( );
writer->SetInput( filter->GetOutput( ) );
writer->SetFileName( out_fname );