typedef typename TCenterness::OutputImageType TOutputImage;
typedef typename TInputImage::IndexType TIndex;
+ typedef typename TInputImage::PointType TPoint;
typedef fpa::Image::PolyLineParametricPath< Self::Dimension > TPath;
typedef fpa::Image::Dijkstra< TOutputImage, TOutputImage > TDijkstra;
itkGetConstObjectMacro( Centerness, TCenterness );
itkGetObjectMacro( Centerness, TCenterness );
+ itkGetConstMacro( StartIndex, TIndex );
+ itkGetConstMacro( EndIndex, TIndex );
+
+ itkSetMacro( StartIndex, TIndex );
+ itkSetMacro( EndIndex, TIndex );
+
public:
virtual itk::ModifiedTimeType GetMTime( ) const override;
- virtual void AddSeed( const TVertex& seed );
+ virtual void AddSeed( const TIndex& seed );
virtual void AddSeed( const TPoint& seed );
virtual void ClearSeeds( );
protected:
typename TCenterness::Pointer m_Centerness;
typename TDijkstra::Pointer m_Dijkstra;
+
+ TIndex m_StartIndex;
+ TIndex m_EndIndex;
};
} // ecapseman
{
itk::ModifiedTimeType a = this->Superclass::GetMTime( );
itk::ModifiedTimeType b = this->m_Centerness->GetMTime( );
- itk::ModifiedTimeType c = this->m_Dijsktra->GetMTime( );
+ itk::ModifiedTimeType c = this->m_Dijkstra->GetMTime( );
a = ( a < b )? a: b;
return( ( a < c )? a: c );
}
// -------------------------------------------------------------------------
template< class _TInputImage, class _TScalar, class _TCenterness >
void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >::
-AddSeed( const TVertex& seed )
+AddSeed( const TIndex& seed )
{
this->m_Dijkstra->AddSeed( seed );
}
this->m_Dijkstra->Update( );
// Extract axis
- typename TInputImage::IndexType a = this->m_Dijkstra->GetSeeds( )[ 0 ];
- typename TInputImage::IndexType b = this->m_Dijkstra->GetSeeds( )[ 1 ];
- this->m_Dijkstra->GetMinimumSpanningTree( )->GetPolyLineParametricPath( this->GetOutput( ), a, b );
+ typename TPath::Pointer out = this->GetOutput( );
+ this->m_Dijkstra->GetMinimumSpanningTree( )->GetPolyLineParametricPath(
+ out,
+ this->m_StartIndex,
+ this->m_EndIndex
+ );
}
#endif // __fpa__Image__ExtractAxisFilter__hxx__
) const
{
TVertices v = this->GetPath( a );
- path = TPolyLineParametricPath::New( );
+ if( path.IsNull( ) )
+ path = TPolyLineParametricPath::New( );
path->SetReferenceImage( this );
typename TVertices::const_iterator vIt = v.begin( );
for( ; vIt != v.end( ); ++vIt )
) const
{
TVertices v = this->GetPath( a, b );
- path = TPolyLineParametricPath::New( );
+ if( path.IsNull( ) )
+ path = TPolyLineParametricPath::New( );
path->SetReferenceImage( this );
typename TVertices::const_iterator vIt = v.begin( );
for( ; vIt != v.end( ); ++vIt )
this->SetDirection( image->GetDirection( ) );
}
+ virtual void Graft( itk::DataObject* o );
+
protected:
PolyLineParametricPath( );
virtual ~PolyLineParametricPath( );
} // fi
}
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::Image::PolyLineParametricPath< _VDim >::
+Graft( itk::DataObject* o )
+{
+ this->Superclass::Graft( o );
+ Self* other = dynamic_cast< Self* >( o );
+ if( other != NULL )
+ {
+ this->m_DefaultInputStepSize = other->m_DefaultInputStepSize;
+ this->Initialize( );
+ for( unsigned long i = 0; i < other->GetSize( ); ++i )
+ this->AddVertex( other->GetContinuousVertex( i ) );
+ this->m_Spacing = other->m_Spacing;
+ this->m_Origin = other->m_Origin;
+ this->m_Direction = other->m_Direction;
+ this->m_InverseDirection = other->m_InverseDirection;
+ this->m_IndexToPhysicalPoint = other->m_IndexToPhysicalPoint;
+ this->m_PhysicalPointToIndex = other->m_PhysicalPointToIndex;
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
template< unsigned int _VDim >
fpa::Image::PolyLineParametricPath< _VDim >::