#define __fpa__Common__OriginalRandomWalker__h__
#include <fpa/Config.h>
+#include <map>
#include <vector>
#include <itkImage.h>
#include <itkImageToImageFilter.h>
+#include <itkSimpleFastMutexLock.h>
namespace fpa
{
typedef typename TImage::RegionType TRegion;
typedef typename TLabels::PixelType TLabel;
+ protected:
+ struct _TBoundaryThreadStruct
+ {
+ Pointer Filter;
+ void* Triplets;
+ std::map< TLabel, unsigned long >* Labels;
+ };
+
+ struct _TLaplacianThreadStruct
+ {
+ Pointer Filter;
+ void* A;
+ void* R;
+ const void* B;
+ };
+
+ struct _TOutputThreadStruct
+ {
+ Pointer Filter;
+ const void* X;
+ const void* S;
+ const std::vector< TLabel >* InvLabels;
+ };
+
public:
itkNewMacro( Self );
itkTypeMacro(
virtual void GenerateData( ) override;
+ virtual TScalar _W( const TIndex& i, const TIndex& j );
+ virtual TScalar _L( const TIndex& i, const TIndex& j );
+
+ // Boundary construction
+ template< class _TTriplets >
+ void _Boundary(
+ _TTriplets& B,
+ std::map< TLabel, unsigned long >& labels
+ );
+
+ template< class _TTriplets >
+ static ITK_THREAD_RETURN_TYPE _BoundaryCbk( void* arg );
+
+ template< class _TTriplets >
+ void _ThreadedBoundary(
+ const TRegion& region, const itk::ThreadIdType& id,
+ _TTriplets* B,
+ std::map< TLabel, unsigned long >* labels
+ );
+
+ // Laplacian construction
+ template< class _TTriplets >
+ void _Laplacian(
+ _TTriplets& A, _TTriplets& R, const _TTriplets& B
+ );
+
+ template< class _TTriplets >
+ static ITK_THREAD_RETURN_TYPE _LaplacianCbk( void* arg );
+
+ template< class _TTriplets >
+ void _ThreadedLaplacian(
+ const TRegion& region, const itk::ThreadIdType& id,
+ _TTriplets* A, _TTriplets* R, const _TTriplets* B
+ );
+
+ // Output filling
+ template< class _TMatrix, class _TTriplets >
+ void _Output(
+ const _TMatrix& X, const _TTriplets& S,
+ const std::vector< TLabel >& invLabels
+ );
+
+ template< class _TMatrix, class _TTriplets >
+ static ITK_THREAD_RETURN_TYPE _OutputCbk( void* arg );
+
+ template< class _TMatrix, class _TTriplets >
+ void _ThreadedOutput(
+ const TRegion& region, const itk::ThreadIdType& id,
+ const _TMatrix* X, const _TTriplets* S,
+ const std::vector< TLabel >* invLabels
+ );
+
+ // Array-Image conversion
static unsigned long _1D( const TIndex& idx, const TRegion& region );
- static TIndex _ND( const unsigned long& i, const TRegion& region );
+
+ template< class _TTriplets >
+ static unsigned long _SeedIndex(
+ const unsigned long& i, const _TTriplets& t
+ );
+
+ template< class _TTriplets >
+ static unsigned long _NearSeedIndex(
+ const unsigned long& i, const _TTriplets& t
+ );
private:
// Purposely not implemented
TScalar m_Beta;
TScalar m_Epsilon;
bool m_NormalizeWeights;
+
+ itk::SimpleFastMutexLock m_Mutex;
};
} // ecapseman