TMSTToImage::Pointer mst_image = TMSTToImage::New( );
mst_image->SetInput( filter->GetMinimumSpanningTree( ) );
- for( TIndex iseed: filter->GetSeeds( ) )
- for( TIndex jseed: filter->GetSeeds( ) )
- mst_image->AddPath( iseed, jseed, 255, 0, 0 );
+ TFilter::TSeedsInterface::TSeeds::const_iterator iseed =
+ filter->BeginSeeds( );
+ TFilter::TSeedsInterface::TSeeds::const_iterator jseed;
+ for( ; iseed != filter->EndSeeds( ); ++iseed )
+ for( jseed = filter->BeginSeeds( ); jseed != filter->EndSeeds( ); ++jseed )
+ mst_image->AddPath( *iseed, *jseed, 255, 0, 0 );
TColorImageWriter::Pointer paths_writer = TColorImageWriter::New( );
paths_writer->SetInput( mst_image->GetOutput( ) );
// Show data
TFilter::TCurve curve = filter->GetCurve( );
- for( TFilter::TCurveData data: curve )
+ TFilter::TCurve::const_iterator data = curve.begin( );
+ for( ; data != curve.end( ); ++data )
{
- std::cout << data.XValue << " " << data.YValue << " " << data.Diff1 << std::endl;
+ std::cout << data->XValue << " " << data->YValue << " " << data->Diff1 << std::endl;
}
std::cout
<< std::endl
// Init queue
std::vector< _TNode > q;
unsigned long frontId = 1;
- for( TVertex seed: this->GetSeeds( ) )
- q.push_back( _TNode( seed, seed, frontId++ ) );
+ typename TSeedsInterface::TSeeds::const_iterator sIt = this->BeginSeeds( );
+ for( ; sIt != this->EndSeeds( ); ++sIt )
+ q.push_back( _TNode( *sIt, *sIt, frontId++ ) );
// Main loop
while( q.size( ) > 0 )
bool fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
RenameVertex( const TIndex& old_index, const TIndex& new_index )
{
- auto old_v = this->m_Vertices.find( old_index );
- auto new_v = this->m_Vertices.find( new_index );
+ typename TVertices::iterator old_v = this->m_Vertices.find( old_index );
+ typename TVertices::iterator new_v = this->m_Vertices.find( new_index );
if( old_v != this->m_Vertices.end( ) && new_v == this->m_Vertices.end( ) )
{
// Replace vertex
this->m_Vertices.erase( old_index );
// Duplicate edges
- auto mIt = this->m_Matrix.begin( );
- auto found_row = this->m_Matrix.end( );
+ typename TMatrix::iterator mIt = this->m_Matrix.begin( );
+ typename TMatrix::iterator found_row = this->m_Matrix.end( );
for( ; mIt != this->m_Matrix.end( ); ++mIt )
{
if( mIt->first == old_index )
found_row = mIt;
- auto rIt = mIt->second.begin( );
+ typename TMatrixRow::iterator rIt = mIt->second.begin( );
for( ; rIt != mIt->second.end( ); ++rIt )
{
if( mIt->first == old_index )
mIt = this->m_Matrix.begin( );
for( ; mIt != this->m_Matrix.end( ); ++mIt )
{
- auto rIt = mIt->second.begin( );
+ typename TMatrixRow::iterator rIt = mIt->second.begin( );
while( rIt != mIt->second.end( ) )
{
if( rIt->first == old_index )
void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
RemoveVertex( const TIndex& index )
{
- auto i = this->m_Vertices.find( index );
+ typename TVertices::iterator i = this->m_Vertices.find( index );
if( i != this->m_Vertices.end( ) )
{
// Delete vertex
this->m_Vertices.erase( i );
// Delete edges starting from given vertex
- auto mIt = this->m_Matrix.find( index );
+ typename TMatrix::iterator mIt = this->m_Matrix.find( index );
if( mIt != this->m_Matrix.end( ) )
this->m_Matrix.erase( mIt );
mIt = this->m_Matrix.begin( );
for( ; mIt != this->m_Matrix.end( ); ++mIt )
{
- auto rIt = mIt->second.begin( );
+ typename TMatrixRow::iterator rIt = mIt->second.begin( );
while( rIt != mIt->second.end( ) )
{
if( rIt->first == index )
GetEdges( const TIndex& orig, const TIndex& dest )
{
static TEdges null_edges;
- auto o = this->m_Matrix.find( orig );
+ typename TMatrix::iterator o = this->m_Matrix.find( orig );
if( o != this->m_Matrix.find( orig ) )
{
- auto d = o->second.find( dest );
+ typename TMatrixRow::iterator d = o->second.find( dest );
if( d == o->second.end( ) )
{
null_edges.clear( );
GetEdges( const TIndex& orig, const TIndex& dest ) const
{
static const TEdges null_edges;
- auto o = this->m_Matrix.find( orig );
+ typename TMatrix::iterator o = this->m_Matrix.find( orig );
if( o != this->m_Matrix.find( orig ) )
{
- auto d = o->second.find( dest );
+ typename TMatrixRow::iterator d = o->second.find( dest );
if( d == o->second.end( ) )
return( null_edges );
else
bool fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
HasEdge( const TIndex& orig, const TIndex& dest ) const
{
- auto mIt = this->m_Matrix.find( orig );
+ typename TMatrix::const_iterator mIt = this->m_Matrix.find( orig );
if( mIt != this->m_Matrix.end( ) )
return( mIt->second.find( dest ) != mIt->second.end( ) );
else
void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
RemoveEdge( const TIndex& orig, const TIndex& dest, const TCost& cost )
{
- auto m = this->m_Matrix.find( orig );
+ typename TMatrix::iterator m = this->m_Matrix.find( orig );
if( m != this->m_Matrix.end( ) )
{
- auto r = m->second.find( dest );
+ typename TMatrixRow::iterator r = m->second.find( dest );
if( r != m->second.end( ) )
{
- auto e = r->second.end( );
+ typename TEdges::iterator e = r->second.end( );
for(
- auto i = r->second.begin( );
+ typename TEdges::iterator i = r->second.begin( );
i != r->second.end( ) && e == r->second.end( );
++i
)
void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
RemoveEdges( const TIndex& orig, const TIndex& dest )
{
- auto m = this->m_Matrix.find( orig );
+ typename TMatrix::iterator m = this->m_Matrix.find( orig );
if( m != this->m_Matrix.end( ) )
{
- auto r = m->second.find( dest );
+ typename TMatrixRow::iterator r = m->second.find( dest );
if( r != m->second.end( ) )
{
m->second.erase( r );
{
std::set< _TIndex, _TIndexCompare > sinks;
- auto vIt = this->m_Vertices.begin( );
+ typename TVertices::iterator vIt = this->m_Vertices.begin( );
for( ; vIt != this->m_Vertices.end( ); ++vIt )
sinks.insert( vIt->first );
- auto mIt = this->m_Matrix.begin( );
+ typename TMatrix::iterator mIt = this->m_Matrix.begin( );
for( ; mIt != this->m_Matrix.end( ); ++mIt )
sinks.erase( mIt->first );
unsigned long fpa::Base::MarksInterface< _TVertex >::
_Collisions( const TVertex& a, const TVertex& b )
{
- auto ma = this->_GetMark( a );
- auto mb = this->_GetMark( b );
+ unsigned long ma = this->_GetMark( a );
+ unsigned long mb = this->_GetMark( b );
if( ma == mb || ma == 0 || mb == 0 )
return( this->m_NumberOfFronts );
typedef std::pair< TVertex, unsigned long > _TNode;
std::queue< _TNode > queues[ 2 ];
unsigned long frontId = 1;
- for( TVertex seed: this->GetSeeds( ) )
- queues[ 0 ].push( _TNode( seed, frontId++ ) );
+ typename TSeedsInterface::TSeeds::const_iterator sIt = this->BeginSeeds( );
+ for( ; sIt != this->EndSeeds( ); ++sIt )
+ queues[ 0 ].push( _TNode( *sIt, frontId++ ) );
unsigned int cur_queue = 0;
unsigned int aux_queue = 1;
// Add neighborhood
TVertices neighbors = this->_GetNeighbors( node.first );
- for( TVertex neigh: neighbors )
+ typename TVertices::const_iterator neighIt = neighbors.begin( );
+ for( ; neighIt != neighbors.end( ); ++neighIt )
{
+ TVertex neigh = *neighIt;
if( this->_IsMarked( neigh ) )
{
// Invoke stop at collisions
typedef std::pair< TVertex, unsigned long > _TNode;
std::queue< _TNode > q;
unsigned long frontId = 1;
- for( TVertex seed: this->GetSeeds( ) )
- q.push( _TNode( seed, frontId++ ) );
+ typename TSeedsInterface::TSeeds::const_iterator sIt = this->BeginSeeds( );
+ for( ; sIt != this->EndSeeds( ); ++sIt )
+ q.push( _TNode( *sIt, frontId++ ) );
// Main loop
while( q.size( ) > 0 )
// Add neighborhood
TVertices neighbors = this->_GetNeighbors( node.first );
- for( TVertex neigh: neighbors )
+ typename TVertices::const_iterator neighIt = neighbors.begin( );
+ for( ; neighIt != neighbors.end( ); ++neighIt )
{
+ TVertex neigh = *neighIt;
if( this->_IsMarked( neigh ) )
{
// Invoke stop at collisions
GetEndPoints( ) const
{
std::vector< TIndex > res;
- auto mIt = this->BeginEdgesRows( );
+ typename Superclass::TMatrix::const_iterator mIt = this->BeginEdgesRows( );
for( ; mIt != this->EndEdgesRows( ); ++mIt )
{
unsigned long count = mIt->second.size( );
GetBifurcations( ) const
{
std::vector< TIndex > res;
- auto mIt = this->BeginEdgesRows( );
+ typename Superclass::TMatrix::const_iterator mIt = this->BeginEdgesRows( );
for( ; mIt != this->EndEdgesRows( ); ++mIt )
{
unsigned long count = mIt->second.size( );
typedef itk::SmartPointer< const Self > ConstPointer;
typedef _TSkeleton TSkeleton;
+ typedef typename TSkeleton::TEdges TEdges;
+ typedef typename TSkeleton::TMatrix TMatrix;
+ typedef typename TSkeleton::TMatrixRow TMatrixRow;
+ typedef typename TSkeleton::TPath TPath;
+ typedef typename TSkeleton::TVertex TVertex;
public:
itkNewMacro( Self );
GenerateData( )
{
const TSkeleton* sk = this->GetInput( );
- auto mIt = sk->BeginEdgesRows( );
- auto rIt = mIt->second.begin( );
- auto eIt = rIt->second.begin( );
- auto path = *eIt;
+ typename TMatrix::const_iterator mIt = sk->BeginEdgesRows( );
+ typename TMatrixRow::const_iterator rIt = mIt->second.begin( );
+ typename TEdges::const_iterator eIt = rIt->second.begin( );
+ const TPath* path = *eIt;
// Write base information
std::stringstream out1, out2;
out1 << TSkeleton::Dimension << std::endl;
- auto spa = path->GetSpacing( );
+ typename TPath::TSpacing spa = path->GetSpacing( );
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
out1 << spa[ d ] << " ";
out1 << std::endl;
- auto dir = path->GetDirection( );
+ typename TPath::TDirection dir = path->GetDirection( );
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
for( unsigned int e = 0; e < TSkeleton::Dimension; ++e )
out1 << dir[ d ][ e ] << " ";
out1 << std::endl;
- auto ori = path->GetOrigin( );
+ typename TPath::TPoint ori = path->GetOrigin( );
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
out1 << ori[ d ] << " ";
out1 << std::endl;
// End points
- auto end_points = sk->GetEndPoints( );
+ std::vector< TVertex > end_points = sk->GetEndPoints( );
out1 << end_points.size( ) << std::endl;
- for( auto point : end_points )
+ typename std::vector< TVertex >::const_iterator epIt = end_points.begin( );
+ for( ; epIt != end_points.end( ); ++epIt )
{
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
- out1 << point[ d ] << " ";
+ out1 << ( *epIt )[ d ] << " ";
out1 << std::endl;
} // rof
// Bifurcations
- auto bifurcations = sk->GetBifurcations( );
+ std::vector< TVertex > bifurcations = sk->GetBifurcations( );
out1 << bifurcations.size( ) << std::endl;
- for( auto point : bifurcations )
+ typename std::vector< TVertex >::const_iterator bIt = bifurcations.begin( );
+ for( ; bIt != bifurcations.end( ); ++bIt )
{
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
- out1 << point[ d ] << " ";
+ out1 << ( *bIt )[ d ] << " ";
out1 << std::endl;
} // rof
mIt = sk->BeginEdgesRows( );
for( ; mIt != sk->EndEdgesRows( ); ++mIt )
{
- auto rIt = mIt->second.begin( );
+ typename TMatrixRow::const_iterator rIt = mIt->second.begin( );
for( ; rIt != mIt->second.end( ); ++rIt )
{
- auto eIt = rIt->second.begin( );
+ typename TEdges::const_iterator eIt = rIt->second.begin( );
for( ; eIt != rIt->second.end( ); ++eIt )
{
- auto path = *eIt;
+ TPath* path = *eIt;
pathCount++;
unsigned int size = path->GetSize( );
out2 << size << std::endl;
for( unsigned int i = 0; i < path->GetSize( ); ++i )
{
- auto v = path->GetVertex( i );
+ TVertex v = path->GetVertex( i );
for( unsigned int d = 0; d < TSkeleton::Dimension; ++d )
out2 << v[ d ] << " ";
output->Allocate( );
output->FillBuffer( color );
- for( TPathData d: this->m_Paths )
+ typename TPaths::const_iterator d = this->m_Paths.begin( );
+ for( ; d != this->m_Paths.end( ); ++d )
{
- typename TMST::TVertices path = mst->GetPath( d.Start, d.End );
- color[ 0 ] = d.Red;
- color[ 1 ] = d.Green;
- color[ 2 ] = d.Blue;
+ typename TMST::TVertices path = mst->GetPath( d->Start, d->End );
+ color[ 0 ] = d->Red;
+ color[ 1 ] = d->Green;
+ color[ 2 ] = d->Blue;
color[ 3 ] = std::numeric_limits< TOutputPixelValue >::max( );
- for( TIndex i: path )
- output->SetPixel( i, color );
+ typename TMST::TVertices::const_iterator i = path.begin( );
+ for( ; i != path.end( ); ++i )
+ output->SetPixel( *i, color );
} // rof
}
tags->SetBufferedRegion( mst->GetBufferedRegion( ) );
tags->Allocate( );
tags->FillBuffer( 0 );
- for( TVertex it: end_points )
+ typename std::vector< TVertex >::const_iterator eIt = end_points.begin( );
+ for( ; eIt != end_points.end( ); ++eIt )
{
+ TVertex it = *eIt;
TVertex p = mst->GetParent( it );
while( it != p )
{
} // rof
// Build paths (branches)
- for( TVertex it: end_points )
+ eIt = end_points.begin( );
+ for( ; eIt != end_points.end( ); ++eIt )
{
+ TVertex it = *eIt;
TVertex p = mst->GetParent( it );
TVertex sIdx = it;
typename _TPath::Pointer path = _TPath::New( );