## == Build different parts ==
## ===========================
-subdirs(lib)
+subdirs(examples lib)
## ===============================
## == Global installation rules ==
-OPTION(BUILD_EXAMPLES "Build cpPlugins-free examples." OFF)
-IF(BUILD_EXAMPLES)
- SET(
+option(BUILD_EXAMPLES "Build cpPlugins-free examples." OFF)
+if(BUILD_EXAMPLES)
+ set(
_examples
RegionGrow_Tautology
RegionGrow_BinaryThreshold
#BronchiiInitialSegmentationWithMori
#BronchiiInitialSegmentationWithBinaryThresholdRegionGrow
)
- OPTION(BUILD_EXAMPLE_SANDBOX "Build sandbox example." OFF)
- IF(BUILD_EXAMPLE_SANDBOX)
- LIST(APPEND _examples sandbox)
- ENDIF(BUILD_EXAMPLE_SANDBOX)
- INCLUDE_DIRECTORIES(
- ${PROJECT_SOURCE_DIR}/libs
- ${PROJECT_BINARY_DIR}/libs
+ option(BUILD_EXAMPLE_SANDBOX "Build sandbox example." OFF)
+ if(BUILD_EXAMPLE_SANDBOX)
+ list(APPEND _examples sandbox)
+ endif(BUILD_EXAMPLE_SANDBOX)
+ include_directories(
+ ${PROJECT_SOURCE_DIR}/lib
+ ${PROJECT_BINARY_DIR}/lib
)
- FOREACH(_e ${_examples})
- ADD_EXECUTABLE(fpa_example_${_e} ${_e}.cxx)
- TARGET_LINK_LIBRARIES(fpa_example_${_e} ${ITK_LIBRARIES})
- ENDFOREACH(_e)
-ENDIF(BUILD_EXAMPLES)
+ foreach(_e ${_examples})
+ add_executable(fpa_example_${_e} ${_e}.cxx)
+ target_link_libraries(fpa_example_${_e} ${ITK_LIBRARIES})
+ endforeach(_e)
+endif(BUILD_EXAMPLES)
## eof - $RCSfile$
int main( int argc, char* argv[] )
{
// Get arguments
- if( argc < 7 + VDim )
+ if( argc < 6 + VDim )
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " input_image output_image auxiliary_image lower upper delta";
+ << " input_image output_image lower upper delta";
for( unsigned int i = 0; i < VDim; ++i )
std::cerr << " s_" << i;
std::cerr << std::endl;
} // fi
std::string input_image_filename = argv[ 1 ];
std::string output_image_filename = argv[ 2 ];
- std::string auxiliary_image_filename = argv[ 3 ];
- TPixel lower = std::atof( argv[ 4 ] );
- TPixel upper = std::atof( argv[ 5 ] );
- TPixel delta = std::atof( argv[ 6 ] );
+ TPixel lower = std::atof( argv[ 3 ] );
+ TPixel upper = std::atof( argv[ 4 ] );
+ TPixel delta = std::atof( argv[ 5 ] );
TReader::Pointer reader = TReader::New( );
reader->SetFileName( input_image_filename );
filter->SetThresholdRange( lower, upper, delta );
TImage::PointType pnt;
for( int i = 0; i < VDim; ++i )
- pnt[ i ] = std::atof( argv[ i + 7 ] );
+ pnt[ i ] = std::atof( argv[ i + 6 ] );
TImage::IndexType seed;
if( !( reader->GetOutput( )->TransformPhysicalPointToIndex( pnt, seed ) ) )
TWriter::Pointer writer = TWriter::New( );
writer->SetInput( threshold->GetOutput( ) );
writer->SetFileName( output_image_filename );
-
- TWriter::Pointer aux_writer = TWriter::New( );
- aux_writer->SetInput( filter->GetOutput( ) );
- aux_writer->SetFileName( auxiliary_image_filename );
try
{
writer->Update( );
- aux_writer->Update( );
}
catch( std::exception& err )
{
--- /dev/null
+#ifndef __fpa__Base__PriorityQueueAlgorithm__h__
+#define __fpa__Base__PriorityQueueAlgorithm__h__
+
+#include <queue>
+#include <itkObject.h>
+
+namespace fpa
+{
+ namespace Base
+ {
+ /**
+ */
+ template< class _TSuperclass >
+ class PriorityQueueAlgorithm
+ : public _TSuperclass
+ {
+ public:
+ typedef PriorityQueueAlgorithm Self;
+ typedef _TSuperclass Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ protected:
+ typedef typename Superclass::_TQueueNode _TQueueNode;
+ struct _TQueueNodeCompare
+ {
+ bool operator( )( const _TQueueNode& a, const _TQueueNode& b )
+ {
+ return( b.Result < a.Result );
+ }
+ };
+ typedef std::vector< _TQueueNode > _TQueue;
+
+ public:
+ itkTypeMacro( PriorityQueueAlgorithm, Algorithm );
+
+ protected:
+ PriorityQueueAlgorithm( );
+ virtual ~PriorityQueueAlgorithm( );
+
+ virtual unsigned long _QueueSize( ) const override;
+ virtual void _QueueClear( ) override;
+ virtual void _QueuePush( const _TQueueNode& node ) override;
+ virtual _TQueueNode _QueuePop( ) override;
+
+ private:
+ // Purposely not defined
+ PriorityQueueAlgorithm( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ _TQueue m_Queue;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+# include <fpa/Base/PriorityQueueAlgorithm.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Base__PriorityQueueAlgorithm__h__
+
+// eof - $RCSfile$
--- /dev/null
+header #define ITK_MANUAL_INSTANTIATION
+
+*tinclude fpa/Image/Functors/SimpleNeighborhood:h|hxx
+*instances fpa::Image::Functors::SimpleNeighborhood< itk::Image< #scalar_types#, #pdims# > >
+
+*cinclude fpa/Base/RegionGrow.hxx
+*define all_int_types=#int_types#;#uint_types#
+*tinclude fpa/Image/RegionGrow:h|hxx
+*tinclude fpa/Image/MoriRegionGrowHelper:h|hxx
+*tinclude fpa/Image/MoriRegionGrow:h|hxx
+*instances fpa::Image::RegionGrow< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > >
+*instances fpa::Image::MoriRegionGrowHelper< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > >
+*instances fpa::Image::MoriRegionGrow< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > >
+
+*cinclude fpa/Base/Dijkstra.hxx
+*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# > >
+
+
+
+*define i_real=#real_types#
+*define o_real=#real_types#
+
+*tinclude fpa/Image/Functors/SimpleDijkstraCost:h|hxx
+*tinclude fpa/Base/Functors/Inverse:h|hxx
+*tinclude fpa/Base/Functors/GaussianModel:h|hxx
+*tinclude fpa/Image/Dijkstra:h|hxx
+*tinclude fpa/Image/SkeletonFilter:h|hxx
+*tinclude fpa/Image/Functors/RegionGrowBinaryThreshold:h|hxx
+
+*cinclude itkImage.h
+*cinclude itkSimpleDataObjectDecorator.hxx
+*cinclude fpa/Base/Dijkstra.hxx
+
+*instances fpa::Image::Functors::SimpleNeighborhood< itk::Image< #scalar_pixels#, #process_dims# > >
+*instances fpa::Image::Functors::SimpleDijkstraCost< itk::Image< #scalar_pixels#, #process_dims# >, #real_types# >
+*instances fpa::Image::Functors::RegionGrowBinaryThreshold< itk::Image< #scalar_pixels#, #process_dims# > >
+
+*instances fpa::Base::Functors::Inverse< #i_real#, #o_real# >
+*instances fpa::Base::Functors::GaussianModel< #i_real#, #o_real# >
+
+*instances fpa::Image::Dijkstra< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > >
+*instances fpa::Image::RegionGrow< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #int_types#, #process_dims# > >
+*instances fpa::Image::RegionGrow< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #uint_types#, #process_dims# > >
+*instances fpa::Image::SkeletonFilter< itk::Image< #real_types#, #process_dims# > >
+
+** eof - $RCSfile$
--- /dev/null
+#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$
--- /dev/null
+#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$