From 67b67cafced0d039cf6ff2ccf7839088fd091395 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Fri, 15 Apr 2016 14:07:45 -0500 Subject: [PATCH] ... --- appli/CMakeLists.txt | 6 -- appli/TempAirwaysAppli/CMakeLists.txt | 12 ++-- appli/TempAirwaysAppli/TempAirwaysAppli.cxx | 72 ++++++++++++++----- .../Airways}/AirwaysLib/CMakeLists.txt | 22 +++--- .../Airways}/AirwaysLib/airwaysEdge.cxx | 0 .../Airways}/AirwaysLib/airwaysEdge.h | 4 +- .../Airways}/AirwaysLib/airwaysNode.cxx | 0 .../Airways}/AirwaysLib/airwaysNode.h | 4 +- .../Airways}/AirwaysLib/airwaysTree.cxx | 0 .../Airways}/AirwaysLib/airwaysTree.h | 4 +- .../AirwaysLib/airwaysTreeTypeDefinition.h | 0 lib/Airways/CMakeLists.txt | 6 ++ .../Airways}/MathLib/CMakeLists.txt | 15 ++-- .../Airways}/MathLib/Quaternion.cpp | 0 .../Airways}/MathLib/Quaternion.h | 4 +- .../Airways}/MathLib/vec3.cxx | 0 .../Airways}/MathLib/vec3.h | 4 +- lib/Airways/fpa2Airways/Converter.h | 43 +++++++++++ lib/CMakeLists.txt | 5 ++ ...AndBifurcationsFromMinimumSpanningTree.hxx | 20 +++++- lib/fpa/Base/ImageSkeleton.hxx | 26 +++++-- ...AndBifurcationsFromMinimumSpanningTree.hxx | 6 +- 22 files changed, 181 insertions(+), 72 deletions(-) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/CMakeLists.txt (50%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysEdge.cxx (100%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysEdge.h (98%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysNode.cxx (100%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysNode.h (99%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysTree.cxx (100%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysTree.h (99%) rename {appli/TempAirwaysAppli => lib/Airways}/AirwaysLib/airwaysTreeTypeDefinition.h (100%) create mode 100644 lib/Airways/CMakeLists.txt rename {appli/TempAirwaysAppli => lib/Airways}/MathLib/CMakeLists.txt (58%) rename {appli/TempAirwaysAppli => lib/Airways}/MathLib/Quaternion.cpp (100%) rename {appli/TempAirwaysAppli => lib/Airways}/MathLib/Quaternion.h (97%) rename {appli/TempAirwaysAppli => lib/Airways}/MathLib/vec3.cxx (100%) rename {appli/TempAirwaysAppli => lib/Airways}/MathLib/vec3.h (98%) create mode 100644 lib/Airways/fpa2Airways/Converter.h diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt index d9ec026..0e315a1 100644 --- a/appli/CMakeLists.txt +++ b/appli/CMakeLists.txt @@ -1,9 +1,3 @@ -#IF(BUILD_EXAMPLES) -#SUBDIRS( -#examples -## fpaLab -#) -#ENDIF(BUILD_EXAMPLES) IF(BUILD_TempAirwaysAppli) SUBDIRS( diff --git a/appli/TempAirwaysAppli/CMakeLists.txt b/appli/TempAirwaysAppli/CMakeLists.txt index 4b80e61..b038389 100644 --- a/appli/TempAirwaysAppli/CMakeLists.txt +++ b/appli/TempAirwaysAppli/CMakeLists.txt @@ -3,18 +3,16 @@ FIND_PACKAGE(Boost REQUIRED system filesystem program_options) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -SUBDIRS( - MathLib - AirwaysLib - ) INCLUDE_DIRECTORIES( - MathLib - AirwaysLib + ${PROJECT_SOURCE_DIR}/lib/Airways/MathLib + ${PROJECT_SOURCE_DIR}/lib/Airways/AirwaysLib + ${PROJECT_BINARY_DIR}/lib/Airways/MathLib + ${PROJECT_BINARY_DIR}/lib/Airways/AirwaysLib ) ADD_EXECUTABLE(TempAirwaysAppli TempAirwaysAppli.cxx) TARGET_LINK_LIBRARIES( TempAirwaysAppli - ${Boost_LIBRARIES} MathLib AirwaysLib + ${Boost_LIBRARIES} TempAirwaysAppli_AirwaysLib cpPlugins ${fpa_LIBRARIES} ) diff --git a/appli/TempAirwaysAppli/TempAirwaysAppli.cxx b/appli/TempAirwaysAppli/TempAirwaysAppli.cxx index 1bb5573..9e3692d 100644 --- a/appli/TempAirwaysAppli/TempAirwaysAppli.cxx +++ b/appli/TempAirwaysAppli/TempAirwaysAppli.cxx @@ -464,6 +464,7 @@ void DrawVTKLinesFromTree(AirwaysTree& tree, const std::string filepath, bool co #include #include #include +#include template< class TImage, class TVertex > Node* FAVertexToNode( TVertex vertex, TImage* image ) @@ -498,33 +499,62 @@ AirwaysTree& ConvertFilterToAirwaysTree( TInputImage* input_image, cpPlugins::Wo auto distance_map = ws.GetFilter( "dmap" )->GetOutputData( "Output" )-> GetITK< itk::Image< float, 3 > >( ); - auto branches = + auto sk = w_filter->GetOutputData( "Skeleton" )->GetITK< TFASkeleton >( ); - auto sIt = branches->Get( ).begin( ); - for( ; sIt!=branches->Get( ).end( ); ++sIt ) + const auto& branches = sk->Get( ); + auto seed0 = + ws.GetFilter( "seed" )->GetOutputData( "Output" )-> + GetITK< TVerticesFA >( )->Get( )[ 0 ]; + + std::queue< TVertexFA > q; + // TODO: std::set< TVertexFA, TVertexCompareFA > marks; + q.push( seed0 ); + while( !q.empty( ) ) { - auto srcIt = vertexMap.find( sIt->first ); + auto sVertex = q.front( ); + q.pop( ); + auto sIt = branches.find( sVertex ); + /* TODO + if( marks.find( sVertex ) != marks.end( ) ) + { + std::cout << "MARK!!!!! : " << sVertex << std::endl; + } + marks.insert( sVertex ); + */ + + // End node... do nothing + if( sIt == branches.end( ) ) + continue; + + // Create source node + auto srcIt = vertexMap.find( sVertex ); if( srcIt == vertexMap.end( ) ) srcIt = vertexMap.insert( VertexMap::value_type( - sIt->first, FAVertexToNode( sIt->first, input_image ) + sVertex, FAVertexToNode( sVertex, input_image ) ) ).first; - auto eIt = sIt->second.begin( ); - for( ; eIt != sIt->second.end( ); ++eIt ) + + // TODO: std::cout << sVertex << " " << " " << sLevel << " " << seed0 << std::endl; + // Create destination nodes + for( auto eIt = sIt->second.begin( ); eIt != sIt->second.end( ); ++eIt ) { auto dstIt = vertexMap.find( eIt->first ); - if( dstIt != vertexMap.end( ) ) - continue; - dstIt = vertexMap.insert( - VertexMap::value_type( - eIt->first, FAVertexToNode( eIt->first, input_image ) - ) - ).first; - + if( dstIt == vertexMap.end( ) ) + dstIt = vertexMap.insert( + VertexMap::value_type( + eIt->first, FAVertexToNode( eIt->first, input_image ) + ) + ).first; + + // Connect in the acyclic graph dstIt->second->SetFather( srcIt->second ); srcIt->second->AddChild( dstIt->second ); + + // Create detailed edge TEdgeAirways* edge = new Edge( ); + edge->SetSource( srcIt->second ); + edge->SetTarget( dstIt->second ); auto path = eIt->second->GetVertexList( ); for( unsigned int pIt = 0; pIt < path->Size( ); ++pIt ) { @@ -539,12 +569,16 @@ AirwaysTree& ConvertFilterToAirwaysTree( TInputImage* input_image, cpPlugins::Wo } // rof + // Finish association + dstIt->second->SetEdge( edge ); + + // Put it as next candidate + q.push( eIt->first ); + } // rof - } // rof - auto seed0 = - ws.GetFilter( "seed" )->GetOutputData( "Output" )-> - GetITK< TVerticesFA >( )->Get( )[ 0 ]; + } // elihw + AirwaysTree* tree = new AirwaysTree( input_image, NULL, vertexMap[ seed0 ], false ); std::time(&end); diff --git a/appli/TempAirwaysAppli/AirwaysLib/CMakeLists.txt b/lib/Airways/AirwaysLib/CMakeLists.txt similarity index 50% rename from appli/TempAirwaysAppli/AirwaysLib/CMakeLists.txt rename to lib/Airways/AirwaysLib/CMakeLists.txt index 2c05400..712dc25 100644 --- a/appli/TempAirwaysAppli/AirwaysLib/CMakeLists.txt +++ b/lib/Airways/AirwaysLib/CMakeLists.txt @@ -2,25 +2,23 @@ ## = Set names and directories = ## ============================= -SET(lib_NAME AirwaysLib) +SET(lib_NAME TempAirwaysAppli_AirwaysLib) INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR}/appli/TempAirwaysAppli/MathLib - ${PROJECT_SOURCE_DIR}/appli/TempAirwaysAppli/AirwaysLib - ${PROJECT_BINARY_DIR}/appli/TempAirwaysAppli/MathLib - ${PROJECT_BINARY_DIR}/appli/TempAirwaysAppli/AirwaysLib + ${CMAKE_CURRENT_SOURCE_DIR}/../MathLib + ${CMAKE_CURRENT_BINARY_DIR}/../MathLib ) ## =============== ## = Source code = ## =============== -FILE(GLOB lib_HEADERS_H "*.h") -FILE(GLOB lib_HEADERS_HPP "*.hpp") -FILE(GLOB lib_HEADERS_HXX "*.hxx") -FILE(GLOB lib_SOURCES_C "*.c") -FILE(GLOB lib_SOURCES_CPP "*.cpp") -FILE(GLOB lib_SOURCES_CXX "*.cxx") +FILE(GLOB lib_HEADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +FILE(GLOB lib_HEADERS_HPP "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +FILE(GLOB lib_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +FILE(GLOB lib_SOURCES_C "${CMAKE_CURRENT_SOURCE_DIR}/*.c") +FILE(GLOB lib_SOURCES_CPP "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +FILE(GLOB lib_SOURCES_CXX "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") ## ===================== ## = Compilation rules = @@ -40,6 +38,6 @@ GENERATE_EXPORT_HEADER( EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${lib_NAME}_Export.h STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC ) -TARGET_LINK_LIBRARIES(${lib_NAME} MathLib ${ITK_LIBRARIES} ${VTK_LIBRARIES}) +TARGET_LINK_LIBRARIES(${lib_NAME} TempAirwaysAppli_MathLib ${ITK_LIBRARIES} ${VTK_LIBRARIES}) ## eof - $RCSfile$ diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysEdge.cxx b/lib/Airways/AirwaysLib/airwaysEdge.cxx similarity index 100% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysEdge.cxx rename to lib/Airways/AirwaysLib/airwaysEdge.cxx diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysEdge.h b/lib/Airways/AirwaysLib/airwaysEdge.h similarity index 98% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysEdge.h rename to lib/Airways/AirwaysLib/airwaysEdge.h index fe7adf1..8157793 100644 --- a/appli/TempAirwaysAppli/AirwaysLib/airwaysEdge.h +++ b/lib/Airways/AirwaysLib/airwaysEdge.h @@ -16,7 +16,7 @@ #include "airwaysNode.h" #include "Quaternion.h" -#include +#include /** * @brief Airways project namespace @@ -43,7 +43,7 @@ class Node; * This means that the edge source corresponds to the father and the target to the child. This implies that the root * node has a NULL edge. */ -class AirwaysLib_EXPORT Edge +class TempAirwaysAppli_AirwaysLib_EXPORT Edge { public: /*! diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysNode.cxx b/lib/Airways/AirwaysLib/airwaysNode.cxx similarity index 100% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysNode.cxx rename to lib/Airways/AirwaysLib/airwaysNode.cxx diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysNode.h b/lib/Airways/AirwaysLib/airwaysNode.h similarity index 99% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysNode.h rename to lib/Airways/AirwaysLib/airwaysNode.h index f002038..cdffe31 100644 --- a/appli/TempAirwaysAppli/AirwaysLib/airwaysNode.h +++ b/lib/Airways/AirwaysLib/airwaysNode.h @@ -16,7 +16,7 @@ #include "../MathLib/vec3.h" #include "airwaysEdge.h" #include "Quaternion.h" -#include +#include // Namespaces using namespace std; @@ -30,7 +30,7 @@ class Edge; /* * This class represents a node in a tree. */ -class AirwaysLib_EXPORT Node +class TempAirwaysAppli_AirwaysLib_EXPORT Node { public: diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysTree.cxx b/lib/Airways/AirwaysLib/airwaysTree.cxx similarity index 100% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysTree.cxx rename to lib/Airways/AirwaysLib/airwaysTree.cxx diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysTree.h b/lib/Airways/AirwaysLib/airwaysTree.h similarity index 99% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysTree.h rename to lib/Airways/AirwaysLib/airwaysTree.h index 0134708..9b9775d 100644 --- a/appli/TempAirwaysAppli/AirwaysLib/airwaysTree.h +++ b/lib/Airways/AirwaysLib/airwaysTree.h @@ -28,7 +28,7 @@ #include "itkImageRegionIterator.h" #include "itkLineIterator.h" #include -#include +#include namespace airways { @@ -59,7 +59,7 @@ typedef std::vector Vector_Pair_PairNodes_Score; */ typedef std::vector vec_pair_posVox_rad; -class AirwaysLib_EXPORT AirwaysTree +class TempAirwaysAppli_AirwaysLib_EXPORT AirwaysTree { public: diff --git a/appli/TempAirwaysAppli/AirwaysLib/airwaysTreeTypeDefinition.h b/lib/Airways/AirwaysLib/airwaysTreeTypeDefinition.h similarity index 100% rename from appli/TempAirwaysAppli/AirwaysLib/airwaysTreeTypeDefinition.h rename to lib/Airways/AirwaysLib/airwaysTreeTypeDefinition.h diff --git a/lib/Airways/CMakeLists.txt b/lib/Airways/CMakeLists.txt new file mode 100644 index 0000000..b609a0d --- /dev/null +++ b/lib/Airways/CMakeLists.txt @@ -0,0 +1,6 @@ +SUBDIRS( + MathLib + AirwaysLib + ) + +## eof - $RCSfile$ diff --git a/appli/TempAirwaysAppli/MathLib/CMakeLists.txt b/lib/Airways/MathLib/CMakeLists.txt similarity index 58% rename from appli/TempAirwaysAppli/MathLib/CMakeLists.txt rename to lib/Airways/MathLib/CMakeLists.txt index 6812792..cc436e0 100644 --- a/appli/TempAirwaysAppli/MathLib/CMakeLists.txt +++ b/lib/Airways/MathLib/CMakeLists.txt @@ -2,18 +2,18 @@ ## = Set names and directories = ## ============================= -SET(lib_NAME MathLib) +SET(lib_NAME TempAirwaysAppli_MathLib) ## =============== ## = Source code = ## =============== -FILE(GLOB lib_HEADERS_H "*.h") -FILE(GLOB lib_HEADERS_HPP "*.hpp") -FILE(GLOB lib_HEADERS_HXX "*.hxx") -FILE(GLOB lib_SOURCES_C "*.c") -FILE(GLOB lib_SOURCES_CPP "*.cpp") -FILE(GLOB lib_SOURCES_CXX "*.cxx") +FILE(GLOB lib_HEADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +FILE(GLOB lib_HEADERS_HPP "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +FILE(GLOB lib_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +FILE(GLOB lib_SOURCES_C "${CMAKE_CURRENT_SOURCE_DIR}/*.c") +FILE(GLOB lib_SOURCES_CPP "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +FILE(GLOB lib_SOURCES_CXX "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") ## ===================== ## = Compilation rules = @@ -33,6 +33,5 @@ GENERATE_EXPORT_HEADER( EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${lib_NAME}_Export.h STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC ) -##TARGET_LINK_LIBRARIES(${lib_NAME}) ## eof - $RCSfile$ diff --git a/appli/TempAirwaysAppli/MathLib/Quaternion.cpp b/lib/Airways/MathLib/Quaternion.cpp similarity index 100% rename from appli/TempAirwaysAppli/MathLib/Quaternion.cpp rename to lib/Airways/MathLib/Quaternion.cpp diff --git a/appli/TempAirwaysAppli/MathLib/Quaternion.h b/lib/Airways/MathLib/Quaternion.h similarity index 97% rename from appli/TempAirwaysAppli/MathLib/Quaternion.h rename to lib/Airways/MathLib/Quaternion.h index ba02e86..9cef552 100644 --- a/appli/TempAirwaysAppli/MathLib/Quaternion.h +++ b/lib/Airways/MathLib/Quaternion.h @@ -15,7 +15,7 @@ //----------------- // OWN //----------------- -#include +#include #include "vec3.h" // Namespaces @@ -24,7 +24,7 @@ using namespace std; //------------------------------------------------------------------------------ // Class that represents a Quaterion with all its operations //------------------------------------------------------------------------------ -class MathLib_EXPORT Quaternion +class TempAirwaysAppli_MathLib_EXPORT Quaternion { public: diff --git a/appli/TempAirwaysAppli/MathLib/vec3.cxx b/lib/Airways/MathLib/vec3.cxx similarity index 100% rename from appli/TempAirwaysAppli/MathLib/vec3.cxx rename to lib/Airways/MathLib/vec3.cxx diff --git a/appli/TempAirwaysAppli/MathLib/vec3.h b/lib/Airways/MathLib/vec3.h similarity index 98% rename from appli/TempAirwaysAppli/MathLib/vec3.h rename to lib/Airways/MathLib/vec3.h index 22f9ee3..6adbe42 100644 --- a/appli/TempAirwaysAppli/MathLib/vec3.h +++ b/lib/Airways/MathLib/vec3.h @@ -7,7 +7,7 @@ #ifndef VEC3_H #define VEC3_H -#include +#include #include #include #include // std::numeric_limits @@ -16,7 +16,7 @@ /** * @brief The Vec3 class that represents a vector in 3D */ -class MathLib_EXPORT Vec3 +class TempAirwaysAppli_MathLib_EXPORT Vec3 { private: float x, y, z; //!< Coordinates diff --git a/lib/Airways/fpa2Airways/Converter.h b/lib/Airways/fpa2Airways/Converter.h new file mode 100644 index 0000000..da2f214 --- /dev/null +++ b/lib/Airways/fpa2Airways/Converter.h @@ -0,0 +1,43 @@ +#ifndef __FPA2AIRWAYS__CONVERTER__H__ +#define __FPA2AIRWAYS__CONVERTER__H__ + +#include +#include + +namespace fpa2Airways +{ + /** + */ + template< class _TSkeleton, class _TAirways > + class Converter + : public itk::ProcessObject + { + public: + itkNewMacro( Self ); + itkTypeMacro( Converter, itk::ProcessObject ); + + public: + SetInput( TSkeleton ); + TAirways GetOutput( ); + + protected: + Converter( ); + virtual ~Converter( ); + + virtual void GenerateData( ) ITK_OVERRIDE; + + private: + // Purposely not implemented. + Converter( const Self& ); + Self& operator=( const Self& ); + }; + +} // ecapseman + +#ifndef ITK_MANUAL_INSTANTIATION +#include +#endif // ITK_MANUAL_INSTANTIATION + +#endif // __FPA2AIRWAYS__CONVERTER__H__ + +// eof - $RCSfile$ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a497978..0afa2df 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,3 +1,8 @@ +IF(BUILD_TempAirwaysAppli) + SUBDIRS( + Airways + ) +ENDIF(BUILD_TempAirwaysAppli) IF(BUILD_PLUGINS) SUBDIRS( fpa_Instances diff --git a/lib/fpa/Base/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx b/lib/fpa/Base/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx index afb5252..82debb4 100644 --- a/lib/fpa/Base/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx +++ b/lib/fpa/Base/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx @@ -120,7 +120,7 @@ GenerateData( ) auto vertex = qIt->second; // 2.1. Check if the vertex has already been visited - if( this->_Mark( vertex ) > 0 ) + if( this->_Mark( vertex ) > 0 || this->_SkeletonMark( vertex ) > 0 ) continue; // 2.2. Get path from front seed @@ -144,8 +144,8 @@ GenerateData( ) bifurcations->Get( ).push_back( *pIt ); // Reorder labels - auto coll_branch = this->m_Branches[ mark ]; - this->m_Branches[ mark ] = _TBranch( coll_branch.first, *pIt ); + auto coll_branch = this->m_Branches[ mark - 1 ]; + this->m_Branches[ mark - 1 ] = _TBranch( coll_branch.first, *pIt ); this->m_Branches[ label - 1 ] = _TBranch( qIt->second, *pIt ); this->m_Branches.push_back( _TBranch( *pIt, coll_branch.second ) ); @@ -157,6 +157,8 @@ GenerateData( ) pIt++; } // elihw + if( pIt != path.end( ) ) + this->_MarkSkeleton( *pIt, label ); // Force inner loop termination pIt = path.end( ); @@ -198,6 +200,18 @@ GenerateData( ) } // rof + // Remove illegal branches + auto dIt = this->m_Branches.begin( ); + while( dIt != this->m_Branches.end( ) ) + { + if( dIt->first == dIt->second ) + dIt = this->m_Branches.erase( dIt ); + else + dIt++; + + } // fi + + // Finish endpoints->SetReferenceImage( mst ); bifurcations->SetReferenceImage( mst ); collisions->SetReferenceImage( mst ); diff --git a/lib/fpa/Base/ImageSkeleton.hxx b/lib/fpa/Base/ImageSkeleton.hxx index 9625795..747d9de 100644 --- a/lib/fpa/Base/ImageSkeleton.hxx +++ b/lib/fpa/Base/ImageSkeleton.hxx @@ -11,9 +11,9 @@ AddBranch( const TVertex& a, const TVertex& b ) // Check if the branch already exists bool found = false; - auto arIt = this->Get( ).find( a ); - if( arIt != this->Get( ).end( ) ) - found = ( arIt->second.find( b ) != arIt->second.end( ) ); + auto aIt = this->Get( ).find( a ); + if( aIt != this->Get( ).end( ) ) + found = ( aIt->second.find( b ) != aIt->second.end( ) ); if( found ) return; @@ -25,8 +25,24 @@ AddBranch( const TVertex& a, const TVertex& b ) // Assign path vertices path->SetReferenceImage( this->m_MinimumSpanningTree ); - this->Get( )[ a ][ b ] = path; - this->Modified( ); + + typedef typename TSkeleton::value_type _T1; + typedef typename TSkeletonRow::value_type _T2; + + TSkeleton& sk = this->Get( ); + auto sIt = sk.find( a ); + if( sIt == sk.end( ) ) + { + sIt = sk.insert( _T1( a, TSkeletonRow( ) ) ).first; + this->Modified( ); + + } // fi + if( sIt->second.find( b ) == sIt->second.end( ) ) + { + sIt->second.insert( _T2( b, path ) ); + this->Modified( ); + + } // fi } // ------------------------------------------------------------------------- diff --git a/lib/fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx b/lib/fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx index a089fed..789d392 100644 --- a/lib/fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx +++ b/lib/fpa/Image/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.hxx @@ -188,9 +188,11 @@ _MarkSphere( { typename _TImage::PointType pnt; this->m_MarkImage->TransformIndexToPhysicalPoint( spIt.GetIndex( ), pnt ); - if( double( pnt.EuclideanDistanceTo( c ) ) <= rr || all ) + /* + if( double( pnt.EuclideanDistanceTo( c ) ) <= rr || all ) if( spIt.Get( ) == 0 ) - spIt.Set( l ); + */ + spIt.Set( l ); } // rof } -- 2.47.1