]> Creatis software - FrontAlgorithms.git/blobdiff - appli/examples/example_ImageAlgorithmRegionGrow_MultipleThresholds.cxx
Some tests... Package is unstable right nowgit status!
[FrontAlgorithms.git] / appli / examples / example_ImageAlgorithmRegionGrow_MultipleThresholds.cxx
index 165dafb30cab17e71691118542c66fad4279e4e2..1f4bf3fa51f4204d927d155f148c37d93539c903 100644 (file)
@@ -38,22 +38,18 @@ TObserver;
 // -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
-  if( argc < 8 )
+  if( argc < 5 )
   {
     std::cerr
       << "Usage: " << argv[ 0 ]
-      << " input_image s_x s_y s_z thr_0 thr_1 n_samples" << std::endl;
+      << " input_image thr_0 thr_1 n_samples" << std::endl;
     return( 1 );
 
   } // fi
   std::string input_image_fn = argv[ 1 ];
-  TImage::PointType seed_pnt;
-  seed_pnt[ 0 ] = std::atof( argv[ 2 ] );
-  seed_pnt[ 1 ] = std::atof( argv[ 3 ] );
-  seed_pnt[ 2 ] = std::atof( argv[ 4 ] );
-  TPixel thr_0 = TPixel( std::atof( argv[ 5 ] ) );
-  TPixel thr_1 = TPixel( std::atof( argv[ 6 ] ) );
-  unsigned int n_samples = std::atoi( argv[ 7 ] );
+  TPixel thr_0 = TPixel( std::atof( argv[ 2 ] ) );
+  TPixel thr_1 = TPixel( std::atof( argv[ 3 ] ) );
+  unsigned int n_samples = std::atoi( argv[ 4 ] );
   
   // Read image
   TImageReader::Pointer input_image_reader = TImageReader::New( );
@@ -78,40 +74,43 @@ int main( int argc, char* argv[] )
   vtk_image->SetInput( input_image );
   vtk_image->Update( );
 
-  vtkSmartPointer< vtkSphereSource > seed =
-    vtkSmartPointer< vtkSphereSource >::New( );
-  seed->SetCenter( seed_pnt[ 0 ], seed_pnt[ 1 ], seed_pnt[ 2 ] );
-  seed->SetRadius( min_spac * double( 5 ) );
-  seed->Update( );
+  /* TODO
+     vtkSmartPointer< vtkSphereSource > seed =
+     vtkSmartPointer< vtkSphereSource >::New( );
+     seed->SetCenter( seed_pnt[ 0 ], seed_pnt[ 1 ], seed_pnt[ 2 ] );
+     seed->SetRadius( min_spac * double( 5 ) );
+     seed->Update( );
+  */
 
   fpa::VTK::ImageMPR view;
   view.SetBackground( 0.3, 0.2, 0.8 );
   view.SetSize( 800, 800 );
   view.SetImage( vtk_image->GetOutput( ) );
-  view.AddPolyData( seed->GetOutput( ), 1, 0, 0 );
+  // TODO: view.AddPolyData( seed->GetOutput( ), 1, 0, 0 );
   view.Start( );
 
   // Configure observer
-  TObserver::Pointer obs = TObserver::New( );
-  obs->SetImage( input_image, view.GetWindow( ) );
-
-  // Configure algorithm
-  TFrontAlgorithm::Pointer algorithm = TFrontAlgorithm::New( );
-  algorithm->AddThresholds( thr_0, thr_1, n_samples );
-
-  TImage::IndexType seed_idx;
-  input_image->TransformPhysicalPointToIndex( seed_pnt, seed_idx );
-  algorithm->AddSeed( seed_idx, 0 );
-
-  algorithm->AddObserver( itk::AnyEvent( ), obs );
-  algorithm->ThrowEventsOn( );
-  algorithm->SetInput( input_image );
-  algorithm->SetNeighborhoodOrder( 1 );
-  algorithm->SetDerivativeThreshold( double( 3 ) );
-  algorithm->Update( );
-
-  view.Start( );
-
+  /* TODO
+     TObserver::Pointer obs = TObserver::New( );
+     obs->SetImage( input_image, view.GetWindow( ) );
+
+     // Configure algorithm
+     TFrontAlgorithm::Pointer algorithm = TFrontAlgorithm::New( );
+     algorithm->AddThresholds( thr_0, thr_1, n_samples );
+
+     TImage::IndexType seed_idx;
+     input_image->TransformPhysicalPointToIndex( seed_pnt, seed_idx );
+     algorithm->AddSeed( seed_idx, 0 );
+
+     algorithm->AddObserver( itk::AnyEvent( ), obs );
+     algorithm->ThrowEventsOn( );
+     algorithm->SetInput( input_image );
+     algorithm->SetNeighborhoodOrder( 1 );
+     algorithm->SetDerivativeThreshold( double( 3 ) );
+     algorithm->Update( );
+
+     view.Start( );
+  */
   return( 0 );
 }