]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 13 Jul 2017 21:15:46 +0000 (16:15 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 13 Jul 2017 21:15:46 +0000 (16:15 -0500)
appli/CTBronchi/CTBronchi_process.sh
appli/CTBronchi/RandomWalker.cxx
cmake/fpaConfig.cmake.in
lib/fpa/Image/Functors/Dijkstra/Gaussian.h
lib/fpa/Image/MinimumSpanningTree.h
tests/image/Dijkstra_Gaussian.cxx
tests/image/RandomWalker.cxx

index 15bd591fbec02d00802ef15c89f5ab856337a584..26257bed106938519023c01fe7ddb6cedbc1829c 100755 (executable)
@@ -36,7 +36,6 @@ label_inside=1
 label_outside=2
 
 random_walker_output_image="$base_name"_rw.mhd
-random_walker_alpha=0
 random_walker_beta=20
 
 $mori_seg \
@@ -63,7 +62,6 @@ $mori_lab \
 $random_walker \
     $input_image $labels_output_image $random_walker_output_image \
     $label_inside \
-    $random_walker_alpha \
     $random_walker_beta
 
 ## eof - $RCSfile$
index 57045586197710f4909a850f1bff2a35380c027a..561dd36e4b1a1af80601cb686c0cf01d20e6aed5 100644 (file)
@@ -29,12 +29,12 @@ typedef ivq::ITK::ImageUnaryFunctionFilter< TLabelImage, TBinaryImage > TLabelEx
 int main( int argc, char* argv[] )
 {
   // Get arguments
-  if( argc < 7 )
+  if( argc < 6 )
   {
     std::cerr
       << "Usage: " << argv[ 0 ] << std::endl
       << "   input_image label_image output_image" << std::endl
-      << "   label alpha(0) beta(100)"
+      << "   label beta(100)"
       << std::endl;
     return( 1 );
 
@@ -43,8 +43,7 @@ int main( int argc, char* argv[] )
   std::string label_image_filename = argv[ 2 ];
   std::string output_image_filename = argv[ 3 ];
   TLabel label = TLabel( std::atoi( argv[ 4 ] ) );
-  double alpha = std::atof( argv[ 5 ] );
-  double beta = std::atof( argv[ 6 ] );
+  double beta = std::atof( argv[ 5 ] );
 
   // Read images
   itk::ImageFileReader< TInputImage >::Pointer input_image_reader =
@@ -57,7 +56,6 @@ int main( int argc, char* argv[] )
 
   // Prepare weight
   TWeight::Pointer weight = TWeight::New( );
-  weight->SetAlpha( alpha );
   weight->SetBeta( beta );
 
   // Prepare filter
index 62a9a8c24c364b62b7d2bfb5e708829f40713c0d..f019632dcbd8844ddee0093c1d48dcb60f7684cf 100644 (file)
@@ -7,9 +7,6 @@ check_required_components("@PROJECT_NAME@")
 ## == Find needed packages and dependencies ==
 ## ===========================================
 
-set(ITK_DIR @ITK_DIR@)
-
-find_package(ITK CONFIG REQUIRED)
-include(${ITK_USE_FILE})
+find_package(ivq CONFIG REQUIRED)
 
 ## eof - $RCSfile$
index 5187312b0287008c67a3bae24e2383ea68d25463..d06d84d3084ed8b0c012bf1f1d2a97b42e59ea18 100644 (file)
@@ -18,6 +18,7 @@ namespace fpa
       namespace Dijkstra
       {
         /**
+         * w_{i,j}=\left(\exp\left(\left(\frac{w_{i}-w_{j}}{\beta}\right)^{2}\right)-1\right)^{\alpha}
          */
         template< class _TInputImage, class _TOutputValue >
         class Gaussian
@@ -38,36 +39,22 @@ namespace fpa
             fpa::Image::Functors::Dijkstra::Function
             );
 
-        public:
-          double GetAlpha( ) const
-            {
-              return( double( 1 ) - this->m_Alpha );
-            }
-          double GetBeta( ) const
-            {
-              return( std::sqrt( this->m_Beta ) );
-            }
-          void SetAlpha( const double& v )
-            {
-              this->m_Alpha = double( 1 ) - v;
-              this->Modified( );
-            }
-          void SetBeta( const double& v )
-            {
-              this->m_Beta = v * v;
-              this->Modified( );
-            }
+          itkGetConstMacro( Alpha, double );
+          itkSetMacro( Alpha, double );
 
+          itkGetConstMacro( Beta, double );
+          itkSetMacro( Beta, double );
+
+        public:
           virtual _TOutputValue Evaluate(
             const TVertex& v, const TVertex& p
             ) const override
             {
               double d = double( this->m_Image->GetPixel( v ) );
               d       -= double( this->m_Image->GetPixel( p ) );
-              d = ( d * d ) / this->m_Beta;
-              return(
-                _TOutputValue( double( 1 ) - ( this->m_Alpha * std::exp( -d ) ) )
-                );
+              d       /= this->m_Beta;
+              d = std::exp( d * d ) - double( 1 );
+              return( _TOutputValue( std::pow( d, this->m_Alpha ) ) );
             }
 
         protected:
index a93157cac6acb00c3b4d524f66d12e66981af8db..46d2231fc5dab68cf84246bce0f65582a4800395 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <fpa/Base/MinimumSpanningTree.h>
 #include <itkImage.h>
+#include <fpa/Image/PolyLineParametricPath.h>
 
 namespace fpa
 {
@@ -33,6 +34,8 @@ namespace fpa
       typedef typename Superclass::TCollisions    TCollisions;
       typedef typename Superclass::TVertices      TVertices;
 
+      typedef fpa::Image::PolyLineParametricPath< _VDim > TPolyLineParametricPath;
+
     public:
       itkNewMacro( Self );
       itkTypeMacro(
@@ -50,6 +53,15 @@ namespace fpa
           this->SetPixel( v, p - v );
         }
 
+      void GetPath(
+        typename TPolyLineParametricPath::Pointer& path,
+        const TVertex& a
+        ) const;
+      void GetPath(
+        typename TPolyLineParametricPath::Pointer& path,
+        const TVertex& a, const TVertex& b
+        ) const;
+
     protected:
       MinimumSpanningTree( )
         : Superclass( )
@@ -66,6 +78,10 @@ namespace fpa
 
 } // ecapseman
 
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Image/MinimumSpanningTree.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
 #endif // __fpa__Image__MinimumSpanningTree__h__
 
 // eof - $RCSfile$
index 1e147c6102dcf56cc87aee7811ff9d2aeb104660..5622e7f28c0a8e412e13b923d0734276f0c89c21 100644 (file)
@@ -4,9 +4,9 @@
 #include <fpa/Image/Functors/Dijkstra/Gaussian.h>
 
 // -------------------------------------------------------------------------
-const unsigned int Dim = 2;
-typedef unsigned char TPixel;
-typedef float         TScalar;
+const unsigned int Dim = 3;
+typedef short TPixel;
+typedef float TScalar;
 
 typedef itk::Image< TPixel, Dim >                                    TInputImage;
 typedef itk::Image< TScalar, Dim >                                  TScalarImage;
@@ -56,13 +56,14 @@ int main( int argc, char* argv[] )
   filter->SetStopAtOneFront( stop_at_one_front );
 
   // Get all seeds
-  for( int i = 7; i < argc; i += 2 )
+  for( int i = 7; i < argc; i += 3 )
   {
     if( i + 1 < argc )
     {
       TInputImage::IndexType seed;
       seed[ 0 ] = std::atoi( argv[ i ] );
       seed[ 1 ] = std::atoi( argv[ i + 1 ] );
+      seed[ 2 ] = std::atoi( argv[ i + 2 ] );
       filter->AddSeed( seed );
 
     } // fi
index 45a15c16dff4fa8a1b015c992d580b5c12ef4173..6bdca1cbf4a7e0b74e757ddec19442ee0216be5f 100644 (file)
@@ -18,12 +18,12 @@ typedef fpa::Image::Functors::Dijkstra::Gaussian< TInputImage, TScalar > TWeight
 int main( int argc, char* argv[] )
 {
   // Get arguments
-  if( argc < 7 )
+  if( argc < 6 )
   {
     std::cerr
       << "Usage: " << argv[ 0 ]
       << " input_image labels_image output_image output_costs"
-      << " alpha beta"
+      << " beta"
       << std::endl;
     return( 1 );
 
@@ -32,8 +32,7 @@ int main( int argc, char* argv[] )
   std::string labels_image_filename = argv[ 2 ];
   std::string output_image_filename = argv[ 3 ];
   std::string output_costs_filename = argv[ 4 ];
-  double alpha = std::atof( argv[ 5 ] );
-  double beta = std::atof( argv[ 6 ] );
+  double beta = std::atof( argv[ 5 ] );
 
   // Read image
   TInputImage::Pointer image;
@@ -57,7 +56,6 @@ int main( int argc, char* argv[] )
 
   // Prepare weight
   TWeight::Pointer weight = TWeight::New( );
-  weight->SetAlpha( alpha );
   weight->SetBeta( beta );
 
   // Prepare filter