]> Creatis software - FrontAlgorithms.git/blobdiff - appli/CTBronchi/Process.cxx
...
[FrontAlgorithms.git] / appli / CTBronchi / Process.cxx
index 848a1f03673b51cd16602e377621bb891bbed3af..e169148bb790c8441d6ba1314731a8fdd970acf0 100644 (file)
 #include <itkImageFileReader.h>
 #include <itkImageFileWriter.h>
 #include <fpa/Filters/Image/Mori.h>
+#include <fpa/Filters/Image/RandomWalker.h>
+#include <fpa/Functors/Dijkstra/Image/Gaussian.h>
 #include <CTBronchi/MoriLabelling.h>
 
 // -------------------------------------------------------------------------
 const unsigned int Dim = 3;
 typedef short         TInputPixel;
 typedef unsigned char TLabelPixel;
+typedef float         TScalar;
 typedef itk::Image< TInputPixel, Dim > TInputImage;
 typedef itk::Image< TLabelPixel, Dim > TLabelImage;
+typedef itk::Image< TScalar, Dim >     TScalarImage;
 typedef std::map< std::string, std::string > TMap;
 
 // -------------------------------------------------------------------------
 TMap Args;
 TInputImage::PointType global_seed;
-TLabelPixel inside_value = std::numeric_limits< TLabelPixel >::max( );
+TLabelPixel inside_value = TLabelPixel( 1 );
 TLabelPixel outside_value = TLabelPixel( 0 );
+TLabelPixel inside_label = TLabelPixel( 1 );
+TLabelPixel outside_label = TLabelPixel( 2 );
 
 // -------------------------------------------------------------------------
 double MeasureTime( itk::ProcessObject* f )
@@ -142,9 +148,12 @@ void Label( _TOutputPtr& output, const _TInputPtr& input, const _TOutputPtr& lab
   typename _TLabelling::Pointer labelling = _TLabelling::New( );
   labelling->SetInput( input );
   labelling->SetInputLabels( labels );
-  // TODO: labelling->SetOutsideValue( ); // out label
-  // TODO: labelling->SetInsideValue( ); // inside label
-  // TODO: labelling->SetUpperThreshold( );
+  labelling->SetOutsideValue( outside_label );
+  labelling->SetInsideValue( inside_label );
+  labelling->SetInputInsideValue( inside_value );
+  labelling->SetUpperThreshold(
+    TInputPixel( std::atof( Args[ "labelling_upper_threshold" ].c_str( ) ) )
+    );
   double t = MeasureTime( labelling );
   std::cout << "Labelling executed in " << t << " s" << std::endl;
   output = labelling->GetOutput( );
@@ -154,6 +163,14 @@ void Label( _TOutputPtr& output, const _TInputPtr& input, const _TOutputPtr& lab
   output->DisconnectPipeline( );
 }
 
+// -------------------------------------------------------------------------
+template< class _TRawPtr, class _TLabelPtr >
+void RandomWalker( _TLabelPtr& output, const _TRawPtr& raw, const _TLabelPtr& labels )
+{
+  typedef typename _TRawPtr::ObjectType  _TRaw;
+  typedef typename _TLabelPtr::ObjectType _TLabel;
+}
+
 // -------------------------------------------------------------------------
 bool ParseArgs( int argc, char* argv[] )
 {
@@ -171,6 +188,8 @@ bool ParseArgs( int argc, char* argv[] )
   Args[ "mori_lower_threshold" ] = "-1024";
   Args[ "mori_upper_threshold" ] = "0";
   Args[ "mori_delta_threshold" ] = "1";
+  Args[ "labelling_upper_threshold" ] = "-400";
+
   for( int i = 1; i < argc; i += 2 )
     Args[ argv[ i ] + 1 ] = argv[ i + 1 ];
 
@@ -194,7 +213,8 @@ bool ParseArgs( int argc, char* argv[] )
       << "\t[-mori_signal_influence value]" << std::endl
       << "\t[-mori_lower_threshold value]" << std::endl
       << "\t[-mori_upper_threshold value]" << std::endl
-      << "\t[-mori_delta_threshold value]" << std::endl;
+      << "\t[-mori_delta_threshold value]" << std::endl
+      << "\t[-labelling_upper_threshold value]" << std::endl;
     return( false );
 
   } // fi