#include <fpa/Config.h>
-#include <vector>
#include <itkObject.h>
#include <itkEventObject.h>
{
/**
*/
- template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+ template< class _TTraits >
class Algorithm
- : public _TFilter,
- public _TMarksInterface,
- public _TSeedsInterface
+ : public _TTraits::TFilter,
+ public _TTraits::TMarksInterface,
+ public _TTraits::TSeedsInterface
{
public:
- typedef Algorithm Self;
- typedef _TFilter Superclass;
- typedef _TMarksInterface TMarksInterface;
- typedef _TSeedsInterface TSeedsInterface;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef typename _TSeedsInterface::TInputValue TInputValue;
- typedef typename _TSeedsInterface::TOutputValue TOutputValue;
- typedef typename _TSeedsInterface::TNode TNode;
- typedef typename _TSeedsInterface::TNodes TNodes;
- typedef typename _TSeedsInterface::TSeeds TSeeds;
- typedef typename _TSeedsInterface::TVertex TVertex;
-
- typedef std::vector< TVertex > TNeighborhood;
+ typedef _TTraits TTraits;
+ typedef typename TTraits::TFilter Superclass;
+ typedef typename TTraits::TMarksInterface TMarksInterface;
+ typedef typename TTraits::TSeedsInterface TSeedsInterface;
+ typedef Algorithm Self;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef typename TTraits::TInputValue TInputValue;
+ typedef typename TTraits::TOutputValue TOutputValue;
+ typedef typename TTraits::TNeighborhood TNeighborhood;
+ typedef typename TTraits::TNode TNode;
+ typedef typename TTraits::TNodes TNodes;
+ typedef typename TTraits::TSeeds TSeeds;
+ typedef typename TTraits::TVertex TVertex;
/**
*/
#define __fpa__Base__Algorithm__hxx__
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+fpa::Base::Algorithm< _TTraits >::TEvent::
TEvent( )
: Superclass( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+fpa::Base::Algorithm< _TTraits >::TEvent::
TEvent( const TVertex& v, unsigned long fid, bool intoq )
: Superclass( ),
Vertex( v ),
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+fpa::Base::Algorithm< _TTraits >::TEvent::
~TEvent( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-const char*
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+const char* fpa::Base::Algorithm< _TTraits >::TEvent::
GetEventName( ) const
{
- return( "fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent" );
+ return( "fpa::Base::Algorithm< _TTraits >::TEvent" );
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-bool
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+bool fpa::Base::Algorithm< _TTraits >::TEvent::
CheckEvent( const itk::EventObject* e ) const
{
return( dynamic_cast< const Self* >( e ) != NULL );
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-itk::EventObject*
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::TEvent::
+template< class _TTraits >
+itk::EventObject* fpa::Base::Algorithm< _TTraits >::TEvent::
MakeObject( ) const
{
return( new Self );
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
InvokeEvent( const itk::EventObject& e )
{
TEvent a;
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
InvokeEvent( const itk::EventObject& e ) const
{
TEvent a;
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+fpa::Base::Algorithm< _TTraits >::
Algorithm( )
: Superclass( ),
- _TMarksInterface( this ),
- _TSeedsInterface( this ),
+ TMarksInterface( this ),
+ TSeedsInterface( this ),
m_VisualDebug( false )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+fpa::Base::Algorithm< _TTraits >::
~Algorithm( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
GenerateData( )
{
this->InvokeEvent( itk::StartEvent( ) );
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
_BeforeGenerateData( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
_AfterGenerateData( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
_FinishOneLoop( )
{
}
// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
-void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Base::Algorithm< _TTraits >::
_QueueInit( )
{
this->_QueueClear( );
{
/**
*/
- template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+ template< class _TTraits >
class Algorithm
- : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, _TMarksInterface, _TSeedsInterface >
+ : public fpa::Base::Algorithm< _TTraits >
{
public:
- typedef _TInputImage TInputImage;
- typedef _TOutputImage TOutputImage;
- typedef _TMarksInterface TMarksInterface;
- typedef _TSeedsInterface TSeedsInterface;
- typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
-
- typedef Algorithm Self;
- typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef typename TInputImage::PixelType TInputValue;
- typedef typename TOutputImage::PixelType TOutputValue;
- typedef typename Superclass::TFrontId TFrontId;
- typedef typename Superclass::TNeighborhood TNeighborhood;
- typedef typename Superclass::TNode TNode;
- typedef typename Superclass::TNodes TNodes;
- typedef typename Superclass::TSeeds TSeeds;
- typedef typename Superclass::TVertex TVertex;
- typedef typename Superclass::TPoint TPoint;
-
- typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarks;
+ typedef _TTraits TTraits;
+ typedef fpa::Base::Algorithm< _TTraits > Superclass;
+ typedef Algorithm Self;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef typename TTraits::TFrontId TFrontId;
+ typedef typename TTraits::TInputImage TInputImage;
+ typedef typename TTraits::TInputValue TInputValue;
+ typedef typename TTraits::TNeighborhood TNeighborhood;
+ typedef typename TTraits::TNode TNode;
+ typedef typename TTraits::TNodes TNodes;
+ typedef typename TTraits::TOutputImage TOutputImage;
+ typedef typename TTraits::TOutputValue TOutputValue;
+ typedef typename TTraits::TSeeds TSeeds;
+ typedef typename TTraits::TVertex TVertex;
+
+ typedef itk::Image< TFrontId, TTraits::Dimension > TMarks;
+
+ /* TODO
+ typedef _TMarksInterface TMarksInterface;
+ typedef _TSeedsInterface TSeedsInterface;
+
+ typedef typename TSeedsInterface::TTraits TTraits;
+ typedef typename TTraits::TInputImage TInputImage;
+ typedef typename TTraits::TOutputImage TOutputImage;
+ typedef typename TTraits::TInputValue TInputValue;
+ typedef typename TTraits::TOutputValue TOutputValue;
+ typedef typename TTraits::TFrontId TFrontId;
+ typedef typename TTraits::TNeighborhood TNeighborhood;
+ typedef typename TTraits::TNode TNode;
+ typedef typename TTraits::TNodes TNodes;
+ typedef typename TTraits::TSeeds TSeeds;
+ typedef typename TTraits::TVertex TVertex;
+ typedef typename TTraits::TPoint TPoint;
+
+ typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+ typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+ typedef Algorithm Self;
+ */
public:
itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
#define __fpa__Image__Algorithm__hxx__
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TMarks*
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+typename fpa::Image::Algorithm< _TTraits >::TMarks*
+fpa::Image::Algorithm< _TTraits >::
GetMarks( )
{
return(
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-const typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TMarks*
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+const typename fpa::Image::Algorithm< _TTraits >::TMarks*
+fpa::Image::Algorithm< _TTraits >::
GetMarks( ) const
{
return(
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+fpa::Image::Algorithm< _TTraits >::
Algorithm( )
: Superclass( ),
m_NeigborhoodOrder( 1 )
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+fpa::Image::Algorithm< _TTraits >::
~Algorithm( )
{
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TNodes fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+typename fpa::Image::Algorithm< _TTraits >::TNodes
+fpa::Image::Algorithm< _TTraits >::
_UnifySeeds( )
{
const TInputImage* input = this->GetInput( );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-void
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Image::Algorithm< _TTraits >::
_ConfigureOutput( const TOutputValue& v )
{
const TInputImage* in = this->GetInput( );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TNeighborhood fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+typename fpa::Image::Algorithm< _TTraits >::TNeighborhood
+fpa::Image::Algorithm< _TTraits >::
_GetNeighbors( const TVertex& v ) const
{
typename TInputImage::RegionType region =
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TInputValue
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+typename fpa::Image::Algorithm< _TTraits >::TInputValue
+fpa::Image::Algorithm< _TTraits >::
_GetInputValue( const TVertex& v ) const
{
return( this->GetInput( )->GetPixel( v ) );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-typename
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
-TOutputValue fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+typename fpa::Image::Algorithm< _TTraits >::TOutputValue
+fpa::Image::Algorithm< _TTraits >::
_GetOutputValue( const TVertex& v ) const
{
return( this->GetOutput( )->GetPixel( v ) );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-void
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Image::Algorithm< _TTraits >::
_UpdateOutputValue( TNode& n )
{
this->GetOutput( )->SetPixel( n.Vertex, n.Value );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-bool
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+bool fpa::Image::Algorithm< _TTraits >::
_IsMarked( const TVertex& v ) const
{
return( this->GetMarks( )->GetPixel( v ) > 0 );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-unsigned long
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+unsigned long fpa::Image::Algorithm< _TTraits >::
_GetMark( const TVertex& v ) const
{
return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
}
// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
-void
-fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+template< class _TTraits >
+void fpa::Image::Algorithm< _TTraits >::
_Mark( const TVertex& v, unsigned long frontId )
{
this->GetMarks( )->SetPixel( v, TFrontId( frontId ) );
--- /dev/null
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__DefaultTraits__h__
+#define __fpa__Image__DefaultTraits__h__
+
+#include <vector>
+#include <itkConceptChecking.h>
+#include <itkImageToImageFilter.h>
+
+#include <fpa/Base/MarksInterfaceWithCollisions.h>
+#include <fpa/Base/SeedsInterface.h>
+
+namespace fpa
+{
+ namespace Image
+ {
+ /**
+ */
+ template< class _TInputImage, class _TOutputImage, class _TFrontId >
+ class DefaultTraits
+ {
+ public:
+ typedef DefaultTraits Self;
+ typedef _TInputImage TInputImage;
+ typedef _TOutputImage TOutputImage;
+ typedef _TFrontId TFrontId;
+ itkStaticConstMacro( Dimension, unsigned int, TInputImage::ImageDimension );
+
+ typedef typename TInputImage::IndexType TVertex;
+ typedef typename TInputImage::PixelType TInputValue;
+ typedef typename TInputImage::PointType TPoint;
+ typedef typename TOutputImage::PixelType TOutputValue;
+ typedef typename TVertex::LexicographicCompare TCompare;
+
+ typedef std::vector< TVertex > TNeighborhood;
+
+ typedef fpa::Base::SeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface;
+ typedef fpa::Base::MarksInterfaceWithCollisions< TVertex > TMarksInterface;
+ typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+
+ typedef typename TSeedsInterface::TNode TNode;
+ typedef typename TSeedsInterface::TNodes TNodes;
+ typedef typename TSeedsInterface::TSeed TSeed;
+ typedef typename TSeedsInterface::TSeeds TSeeds;
+
+ public:
+ itkConceptMacro(
+ Check_SameDimension,
+ ( itk::Concept::SameDimension< TInputImage::ImageDimension, TOutputImage::ImageDimension > )
+ );
+
+ private:
+ // Purposely not implemented.
+ DefaultTraits( );
+ DefaultTraits( const Self& other );
+ virtual ~DefaultTraits( );
+ Self& operator=( const Self& other );
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Image__DefaultTraits__h__
+
+// eof - $RCSfile$
#define __fpa__Image__Dijkstra__h__
#include <fpa/Base/Dijkstra.h>
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/SeedsInterface.h>
#include <fpa/Image/Algorithm.h>
+#include <fpa/Image/DefaultTraits.h>
#include <fpa/Image/MinimumSpanningTree.h>
-#include <fpa/Image/Functors/Dijkstra/Identity.h>
namespace fpa
{
*/
template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char >
class Dijkstra
- : public fpa::Base::Dijkstra< fpa::Image::Algorithm< _TInputImage, _TOutputImage, fpa::Base::MarksInterfaceWithCollisions< typename _TInputImage::IndexType >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, typename _TOutputImage::PixelType, _TFrontId, typename _TInputImage::IndexType::LexicographicCompare > >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
+ : public fpa::Base::Dijkstra< fpa::Image::Algorithm< fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
{
public:
typedef _TInputImage TInputImage;
typedef _TOutputImage TOutputImage;
typedef _TFrontId TFrontId;
+ typedef fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > TMST;
- typedef typename TInputImage::IndexType TVertex;
- typedef typename TInputImage::PointType TPoint;
- typedef typename TVertex::LexicographicCompare TVertexCompare;
- typedef typename TInputImage::PixelType TInputValue;
- typedef typename TOutputImage::PixelType TOutputValue;
-
- typedef fpa::Base::MarksInterfaceWithCollisions< TVertex > TMarksInterface;
- typedef fpa::Base::SeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TVertexCompare > TSeedsInterface;
- typedef fpa::Image::Algorithm< TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
- typedef fpa::Image::MinimumSpanningTree< TInputImage::ImageDimension > TMST;
-
- typedef Dijkstra Self;
+ typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > TTraits;
+ typedef fpa::Image::Algorithm< TTraits > TAlgorithm;
typedef fpa::Base::Dijkstra< TAlgorithm, TMST > Superclass;
+ typedef Dijkstra Self;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
- typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TOutputValue > TWeightFunction;
-
public:
itkNewMacro( Self );
itkTypeMacro( fpa::Image::Dijkstra, fpa::Base::Dijkstra );
protected:
- Dijkstra( )
- : Superclass( )
- {
- typedef fpa::Image::Functors::Dijkstra::Identity< TInputImage, TOutputValue > _TDefaultFunction;
- this->SetWeightFunction( _TDefaultFunction::New( ) );
- }
- virtual ~Dijkstra( )
- {
- }
-
- virtual void _ConfigureOutput( const TOutputValue& v ) override
- {
- this->Superclass::_ConfigureOutput( v );
- const TInputImage* in = this->GetInput( );
-
- TMST* mst = this->GetMinimumSpanningTree( );
- mst->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
- mst->SetRequestedRegion( in->GetRequestedRegion( ) );
- mst->SetBufferedRegion( in->GetBufferedRegion( ) );
- mst->SetSpacing( in->GetSpacing( ) );
- mst->SetOrigin( in->GetOrigin( ) );
- mst->SetDirection( in->GetDirection( ) );
- mst->Allocate( );
-
- typename TMST::PixelType zero;
- zero.Fill( 0 );
- mst->FillBuffer( zero );
- }
-
- virtual void _BeforeGenerateData( ) override
- {
- this->Superclass::_BeforeGenerateData( );
- TWeightFunction* wf =
- dynamic_cast< TWeightFunction* >( this->GetWeightFunction( ) );
- if( wf != NULL )
- wf->SetImage( this->GetInput( ) );
- }
+ Dijkstra( ) : Superclass( ) { }
+ virtual ~Dijkstra( ) { }
private:
// Purposely not implemented.
#include <fpa/Base/MarksInterface.h>
#include <fpa/Base/SingleSeedInterface.h>
#include <fpa/Image/Algorithm.h>
+#include <fpa/Image/DefaultTraits.h>
namespace fpa
{
/**
*/
template< class _TInputImage, class _TOutputImage >
- class Mori
- : public fpa::Base::Mori< fpa::Image::Algorithm< _TInputImage, _TOutputImage, fpa::Base::MarksInterface< typename _TInputImage::IndexType >, fpa::Base::SingleSeedInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, typename _TOutputImage::PixelType, typename _TOutputImage::PixelType, typename _TInputImage::IndexType::LexicographicCompare > > >
+ class MoriTraits
+ : public fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, typename _TOutputImage::PixelType >
{
public:
+ typedef MoriTraits Self;
typedef _TInputImage TInputImage;
typedef _TOutputImage TOutputImage;
+ typedef typename TOutputImage::PixelType TFrontId;
+ typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > Superclass;
+
+ typedef typename Superclass::TVertex TVertex;
+ typedef typename Superclass::TInputValue TInputValue;
+ typedef typename Superclass::TPoint TPoint;
+ typedef typename Superclass::TOutputValue TOutputValue;
+ typedef typename Superclass::TCompare TCompare;
+ typedef typename Superclass::TNeighborhood TNeighborhood;
+ typedef typename Superclass::TFilter TFilter;
+
+ typedef fpa::Base::SingleSeedInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface;
+ typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
- typedef typename TInputImage::IndexType TVertex;
- typedef typename TInputImage::PointType TPoint;
- typedef typename TVertex::LexicographicCompare TVertexCompare;
- typedef typename TInputImage::PixelType TInputValue;
- typedef typename TOutputImage::PixelType TOutputValue;
- typedef typename TOutputImage::PixelType TFrontId;
+ typedef typename TSeedsInterface::TNode TNode;
+ typedef typename TSeedsInterface::TNodes TNodes;
+ typedef typename TSeedsInterface::TSeed TSeed;
+ typedef typename TSeedsInterface::TSeeds TSeeds;
- typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
- typedef fpa::Base::SingleSeedInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TVertexCompare > TSeedsInterface;
- typedef fpa::Image::Algorithm< TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
+ private:
+ // Purposely not implemented.
+ MoriTraits( );
+ MoriTraits( const Self& other );
+ virtual ~MoriTraits( );
+ Self& operator=( const Self& other );
+ };
+
+ /**
+ */
+ template< class _TInputImage, class _TOutputImage >
+ class Mori
+ : public fpa::Base::Mori< fpa::Image::Algorithm< fpa::Image::MoriTraits< _TInputImage, _TOutputImage > > >
+ {
+ public:
+ typedef _TInputImage TInputImage;
+ typedef _TOutputImage TOutputImage;
+ typedef fpa::Image::MoriTraits< TInputImage, TOutputImage > TTraits;
+ typedef fpa::Image::Algorithm< TTraits > TAlgorithm;
typedef Mori Self;
typedef fpa::Base::Mori< TAlgorithm > Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
- typedef typename TSeedsInterface::TNode TNode;
- typedef typename TSeedsInterface::TNodes TNodes;
- typedef typename TAlgorithm::TMarks TMarks;
+ typedef typename TAlgorithm::TMarks TMarks;
public:
itkNewMacro( Self );
#define __fpa__Image__RandomWalker__h__
#include <itkImage.h>
-
#include <fpa/Base/DijkstraBase.h>
#include <fpa/Base/MarksInterface.h>
#include <fpa/Image/Algorithm.h>
+#include <fpa/Image/DefaultTraits.h>
#include <fpa/Image/LabelledSeedsInterface.h>
-#include <fpa/Image/Functors/Dijkstra/Function.h>
namespace fpa
{
/**
*/
template< class _TInputImage, class _TLabelImage, class _TScalar >
- class RandomWalker
- : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, fpa::Base::MarksInterface< typename _TInputImage::IndexType >, fpa::Image::LabelledSeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, _TScalar, typename _TLabelImage::PixelType, typename _TInputImage::IndexType::LexicographicCompare > > >
+ class RandomWalkerTraits
+ : public fpa::Image::DefaultTraits< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, typename _TLabelImage::PixelType >
{
public:
- typedef _TInputImage TInputImage;
- typedef _TLabelImage TLabelImage;
- typedef _TScalar TScalar;
- typedef typename TInputImage::IndexType TVertex;
- typedef typename TInputImage::PointType TPoint;
- typedef typename TVertex::LexicographicCompare TVertexCompare;
- typedef typename TInputImage::PixelType TInputValue;
- typedef typename TLabelImage::PixelType TFrontId;
-
+ typedef RandomWalkerTraits Self;
+ typedef _TInputImage TInputImage;
+ typedef _TLabelImage TLabelImage;
+ typedef _TScalar TScalar;
+ typedef typename _TLabelImage::PixelType TFrontId;
typedef itk::Image< TScalar, _TInputImage::ImageDimension > TOutputImage;
- typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
- typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, _TScalar, TFrontId, TVertexCompare > TSeedsInterface;
- typedef fpa::Image::Algorithm< _TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
+ typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > Superclass;
+
+ typedef typename Superclass::TVertex TVertex;
+ typedef typename Superclass::TInputValue TInputValue;
+ typedef typename Superclass::TPoint TPoint;
+ typedef typename Superclass::TOutputValue TOutputValue;
+ typedef typename Superclass::TCompare TCompare;
+ typedef typename Superclass::TNeighborhood TNeighborhood;
+ typedef typename Superclass::TFilter TFilter;
- typedef RandomWalker Self;
- typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TCompare > TSeedsInterface;
+ typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
- typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TScalar > TWeightFunction;
typedef typename TSeedsInterface::TNode TNode;
typedef typename TSeedsInterface::TNodes TNodes;
+ typedef typename TSeedsInterface::TSeed TSeed;
+ typedef typename TSeedsInterface::TSeeds TSeeds;
+
+ public:
+ itkConceptMacro(
+ Check_SameDimension,
+ ( itk::Concept::SameDimension< TInputImage::ImageDimension, TLabelImage::ImageDimension > )
+ );
+
+ private:
+ // Purposely not implemented.
+ RandomWalkerTraits( );
+ RandomWalkerTraits( const Self& other );
+ virtual ~RandomWalkerTraits( );
+ Self& operator=( const Self& other );
+ };
+
+ /**
+ */
+ template< class _TInputImage, class _TLabelImage, class _TScalar >
+ class RandomWalker
+ : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< fpa::Image::RandomWalkerTraits< _TInputImage, _TLabelImage, _TScalar > > >
+ /* TODO
+ : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, fpa::Base::MarksInterface< typename _TInputImage::IndexType >, fpa::Image::LabelledSeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, _TScalar, typename _TLabelImage::PixelType, typename _TInputImage::IndexType::LexicographicCompare > > >
+ */
+ {
+ public:
+ /* TODO
+ typedef _TInputImage TInputImage;
+ typedef _TLabelImage TLabelImage;
+ typedef _TScalar TScalar;
+ typedef typename TInputImage::IndexType TVertex;
+ typedef typename TInputImage::PointType TPoint;
+ typedef typename TVertex::LexicographicCompare TVertexCompare;
+ typedef typename TInputImage::PixelType TInputValue;
+ typedef typename TLabelImage::PixelType TFrontId;
+
+ typedef itk::Image< TScalar, _TInputImage::ImageDimension > TOutputImage;
+ typedef fpa::Base::MarksInterface< TVertex > TMarksInterface;
+ typedef fpa::Image::LabelledSeedsInterface< TVertex, TPoint, TInputValue, _TScalar, TFrontId, TVertexCompare > TSeedsInterface;
+ typedef fpa::Image::Algorithm< _TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
+ typedef RandomWalker Self;
+ typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TScalar > TWeightFunction;
+ typedef typename TSeedsInterface::TNode TNode;
+ typedef typename TSeedsInterface::TNodes TNodes;
+ */
public:
itkNewMacro( Self );
#define __fpa__Image__RegionGrow__h__
#include <fpa/Base/RegionGrow.h>
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/SeedsInterface.h>
#include <fpa/Image/Algorithm.h>
+#include <fpa/Image/DefaultTraits.h>
namespace fpa
{
*/
template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char >
class RegionGrow
- : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TInputImage, _TOutputImage, fpa::Base::MarksInterfaceWithCollisions< typename _TInputImage::IndexType >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::PointType, typename _TInputImage::PixelType, typename _TOutputImage::PixelType, _TFrontId, typename _TInputImage::IndexType::LexicographicCompare > > >
+ : public fpa::Base::RegionGrow< fpa::Image::Algorithm< fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > > >
{
public:
typedef _TInputImage TInputImage;
typedef _TOutputImage TOutputImage;
typedef _TFrontId TFrontId;
- typedef typename TInputImage::IndexType TVertex;
- typedef typename TInputImage::PointType TPoint;
- typedef typename TVertex::LexicographicCompare TVertexCompare;
- typedef typename TInputImage::PixelType TInputValue;
- typedef typename TOutputImage::PixelType TOutputValue;
-
- typedef fpa::Base::MarksInterfaceWithCollisions< TVertex > TMarksInterface;
- typedef fpa::Base::SeedsInterface< TVertex, TPoint, TInputValue, TOutputValue, TFrontId, TVertexCompare > TSeedsInterface;
- typedef fpa::Image::Algorithm< TInputImage, TOutputImage, TMarksInterface, TSeedsInterface > TAlgorithm;
-
- typedef RegionGrow Self;
+ typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > TTraits;
+ typedef fpa::Image::Algorithm< TTraits > TAlgorithm;
typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
+ typedef RegionGrow Self;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
- typedef typename TSeedsInterface::TNode TNode;
- typedef typename TSeedsInterface::TNodes TNodes;
-
public:
itkNewMacro( Self );
itkTypeMacro( fpa::Image::RegionGrow, fpa::Base::RegionGrow );
protected:
- RegionGrow( )
- : Superclass( )
- {
- }
- virtual ~RegionGrow( )
- {
- }
+ RegionGrow( ) : Superclass( ) { }
+ virtual ~RegionGrow( ) { }
private:
// Purposely not implemented.