int main( int argc, char *argv[] )
{
if( argc < 7 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0]
<< " inputImage outputImage"
<< " seedX seedY"
<< " multiplier iterations" << std::endl;
return EXIT_FAILURE;
}
const unsigned int Dimension = 2;
typedef unsigned char PixelComponentType;
typedef unsigned char OutputPixelType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
OutputImageType > ConnectedFilterType;
ConnectedFilterType::Pointer confidenceConnected
= ConnectedFilterType::New();
confidenceConnected->SetInput( reader->GetOutput() );
writer->SetInput( confidenceConnected->GetOutput() );
const double multiplier = atof( argv[5] );
confidenceConnected->SetMultiplier( multiplier );
const unsigned int iterations = atoi( argv[6] );
confidenceConnected->SetNumberOfIterations( iterations );
confidenceConnected->SetReplaceValue( 255 );
InputImageType::IndexType index;
index[0] = atoi( argv[3] );
index[1] = atoi( argv[4] );
confidenceConnected->SetSeed( index );
confidenceConnected->SetInitialNeighborhoodRadius( 3 );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
typedef ConnectedFilterType::MeanVectorType MeanVectorType;
typedef ConnectedFilterType::CovarianceMatrixType CovarianceMatrixType;
const MeanVectorType & mean = confidenceConnected->GetMean();
const CovarianceMatrixType & covariance
= confidenceConnected->GetCovariance();
std::cout << "Mean vector = " << mean << std::endl;
std::cout << "Covariance matrix = " << covariance << std::endl;
return EXIT_SUCCESS;
}