]> Creatis software - FrontAlgorithms.git/blobdiff - tests/image/MoriSegmentation.cxx
...
[FrontAlgorithms.git] / tests / image / MoriSegmentation.cxx
diff --git a/tests/image/MoriSegmentation.cxx b/tests/image/MoriSegmentation.cxx
deleted file mode 100644 (file)
index 5a5a472..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "BaseFunctions.h"
-#include <chrono>
-#include <itkImage.h>
-#include <fpa/Image/Mori.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short          TPixel;
-typedef unsigned short TLabel;
-
-typedef itk::Image< TPixel, Dim > TInputImage;
-typedef itk::Image< TLabel, Dim > TLabelImage;
-typedef fpa::Image::Mori< TInputImage, TLabelImage > TFilter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 9 + Dim )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image output_image output_marks output_signal"
-      << " init_threshold end_threshold delta [index/point] seed"
-      << 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 ];
-  std::string output_signal_filename = argv[ 4 ];
-  TPixel init_threshold = std::atoi( argv[ 5 ] );
-  TPixel end_threshold = std::atoi( argv[ 6 ] );
-  TPixel delta = std::atoi( argv[ 7 ] );
-  std::string seed_type = argv[ 8 ];
-
-  TInputImage::IndexType iseed;
-  TInputImage::PointType pseed;
-  for( unsigned int i = 0; i < Dim; ++i )
-  {
-    if( seed_type == "index" )
-      iseed[ i ] = std::atoi( argv[ 9 + i ] );
-    else
-      pseed[ i ] = std::atof( argv[ 9 + i ] );
-
-  } // rof
-
-  // 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 filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input_image );
-  if( seed_type == "index" )
-    filter->SetSeed( iseed );
-  else
-    filter->SetSeed( pseed );
-  filter->SetThresholds( init_threshold, end_threshold, delta );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-  filter->SetSignalKernelSize( 20 );
-  filter->SetSignalThreshold( 500 );
-  filter->SetSignalInfluence( 0.5 );
-  filter->SetMinimumThreshold( -850 );
-
-  // Execute filter
-  std::chrono::time_point< std::chrono::high_resolution_clock > tstart, tend;
-  tstart = std::chrono::high_resolution_clock::now( );
-  filter->Update( );
-  tend = std::chrono::high_resolution_clock::now( );
-  std::chrono::duration< double > telapsed = tend - tstart;
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetThresholdedOutput( ), 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;
-
-  std::ofstream osignal( output_signal_filename.c_str( ) );
-  unsigned long nThr = filter->GetNumberOfEvaluatedThresholds( );
-  for( unsigned long i = 0; i < nThr; ++i )
-  {
-    double x, y;
-    TFilter::TPeak p;
-    filter->GetSignalValues( i, x, y, p );
-    osignal << x << " " << y << std::endl;
-
-  } // rof
-  osignal.close( );
-
-  std::cout
-    << "------------------------------------------------------" << std::endl
-    << "Elapsed time: " << telapsed.count( ) << " s" << std::endl
-    << "Optimum threshold: " << filter->GetOptimumThreshold( ) << std::endl
-    << "Number of evaluated thresholds: " << nThr << std::endl
-    << "------------------------------------------------------"
-    << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$