]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 14 Mar 2017 01:07:34 +0000 (20:07 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 14 Mar 2017 01:07:34 +0000 (20:07 -0500)
examples/CMakeLists.txt
libs/fpa/Image/MoriFilter.h [moved from libs/fpa/Image/MoriRegionGrow.h with 77% similarity]
libs/fpa/Image/MoriFilter.hxx [moved from libs/fpa/Image/MoriRegionGrow.hxx with 64% similarity]
libs/fpa/Image/MoriFilterHelper.h [moved from libs/fpa/Image/MoriRegionGrowHelper.h with 82% similarity]
libs/fpa/Image/MoriFilterHelper.hxx [moved from libs/fpa/Image/MoriRegionGrowHelper.hxx with 81% similarity]

index ddaadf3c5471fcfb3bd4c31b688d471a2827cf49..8205f496047cb84237541553ba978a126ed5bc87 100644 (file)
@@ -4,6 +4,10 @@ IF(BUILD_EXAMPLES)
     _examples
     BronchiiInitialSegmentationWithMori
     )
+  INCLUDE_DIRECTORIES(
+    ${PROJECT_SOURCE_DIR}/libs
+    ${PROJECT_BINARY_DIR}/libs
+    )
   FOREACH(_e ${_examples})
     ADD_EXECUTABLE(fpa_example_${_e} ${_e}.cxx)
     TARGET_LINK_LIBRARIES(fpa_example_${_e} ${ITK_LIBRARIES})
similarity index 77%
rename from libs/fpa/Image/MoriRegionGrow.h
rename to libs/fpa/Image/MoriFilter.h
index 41c122e32d9caf0c5d5cc89cdcb0e493ff23fb12..0707ff5c2bfb2934fc145deb9d793c744f5ed86f 100644 (file)
@@ -1,9 +1,9 @@
-#ifndef __fpa__Image__MoriRegionGrow__h__
-#define __fpa__Image__MoriRegionGrow__h__
+#ifndef __fpa__Image__MoriFilter__h__
+#define __fpa__Image__MoriFilter__h__
 
 #include <itkImageToImageFilter.h>
 #include <itkBinaryThresholdImageFilter.h>
-#include <fpa/Image/MoriRegionGrowHelper.h>
+#include <fpa/Image/MoriFilterHelper.h>
 
 namespace fpa
 {
@@ -12,17 +12,17 @@ namespace fpa
     /**
      */
     template< class _TInputImage, class _TOutputImage, class _TAuxPixel = unsigned short >
-    class MoriRegionGrow
+    class MoriFilter
       : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
     {
     public:
-      typedef MoriRegionGrow                                         Self;
+      typedef MoriFilter                                         Self;
       typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > Superclass;
       typedef itk::SmartPointer< Self >                              Pointer;
       typedef itk::SmartPointer< const Self >                        ConstPointer;
 
       typedef itk::Image< _TAuxPixel, _TInputImage::ImageDimension >      TAuxImage;
-      typedef fpa::Image::MoriRegionGrowHelper< _TInputImage, TAuxImage > THelper;
+      typedef fpa::Image::MoriFilterHelper< _TInputImage, TAuxImage > THelper;
       typedef itk::BinaryThresholdImageFilter< TAuxImage, _TOutputImage > TThreshold;
 
       typedef typename _TInputImage::IndexType  TIndex;
@@ -31,7 +31,7 @@ namespace fpa
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::MoriRegionGrow, itk::ImageToImageFilter );
+      itkTypeMacro( fpa::Image::MoriFilter, itk::ImageToImageFilter );
 
       itkGetConstMacro( Seed, TIndex );
       itkSetMacro( Seed, TIndex );
@@ -49,6 +49,10 @@ namespace fpa
       void SetLower( const TInputPixel& v );
       void SetUpper( const TInputPixel& v );
       void SetStep( const TInputPixel& v );
+      void SetThresholdRange(
+        const TInputPixel& l, const TInputPixel& u,
+        const TInputPixel& s = TInputPixel( 1 )
+        );
       void SetInsideValue( const TOutputPixel& v );
       void SetOutsideValue( const TOutputPixel& v );
 
@@ -65,14 +69,14 @@ namespace fpa
       */
 
     protected:
-      MoriRegionGrow( );
-      virtual ~MoriRegionGrow( );
+      MoriFilter( );
+      virtual ~MoriFilter( );
 
       virtual void GenerateData( ) override;
 
     private:
       // Purposely not defined
-      MoriRegionGrow( const Self& other );
+      MoriFilter( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
@@ -86,9 +90,9 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MoriRegionGrow.hxx>
+#  include <fpa/Image/MoriFilter.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Image__MoriRegionGrow__h__
+#endif // __fpa__Image__MoriFilter__h__
 
 // eof - $RCSfile$
similarity index 64%
rename from libs/fpa/Image/MoriRegionGrow.hxx
rename to libs/fpa/Image/MoriFilter.hxx
index 737bf1f79d15acb515c1d9fb6f94a2f959c80bb3..9f822c9ea9d22bd6234ddd1a823266b2727c6680 100644 (file)
@@ -1,12 +1,12 @@
-#ifndef __fpa__Image__MoriRegionGrow__hxx__
-#define __fpa__Image__MoriRegionGrow__hxx__
+#ifndef __fpa__Image__MoriFilter__hxx__
+#define __fpa__Image__MoriFilter__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetAuxiliaryImage( )
 {
   return( this->m_Helper->GetOutput( ) );
@@ -15,9 +15,9 @@ GetAuxiliaryImage( )
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 const typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetAuxiliaryImage( ) const
 {
   return( this->m_Helper->GetOutput( ) );
@@ -26,9 +26,9 @@ GetAuxiliaryImage( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetLower( ) const
 {
   return( this->m_Helper->GetLower( ) );
@@ -37,9 +37,9 @@ GetLower( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetUpper( ) const
 {
   return( this->m_Helper->GetUpper( ) );
@@ -48,9 +48,9 @@ GetUpper( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetStep( ) const
 {
   return( this->m_Helper->GetStep( ) );
@@ -59,9 +59,9 @@ GetStep( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetInsideValue( ) const
 {
   return( this->m_Threshold->GetInsideValue( ) );
@@ -70,9 +70,9 @@ GetInsideValue( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
 typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GetOutsideValue( ) const
 {
   return( this->m_Threshold->GetInsideValue( ) );
@@ -80,7 +80,7 @@ GetOutsideValue( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 SetLower( const TInputPixel& v )
 {
   this->m_Helper->SetLower( v );
@@ -89,7 +89,7 @@ SetLower( const TInputPixel& v )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 SetUpper( const TInputPixel& v )
 {
   this->m_Helper->SetUpper( v );
@@ -98,7 +98,7 @@ SetUpper( const TInputPixel& v )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 SetStep( const TInputPixel& v )
 {
   this->m_Helper->SetStep( v );
@@ -107,7 +107,19 @@ SetStep( const TInputPixel& v )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+SetThresholdRange(
+  const TInputPixel& l, const TInputPixel& u, const TInputPixel& s
+  )
+{
+  this->SetLower( l );
+  this->SetUpper( u );
+  this->SetStep( s );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 SetInsideValue( const TOutputPixel& v )
 {
   this->m_Threshold->SetInsideValue( v );
@@ -116,7 +128,7 @@ SetInsideValue( const TOutputPixel& v )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 SetOutsideValue( const TOutputPixel& v )
 {
   this->m_Threshold->SetOutsideValue( v );
@@ -125,8 +137,8 @@ SetOutsideValue( const TOutputPixel& v )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-MoriRegionGrow( )
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+MoriFilter( )
   : Superclass( )
 {
   this->m_Helper = THelper::New( );
@@ -135,18 +147,18 @@ MoriRegionGrow( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-~MoriRegionGrow( )
+fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
+~MoriFilter( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
+void fpa::Image::MoriFilter< _TInputImage, _TOutputImage, _TAuxPixel >::
 GenerateData( )
 {
   this->m_Helper->ClearSeeds( );
-  this->m_Helper->AddSeed( this->m_Seed, 0 );
+  this->m_Helper->AddSeed( this->m_Seed, this->GetOutsideValue( ) );
   this->m_Helper->SetInput( this->GetInput( ) );
   this->m_Helper->Update( );
 
@@ -157,6 +169,6 @@ GenerateData( )
   this->GetOutput( )->Graft( this->m_Threshold->GetOutput( ) );
 }
 
-#endif // __fpa__Image__MoriRegionGrow__hxx__
+#endif // __fpa__Image__MoriFilter__hxx__
 
 // eof - $RCSfile$
similarity index 82%
rename from libs/fpa/Image/MoriRegionGrowHelper.h
rename to libs/fpa/Image/MoriFilterHelper.h
index 02f51b6bdb3276ac338aa27f7117dfc9f906f94c..6d55ec7cb6d10b5b4f78a5b4a021f77879574fb2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __fpa__Image__MoriRegionGrowHelper__h__
-#define __fpa__Image__MoriRegionGrowHelper__h__
+#ifndef __fpa__Image__MoriFilterHelper__h__
+#define __fpa__Image__MoriFilterHelper__h__
 
 #include <utility>
 #include <vector>
@@ -13,11 +13,11 @@ namespace fpa
     /**
      */
     template< class _TInputImage, class _TOutputImage >
-    class MoriRegionGrowHelper
+    class MoriFilterHelper
       : public fpa::Image::RegionGrow< _TInputImage, _TOutputImage >
     {
     public:
-      typedef MoriRegionGrowHelper                                        Self;
+      typedef MoriFilterHelper                                        Self;
       typedef fpa::Image::RegionGrow< _TInputImage, _TOutputImage > Superclass;
       typedef itk::SmartPointer< Self >                             Pointer;
       typedef itk::SmartPointer< const Self >                       ConstPointer;
@@ -37,7 +37,7 @@ namespace fpa
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::MoriRegionGrowHelper, fpa::Image::RegionGrow );
+      itkTypeMacro( fpa::Image::MoriFilterHelper, fpa::Image::RegionGrow );
 
       itkGetConstMacro( Lower, TPixel );
       itkGetConstMacro( Upper, TPixel );
@@ -50,8 +50,8 @@ namespace fpa
 
 
     protected:
-      MoriRegionGrowHelper( );
-      virtual ~MoriRegionGrowHelper( );
+      MoriFilterHelper( );
+      virtual ~MoriFilterHelper( );
 
       virtual bool _ContinueGenerateData( ) override;
       virtual void _BeforeGenerateData( ) override;
@@ -63,7 +63,7 @@ namespace fpa
 
     private:
       // Purposely not defined
-      MoriRegionGrowHelper( const Self& other );
+      MoriFilterHelper( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
@@ -82,9 +82,9 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MoriRegionGrowHelper.hxx>
+#  include <fpa/Image/MoriFilterHelper.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Image__MoriRegionGrowHelper__h__
+#endif // __fpa__Image__MoriFilterHelper__h__
 
 // eof - $RCSfile$
similarity index 81%
rename from libs/fpa/Image/MoriRegionGrowHelper.hxx
rename to libs/fpa/Image/MoriFilterHelper.hxx
index 9dc1df3f713891f0b8289f42d3a17a239f1fa439..4ddb234232a1019a0396231e703fedfe94fcfeea 100644 (file)
@@ -1,10 +1,10 @@
-#ifndef __fpa__Image__MoriRegionGrowHelper__hxx__
-#define __fpa__Image__MoriRegionGrowHelper__hxx__
+#ifndef __fpa__Image__MoriFilterHelper__hxx__
+#define __fpa__Image__MoriFilterHelper__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-MoriRegionGrowHelper( )
+fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
+MoriFilterHelper( )
   : Superclass( ),
     m_Step( TPixel( 1 ) )
 {
@@ -20,14 +20,14 @@ MoriRegionGrowHelper( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-~MoriRegionGrowHelper( )
+fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
+~MoriFilterHelper( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+bool fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _ContinueGenerateData( )
 {
   TBinThresholdFunction* functor =
@@ -36,6 +36,7 @@ _ContinueGenerateData( )
 
   // Update flooding data
   this->m_Curve.push_back( TCurveData( u, this->m_ActualCount ) );
+  std::cout << u << " " << this->m_ActualCount << std::endl;
 
   // Update thresholds
   if( u < this->m_Upper )
@@ -55,7 +56,7 @@ _ContinueGenerateData( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _BeforeGenerateData( )
 {
   this->Superclass::_BeforeGenerateData( );
@@ -73,7 +74,7 @@ _BeforeGenerateData( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _AfterGenerateData( )
 {
   typedef typename _TOutputImage::PixelType _TOut;
@@ -102,7 +103,7 @@ _AfterGenerateData( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _BeforeLoop( )
 {
   this->Superclass::_BeforeLoop( );
@@ -110,7 +111,7 @@ _BeforeLoop( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _AfterLoop( )
 {
   this->Superclass::_AfterLoop( );
@@ -118,7 +119,7 @@ _AfterLoop( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+bool fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _UpdateValue( _TQueueNode& v, const _TQueueNode& p )
 {
   typedef typename _TOutputImage::PixelType _TOut;
@@ -132,13 +133,13 @@ _UpdateValue( _TQueueNode& v, const _TQueueNode& p )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
+void fpa::Image::MoriFilterHelper< _TInputImage, _TOutputImage >::
 _UpdateResult( const _TQueueNode& n )
 {
   this->Superclass::_UpdateResult( n );
   this->m_ActualCount += 1;
 }
 
-#endif // __fpa__Image__MoriRegionGrowHelper__hxx__
+#endif // __fpa__Image__MoriFilterHelper__hxx__
 
 // eof - $RCSfile$