1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
7 #include <tclap/CmdLine.h>
9 #include <itkAndImageFilter.h>
10 #include "Functions.h"
12 // -------------------------------------------------------------------------
13 const unsigned int Dim = 3;
14 typedef unsigned char TPixel;
15 typedef itk::Image< TPixel, Dim > TImage;
17 // -------------------------------------------------------------------------
18 int main( int argc, char* argv[] )
20 typedef TCLAP::ValueArg< std::string > _TStringArg;
23 _TStringArg in1( "i", "input1", "Input image 1", true, "", "file" );
24 _TStringArg in2( "j", "input2", "Input image 2", true, "", "file" );
25 _TStringArg out( "o", "output", "Output image", true, "", "file" );
28 TCLAP::CmdLine cmd( "FastRandomWalker", ' ', "1.0.0" );
32 cmd.parse( argc, argv );
34 catch( TCLAP::ArgException& err )
37 << "===============================" << std::endl
38 << "Error caught: " << std::endl
39 << err.error( ) << " " << err.argId( ) << std::endl
40 << "===============================" << std::endl
49 TImage::Pointer input_image1;
50 CTBronchi::ReadImage( input_image1, in1.getValue( ) );
53 TImage::Pointer input_image2;
54 CTBronchi::ReadImage( input_image2, in2.getValue( ) );
57 typedef itk::AndImageFilter< TImage, TImage, TImage > TFilter;
58 TFilter::Pointer filter = TFilter::New( );
59 filter->SetInput1( input_image1 );
60 filter->SetInput2( input_image2 );
61 double t = CTBronchi::MeasureTime( filter );
62 std::cout << "And filter executed in " << t << " s" << std::endl;
65 CTBronchi::WriteImage( filter->GetOutput( ), out.getValue( ) );
67 catch( std::exception& err )
70 << "===============================" << std::endl
71 << "Error caught: " << std::endl
72 << err.what( ) << std::endl
73 << "===============================" << std::endl