]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 6 Apr 2017 17:15:39 +0000 (12:15 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 6 Apr 2017 17:15:39 +0000 (12:15 -0500)
lib/fpa/Base/PriorityQueueAlgorithm.h
plugins/ImageAlgorithms/ImageAlgorithms.i
plugins/ImageAlgorithms/SkeletonFilter.cxx [new file with mode: 0644]
plugins/ImageAlgorithms/SkeletonFilter.h [new file with mode: 0644]

index e34b82391e3e1729035df4d1d67257b164104494..0e79396a5c96678c5e460d1f1f5de9679f1db49d 100644 (file)
@@ -2,6 +2,7 @@
 #define __fpa__Base__PriorityQueueAlgorithm__h__
 
 #include <queue>
+#include <itkObject.h>
 
 namespace fpa
 {
index a805d13fe35953b5bf916c20fd234aa24f95cda9..810cc823c2d32c8c0f5a3f9318690ca5e64825ff 100644 (file)
@@ -16,8 +16,8 @@ header #define ITK_MANUAL_INSTANTIATION
 *tinclude fpa/Image/Dijkstra:h|hxx
 *instances fpa::Image::Dijkstra< itk::Image< #scalar_types#, #pdims# >, itk::Image< #real_types#, #pdims# > >
 
-*tinclude fpa/Image/SkeletonFilter:h|hxx
-*instances fpa::Image::SkeletonFilter< itk::Image< #real_types#, #pdims# > >
+tinclude fpa/Image/SkeletonFilter:h|hxx
+instances fpa::Image::SkeletonFilter< itk::Image< #real_types#, #pdims# > >
 
 
 
diff --git a/plugins/ImageAlgorithms/SkeletonFilter.cxx b/plugins/ImageAlgorithms/SkeletonFilter.cxx
new file mode 100644 (file)
index 0000000..274dc65
--- /dev/null
@@ -0,0 +1,82 @@
+#include "SkeletonFilter.h"
+#include <cpInstances/DataObjects/Image.h>
+#include <cpInstances/DataObjects/Skeleton.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageAlgorithms::SkeletonFilter::
+SkeletonFilter( )
+  : Superclass( )
+{
+  typedef cpPlugins::Pipeline::DataObject    _TData;
+  typedef cpInstances::DataObjects::Image    _TImage;
+  typedef cpInstances::DataObjects::Skeleton _TSkeleton;
+
+  this->_ConfigureInput< _TImage >( "Input", true, false );
+  this->_ConfigureInput< _TData >( "Seeds", true, false );
+  this->_ConfigureOutput< _TSkeleton >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageAlgorithms::SkeletonFilter::
+~SkeletonFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageAlgorithms::SkeletonFilter::
+_GenerateData( )
+{
+  /* TODO
+     typedef fpa::Image::MinimumSpanningTree< 2 > _TMST2;
+     typedef fpa::Image::MinimumSpanningTree< 3 > _TMST3;
+
+     auto mst2 = this->GetInputData< _TMST2 >( "MST" );
+     auto mst3 = this->GetInputData< _TMST3 >( "MST" );
+     if     ( mst2 != NULL ) this->_GD0( mst2 );
+     else if( mst3 != NULL ) this->_GD0( mst3 );
+     else this->_Error( "Invalid input spanning tree." );
+  */
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void fpaPlugins_ImageAlgorithms::SkeletonFilter::
+_GD0( _TImage* image )
+{
+  /* TODO
+     typedef typename _TMST::IndexType _TIndex;
+     typedef typename _TMST::TPath     _TPath;
+
+     // Get seeds
+     std::vector< _TIndex > seeds;
+     auto points = this->GetInputData< vtkPolyData >( "Seeds" );
+     if( points != NULL )
+     {
+     if( points->GetNumberOfPoints( ) < 2 )
+     this->_Error( "Not enough seeds (<2)." );
+
+     typename _TMST::PointType pnt;
+     typename _TMST::IndexType idx;
+     unsigned int dim =
+     ( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
+     for( unsigned int i = 0; i < 2; ++i )
+     {
+     double buf[ 3 ];
+     points->GetPoint( i, buf );
+     pnt.Fill( 0 );
+     for( unsigned int d = 0; d < dim; ++d )
+     pnt[ d ] = buf[ d ];
+     if( mst->TransformPhysicalPointToIndex( pnt, idx ) )
+     seeds.push_back( idx );
+
+     } // rof
+
+     } // fi
+
+     typename _TPath::Pointer path;
+     mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
+     this->GetOutput( "Output" )->SetITK( path );
+  */
+}
+
+// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/SkeletonFilter.h b/plugins/ImageAlgorithms/SkeletonFilter.h
new file mode 100644 (file)
index 0000000..3ebce45
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __fpaPlugins_ImageAlgorithms__SkeletonFilter__h__
+#define __fpaPlugins_ImageAlgorithms__SkeletonFilter__h__
+
+#include <fpaPlugins_ImageAlgorithms_Export.h>
+#include <cpPlugins/Pipeline/ProcessObject.h>
+
+namespace fpaPlugins_ImageAlgorithms
+{
+  /**
+   */
+  class fpaPlugins_ImageAlgorithms_EXPORT SkeletonFilter
+    : public cpPlugins::Pipeline::ProcessObject
+  {
+    cpPluginsObject(
+      SkeletonFilter,
+      cpPlugins::Pipeline::ProcessObject,
+      fpaImageAlgorithms
+      );
+
+  protected:
+    template< class _TImage >
+    inline void _GD0( _TImage* image );
+  };
+
+} // ecapseman
+
+#endif // __fpaPlugins_ImageAlgorithms__SkeletonFilter__h__
+
+// eof - $RCSfile$