From: Leonardo Flórez-Valencia Date: Thu, 1 Dec 2016 22:52:13 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f0bdca8b1ef73eb4e7ac05eb32182af25ac6bdc7;p=FrontAlgorithms.git ... --- diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 8a67217..9e419ed 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -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 index 0000000..d81b6f1 --- /dev/null +++ b/plugins/Experiments/InsertNoiseIntoPoints.cxx @@ -0,0 +1,89 @@ +#include +#include + +#include +#include +#include +#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 index 0000000..e7fd10f --- /dev/null +++ b/plugins/Experiments/InsertNoiseIntoPoints.h @@ -0,0 +1,25 @@ +#ifndef __fpaPluginsExperiments__InsertNoiseIntoPoints__h__ +#define __fpaPluginsExperiments__InsertNoiseIntoPoints__h__ + +#include +#include + +namespace fpaPluginsExperiments +{ + /** + */ + class fpaPluginsExperiments_EXPORT InsertNoiseIntoPoints + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( + InsertNoiseIntoPoints, + cpPlugins::BaseObjects::ProcessObject, + fpaExperiments + ); + }; + +} // ecapseman + +#endif // __fpaPluginsExperiments__InsertNoiseIntoPoints__h__ + +// eof - $RCSfile$