]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 22:52:13 +0000 (17:52 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 22:52:13 +0000 (17:52 -0500)
plugins/CMakeLists.txt
plugins/Experiments/InsertNoiseIntoPoints.cxx [new file with mode: 0644]
plugins/Experiments/InsertNoiseIntoPoints.h [new file with mode: 0644]

index 8a672172ddb183a9f7a27eef39986a9e451a6512..9e419ed498ffd677d06750756f8968ffc2a3eb66 100644 (file)
@@ -16,13 +16,18 @@ IF(USE_cpPlugins)
     RegionGrowFunctors
     DijkstraFunctors
     )
+  OPTION(BUILD_ExperimentationPlugins "Build plugins for experimentation?" OFF)
+  IF(BUILD_ExperimentationPlugins)
+    LIST(APPEND _dirs Experiments)
+  ENDIF(BUILD_ExperimentationPlugins)
+
   FOREACH(_d ${_dirs})
     CreatePlugin(
       fpaPlugins${_d} ${CMAKE_CURRENT_SOURCE_DIR}/${_d}
       )
     TARGET_LINK_LIBRARIES(
       fpaPlugins${_d}
-      cpPlugins cpPluginsDataObjects
+      cpPlugins cpPluginsDataObjects cpExtensions
       ${fpa_AllInstances}
       )
   ENDFOREACH(_d)
diff --git a/plugins/Experiments/InsertNoiseIntoPoints.cxx b/plugins/Experiments/InsertNoiseIntoPoints.cxx
new file mode 100644 (file)
index 0000000..d81b6f1
--- /dev/null
@@ -0,0 +1,89 @@
+#include <Experiments/InsertNoiseIntoPoints.h>
+#include <cpInstances/Image.h>
+
+#include <random>
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
+#error http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution
+// -------------------------------------------------------------------------
+fpaPluginsExperiments::InsertNoiseIntoPoints::
+InsertNoiseIntoPoints( )
+  : Superclass( )
+{
+  typedef cpInstances::Image _TImage;
+  typedef cpPlugins::BaseObjects::DataObject _TData;
+
+  this->_ConfigureInput< _TData >( "Seeds", true, false );
+  this->_ConfigureInput< _TImage >( "DistanceMap", true, false );
+  this->_ConfigureOutput< _TData >( "Output" );
+  this->m_Parameters.ConfigureAsUint( "NumberOfSamples", 0 );
+}
+
+// -------------------------------------------------------------------------
+fpaPluginsExperiments::InsertNoiseIntoPoints::
+~InsertNoiseIntoPoints( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPluginsExperiments::InsertNoiseIntoPoints::
+_GenerateData( )
+{
+  auto dmap = this->GetInputData< vtkImageData >( "DistanceMap" );
+  auto seeds = this->GetInputData< vtkPolyData >( "Seeds" );
+  for( int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
+  {
+    double buf[ 3 ], pcoords[ 3 ];
+    seeds->GetPoint( i, buf );
+    int ijk[ 3 ];
+    dmap->ComputeStructuredCoordinates( buf, ijk, pcoords );
+    double radius =
+      dmap->GetScalarComponentAsDouble( ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], 0 );
+
+  } // rof
+
+  /* TODO
+     cpPlugins_Demangle_Image_RealPixels_AllDims_1( o, _GD0 )
+     this->_Error( "Invalid input image." );
+  */
+}
+
+// -------------------------------------------------------------------------
+/* TODO
+   template< class _TImage >
+   void fpaPluginsExperiments::InsertNoiseIntoPoints::
+   _GD0( _TImage* image )
+   {
+   typedef fpa::Image::InsertNoiseIntoPoints< _TImage > _TFilter;
+   auto filter = this->_CreateITK< _TFilter >( );
+   filter->SetInput( image );
+
+   if( seeds != NULL )
+   {
+   typename _TImage::PointType pnt;
+   typename _TImage::IndexType idx;
+   unsigned int dim =
+   ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+
+   for( int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
+   {
+   double buf[ 3 ];
+   seeds->GetPoint( i, buf );
+   pnt.Fill( 0 );
+   for( unsigned int d = 0; d < dim; ++d )
+   pnt[ d ] = buf[ d ];
+
+   if( image->TransformPhysicalPointToIndex( pnt, idx ) )
+   filter->AddSeed( idx, 0 );
+
+   } // rof
+
+   } // fi
+
+   filter->Update( );
+   this->GetOutput( "Skeleton" )->SetITK( filter->GetSkeleton( ) );
+   this->GetOutput( "Marks" )->SetITK( filter->GetMarks( ) );
+   }
+*/
+
+// eof - $RCSfile$
diff --git a/plugins/Experiments/InsertNoiseIntoPoints.h b/plugins/Experiments/InsertNoiseIntoPoints.h
new file mode 100644 (file)
index 0000000..e7fd10f
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
+#define __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
+
+#include <fpaPluginsExperiments_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace fpaPluginsExperiments
+{
+  /**
+   */
+  class fpaPluginsExperiments_EXPORT InsertNoiseIntoPoints
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      InsertNoiseIntoPoints,
+      cpPlugins::BaseObjects::ProcessObject,
+      fpaExperiments
+      );
+  };
+
+} // ecapseman
+
+#endif // __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
+
+// eof - $RCSfile$