## == Functions, packages and options ==
## =====================================
-INCLUDE(cmake/DetectOS.cmake)
INCLUDE(cmake/Restrictions.cmake)
INCLUDE(cmake/Functions.cmake)
INCLUDE(cmake/KitwareTools.cmake)
ADD_EXECUTABLE(fpa_examples_ImageDijkstra ImageDijkstra.cxx)
-TARGET_LINK_LIBRARIES(fpa_examples_ImageDijkstra ${ITK_LIBRARIES})
+TARGET_LINK_LIBRARIES(fpa_examples_ImageDijkstra ${ITK_LIBRARIES} ${VTK_LIBRARIES})
## eof - $RCSfile$
+++ /dev/null
-## =====================
-## == OS-based values ==
-## =====================
-
-SET(prj_NAME_OS "${prj_NAME}_OS_${CMAKE_SYSTEM_NAME}")
-IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
- SET(prj_NAME_LIB_PREFIX "lib")
- SET(prj_NAME_LIB_EXT ".so")
- SET(prj_NAME_ENV_SEPARATOR ":")
- SET(prj_NAME_PATH_SEPARATOR "/")
-ELSEIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
- SET(prj_NAME_LIB_PREFIX "lib")
- SET(prj_NAME_LIB_EXT ".dylib")
- SET(prj_NAME_ENV_SEPARATOR ":")
- SET(prj_NAME_PATH_SEPARATOR "/")
-ELSEIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
- SET(prj_NAME_LIB_PREFIX "")
- SET(prj_NAME_LIB_EXT ".dll")
- SET(prj_NAME_ENV_SEPARATOR ";")
- SET(prj_NAME_PATH_SEPARATOR "\\")
-ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
-
-## eof - $RCSfile$
FUNCTION(
CreateLib
lib_name
+ lib_dir
lib_type
lib_source_files
lib_header_files
## -- Ok, compile library
IF(_sources)
NormPaths(_cur_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
- ADD_LIBRARY(${lib_name} SHARED ${_sources} ${_headers})
+ ADD_LIBRARY(${lib_name} ${lib_type} ${_sources} ${_headers})
SET_TARGET_PROPERTIES(
${lib_name}
PROPERTIES
FUNCTION(
LibFromDir
lib_name
+ lib_dir
lib_type
lib_source_dir
lib_version
## -- Create library
CreateLib(
- ${lib_name} ${lib_type}
+ ${lib_name} ${lib_dir} ${lib_type}
"${_sources}" "${_headers}" "${_qt_uis}"
"${lib_version}" "${lib_short_version}"
)
FUNCTION(
CompileInstances
out_lib_name
+ lib_dir
def_file
number_of_files
prefix
## -- Create library
CreateLib(
- "${_lib_name}" SHARED
+ "${_lib_name}" ${lib_dir} SHARED
"${_all_out_code}" "${_out_header}" ""
"${version}" "${short_version}"
)
## -- Ok, build library
IF(_all_src)
CreateLib(
- ${_lib_name} SHARED
+ ${_lib_name} leo SHARED
"${_all_src}" "${_all_hdr}" "${_qt_ui}"
"${version}" "${short_version}"
${ARGN}
LibFromDir(
fpa
+ ${PROJECT_BINARY_DIR}/lib
SHARED
${CMAKE_CURRENT_SOURCE_DIR}/fpa
"${prj_VERSION}" "${prj_SHORT_VERSION}"
FOREACH(_instance ${_instances})
CompileInstances(
_lib_name
+ ${PROJECT_BINARY_DIR}/lib
${_instance} ${cpPlugins_NUMBER_OF_FILES}
"" "${prj_VERSION}" "${prj_SHORT_VERSION}"
)
## == Links ==
## ===========
-TARGET_LINK_LIBRARIES(fpa_DataObjects ${ITK_LIBRARIES} ${cpPlugins_BaseObjects_LIB} ${cpPlugins_Images_LIB})
-TARGET_LINK_LIBRARIES(fpa_Filters fpa_DataObjects ${cpPlugins_ImageFilters_LIB})
+TARGET_LINK_LIBRARIES(
+ fpa_DataObjects
+ ${ITK_LIBRARIES} ${VTK_LIBRARIES}
+ ${cpPlugins_BaseObjects_LIB}
+ ${cpPlugins_Images_LIB} ${cpPlugins_Paths_LIB}
+ )
+TARGET_LINK_LIBRARIES(
+ fpa_Filters
+ fpa_DataObjects
+ ${cpPlugins_ImageFilters_LIB}
+ )
## ===================================
## == Libraries to dynamically load ==
SET(fpa_DynLibs)
FOREACH(_lib ${fpa_Instances})
- LIST(APPEND fpa_DynLibs local@${_lib})
+ LIST(APPEND fpa_DynLibs "${CMAKE_INSTALL_PREFIX}/bin|${_lib}")
+ LIST(APPEND fpa_DynLibs "${CMAKE_INSTALL_PREFIX}/lib|${_lib}")
+ LIST(APPEND fpa_DynLibs "${LIBRARY_OUTPUT_PATH}|${_lib}")
ENDFOREACH(_lib)
FILE(WRITE ${PROJECT_BINARY_DIR}/cpPlugins_Libraries.config "")
FOREACH(_lib ${fpa_DynLibs})
+i cpPlugins_Paths.h
t fpa/Image/MinimumSpanningTree
t fpa/Base/MinimumSpanningTree
-c fpa::Base::MinimumSpanningTree< itk::Index< #process_dims# >, itk::Image< itk::Offset< #process_dims# >, #process_dims# > >
-c fpa::Image::MinimumSpanningTree< #process_dims# >
+c fpa::Base::MinimumSpanningTree< itk::Index< #process_dims# >, cpExtensions::DataStructures::PolyLineParametricPath< #process_dims# >, itk::Image< itk::Offset< #process_dims# >, #process_dims# > >
+* c fpa::Image::MinimumSpanningTree< #process_dims# >
-** eof - $RCSfile$
\ No newline at end of file
+** eof - $RCSfile$
c fpa::Base::Algorithm< itk::ImageToImageFilter< itk::Image< #i_pixels#, #process_dims# >, itk::Image< #o_pixels#, #process_dims# > >, itk::Index< #process_dims# >, #o_pixels# >
c fpa::Image::Algorithm< itk::Image< #i_pixels#, #process_dims# >, itk::Image< #o_pixels#, #process_dims# > >
-** eof - $RCSfile$
\ No newline at end of file
+** eof - $RCSfile$
#define __fpa__Base__MinimumSpanningTree__h__
#include <fpa/Config.h>
-#include <deque>
#include <vector>
#include <utility>
#include <itkObject.h>
{
/**
*/
- template< class _TVertex, class _TSuperclass >
+ template< class _TVertex, class _TPath, class _TSuperclass >
class MinimumSpanningTree
: public _TSuperclass
{
typedef itk::SmartPointer< const Self > ConstPointer;
typedef _TVertex TVertex;
- typedef std::deque< _TVertex > TVertices;
+ typedef _TPath TPath;
typedef std::pair< _TVertex, bool > TCollision;
typedef std::vector< TCollision > TCollisionsRow;
typedef std::vector< TCollisionsRow > TCollisions;
virtual _TVertex GetParent( const _TVertex& v ) const = 0;
virtual void SetParent( const _TVertex& v, const _TVertex& p ) = 0;
- virtual TVertices GetPath( const _TVertex& a ) const;
- virtual TVertices GetPath( const _TVertex& a, const _TVertex& b ) const;
+ virtual void GetPath(
+ typename _TPath::Pointer& path, const _TVertex& a
+ ) const;
+ virtual void GetPath(
+ typename _TPath::Pointer& path, const _TVertex& a, const _TVertex& b
+ ) const;
protected:
MinimumSpanningTree( );
protected:
TCollisions m_Collisions;
_TMatrix m_FrontPaths;
- TVertices m_Seeds;
+ std::vector< _TVertex > m_Seeds;
};
} // ecapseman
#include <limits>
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-const typename fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
-TCollisions& fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+const typename
+fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+TCollisions&
+fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
GetCollisions( ) const
{
return( this->m_Collisions );
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
SetCollisions( const TCollisions& collisions )
{
static const unsigned long _inf =
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
ClearSeeds( )
{
this->m_Seeds.clear( );
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
AddSeed( const _TVertex& seed )
{
this->m_Seeds.push_back( seed );
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-typename fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
-TVertices fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
-GetPath( const _TVertex& a ) const
+template< class _TVertex, class _TPath, class _TSuperclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+GetPath( typename _TPath::Pointer& path, const _TVertex& a ) const
{
- TVertices path;
+ std::vector< _TVertex > vertices;
_TVertex it = a;
_TVertex p = this->GetParent( it );
while( it != p )
{
- path.push_front( it );
+ vertices.push_back( it );
it = p;
p = this->GetParent( it );
} // elihw
- path.push_front( it );
- return( path );
+ vertices.push_back( it );
+
+ path = _TPath::New( );
+ for( auto v = vertices.begin( ); v != vertices.end( ); ++v )
+ path->AddVertex( *v );
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-typename fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
-TVertices fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
-GetPath( const _TVertex& a, const _TVertex& b ) const
+template< class _TVertex, class _TPath, class _TSuperclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+GetPath(
+ typename _TPath::Pointer& path, const _TVertex& a, const _TVertex& b
+ ) const
{
+/*
static const unsigned long _inf =
std::numeric_limits< unsigned long >::max( );
- TVertices path;
- TVertices pa = this->GetPath( a );
- TVertices pb = this->GetPath( b );
+ _TPath path;
+ _TPath pa = this->GetPath( a );
+ _TPath pb = this->GetPath( b );
if( pa.size( ) > 0 && pb.size( ) > 0 )
{
// Find front identifiers
} // fi
return( path );
+*/
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
MinimumSpanningTree( )
: Superclass( )
{
}
// -------------------------------------------------------------------------
-template< class _TVertex, class _TSuperclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _TSuperclass >::
+template< class _TVertex, class _TPath, class _TSuperclass >
+fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
~MinimumSpanningTree( )
{
}
void fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
Compute( )
{
- typedef itk::ImageRegionConstIteratorWithIndex< _TDistanceMap > _TDistMapIt;
- typedef itk::ImageRegionConstIteratorWithIndex< _TCostMap > _TCostMapIt;
- typedef std::multimap< double, TIndex, std::greater< double > > _TQueue;
- typedef typename _TQueue::value_type _TQueueValue;
-
- // Create queue
- _TQueue queue;
- _TDistMapIt dIt(
- this->m_DistanceMap, this->m_DistanceMap->GetRequestedRegion( )
- );
- _TCostMapIt cIt(
- this->m_CostMap, this->m_CostMap->GetRequestedRegion( )
- );
- dIt.GoToBegin( );
- cIt.GoToBegin( );
- for( ; !dIt.IsAtEnd( ) && !cIt.IsAtEnd( ); ++dIt, ++cIt )
- {
- double d = double( dIt.Get( ) );
- if( d > 0 )
- {
- double v = double( cIt.Get( ) ) * d;
- queue.insert( _TQueueValue( v, dIt.GetIndex( ) ) );
-
- } // fi
-
- } // rof
-
- TIndices marks;
- while( queue.size( ) > 0 )
- {
- auto nIt = queue.begin( );
- auto n = *nIt;
- queue.erase( nIt );
-
- if( marks.find( n.second ) == marks.end( ) )
- {
- std::cout << queue.size( ) << " " << n.first << std::endl;
- marks.insert( n.second );
- this->m_EndPoints.insert( n.second );
- auto path = this->m_MST->GetPath( n.second );
- std::cout << path.size( ) << std::endl;
- for( auto pIt = path.begin( ); pIt != path.end( ); ++pIt )
- {
- double d = double( this->m_DistanceMap->GetPixel( *pIt ) );
- d = std::sqrt( std::fabs( d ) );
- typename _TCostMap::PointType center;
- this->m_CostMap->TransformIndexToPhysicalPoint( *pIt, center );
-
- std::queue< TIndex > q;
- TIndices m;
- q.push( *pIt );
- while( q.size( ) > 0 )
- {
- TIndex idx = q.front( );
- q.pop( );
- if( m.find( idx ) != m.end( ) )
- continue;
- m.insert( idx );
- marks.insert( idx );
- for( unsigned int x = 0; x < _TCostMap::ImageDimension; ++x )
- {
- for( int y = -1; y <= 1; y += 2 )
- {
- TIndex idx2 = idx;
- idx2[ x ] += y;
- typename _TCostMap::PointType c;
- this->m_CostMap->TransformIndexToPhysicalPoint( idx2, c );
- if( this->m_CostMap->GetRequestedRegion( ).IsInside( idx2 ) )
- {
- if( center.EuclideanDistanceTo( c ) <= ( d * 1.5 ) )
- q.push( idx2 );
-
- } // fi
-
- } // rof
-
- } // rof
-
- } // elihw
-
- } // rof
-
- } // fi
-
- } // elihw
+ /* TODO
+ typedef itk::ImageRegionConstIteratorWithIndex< _TDistanceMap > _TDistMapIt;
+ typedef itk::ImageRegionConstIteratorWithIndex< _TCostMap > _TCostMapIt;
+ typedef std::multimap< double, TIndex, std::greater< double > > _TQueue;
+ typedef typename _TQueue::value_type _TQueueValue;
+
+ // Create queue
+ _TQueue queue;
+ _TDistMapIt dIt(
+ this->m_DistanceMap, this->m_DistanceMap->GetRequestedRegion( )
+ );
+ _TCostMapIt cIt(
+ this->m_CostMap, this->m_CostMap->GetRequestedRegion( )
+ );
+ dIt.GoToBegin( );
+ cIt.GoToBegin( );
+ for( ; !dIt.IsAtEnd( ) && !cIt.IsAtEnd( ); ++dIt, ++cIt )
+ {
+ double d = double( dIt.Get( ) );
+ if( d > 0 )
+ {
+ double v = double( cIt.Get( ) ) * d;
+ queue.insert( _TQueueValue( v, dIt.GetIndex( ) ) );
+
+ } // fi
+
+ } // rof
+
+ TIndices marks;
+ while( queue.size( ) > 0 )
+ {
+ auto nIt = queue.begin( );
+ auto n = *nIt;
+ queue.erase( nIt );
+
+ if( marks.find( n.second ) == marks.end( ) )
+ {
+ std::cout << queue.size( ) << " " << n.first << std::endl;
+ marks.insert( n.second );
+ this->m_EndPoints.insert( n.second );
+ auto path = this->m_MST->GetPath( n.second );
+ std::cout << path.size( ) << std::endl;
+ for( auto pIt = path.begin( ); pIt != path.end( ); ++pIt )
+ {
+ double d = double( this->m_DistanceMap->GetPixel( *pIt ) );
+ d = std::sqrt( std::fabs( d ) );
+ typename _TCostMap::PointType center;
+ this->m_CostMap->TransformIndexToPhysicalPoint( *pIt, center );
+
+ std::queue< TIndex > q;
+ TIndices m;
+ q.push( *pIt );
+ while( q.size( ) > 0 )
+ {
+ TIndex idx = q.front( );
+ q.pop( );
+ if( m.find( idx ) != m.end( ) )
+ continue;
+ m.insert( idx );
+ marks.insert( idx );
+ for( unsigned int x = 0; x < _TCostMap::ImageDimension; ++x )
+ {
+ for( int y = -1; y <= 1; y += 2 )
+ {
+ TIndex idx2 = idx;
+ idx2[ x ] += y;
+ typename _TCostMap::PointType c;
+ this->m_CostMap->TransformIndexToPhysicalPoint( idx2, c );
+ if( this->m_CostMap->GetRequestedRegion( ).IsInside( idx2 ) )
+ {
+ if( center.EuclideanDistanceTo( c ) <= ( d * 1.5 ) )
+ q.push( idx2 );
+
+ } // fi
+
+ } // rof
+
+ } // rof
+
+ } // elihw
+
+ } // rof
+
+ } // fi
+
+ } // elihw
+ */
}
// -------------------------------------------------------------------------
#define __fpa__Image__MinimumSpanningTree__h__
#include <fpa/Base/MinimumSpanningTree.h>
+#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
#include <itkImage.h>
namespace fpa
*/
template< unsigned int _VDim >
class MinimumSpanningTree
- : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
+ : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, cpExtensions::DataStructures::PolyLineParametricPath< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
{
public:
typedef itk::Index< _VDim > TVertex;
- typedef itk::Offset< _VDim > TOffset;
- typedef itk::Image< TOffset, _VDim > TImage;
- typedef fpa::Base::MinimumSpanningTree< TVertex, TImage > Superclass;
- typedef MinimumSpanningTree Self;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- typedef typename Superclass::TVertices TVertices;
- typedef typename TImage::PointType TPoint;
- typedef std::deque< TPoint > TPoints;
+ typedef cpExtensions::DataStructures::PolyLineParametricPath< _VDim > TPath;
+ typedef itk::Offset< _VDim > TOffset;
+ typedef itk::Image< TOffset, _VDim > TImage;
+ typedef fpa::Base::MinimumSpanningTree< TVertex, TPath, TImage > Superclass;
+ typedef MinimumSpanningTree Self;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
public:
itkNewMacro( Self );
virtual TVertex GetParent( const TVertex& v ) const fpa_OVERRIDE;
virtual void SetParent( const TVertex& v, const TVertex& p ) fpa_OVERRIDE;
- TPoints GetEuclideanPath( const TVertex& a ) const;
- TPoints GetEuclideanPath( const TVertex& a, const TVertex& b ) const;
+ virtual void GetPath(
+ typename TPath::Pointer& path, const TVertex& a
+ ) const fpa_OVERRIDE;
+ virtual void GetPath(
+ typename TPath::Pointer& path, const TVertex& a, const TVertex& b
+ ) const fpa_OVERRIDE;
protected:
MinimumSpanningTree( );
// -------------------------------------------------------------------------
template< unsigned int _VDim >
-typename fpa::Image::MinimumSpanningTree< _VDim >::
-TPoints fpa::Image::MinimumSpanningTree< _VDim >::
-GetEuclideanPath( const TVertex& a ) const
+void fpa::Image::MinimumSpanningTree< _VDim >::
+GetPath( typename TPath::Pointer& path, const TVertex& a ) const
{
- TVertices path = this->GetPath( a );
- TPoints points;
- for( auto v = path.begin( ); v != path.end( ); ++v )
- {
- TPoint p;
- this->TransformIndexToPhysicalPoint( *v, p );
- points.push_back( p );
-
- } // rof
- return( points );
+ this->Superclass::GetPath( path, a );
+ path->SetReferenceImage( this );
}
// -------------------------------------------------------------------------
template< unsigned int _VDim >
-typename fpa::Image::MinimumSpanningTree< _VDim >::
-TPoints fpa::Image::MinimumSpanningTree< _VDim >::
-GetEuclideanPath( const TVertex& a, const TVertex& b ) const
+void fpa::Image::MinimumSpanningTree< _VDim >::
+GetPath(
+ typename TPath::Pointer& path, const TVertex& a, const TVertex& b
+ ) const
{
- TVertices path = this->GetPath( a, b );
- TPoints points;
- for( auto v = path.begin( ); v != path.end( ); ++v )
- {
- TPoint p;
- this->TransformIndexToPhysicalPoint( *v, p );
- points.push_back( p );
-
- } // rof
- return( points );
+ this->Superclass::GetPath( path, a, b );
+ path->SetReferenceImage( this );
}
// -------------------------------------------------------------------------
#include <plugins/Plugins/ExtractPathFromMinimumSpanningTree.h>
#include <cpPlugins/DataObjects/Image.h>
-#include <cpPlugins/DataObjects/Mesh.h>
+#include <cpPlugins/DataObjects/PolyLineParametricPath.h>
#include <fpa_DataObjects.h>
-
-/* TODO
- #include <vtkFloatArray.h>
- #include <vtkPointData.h>
-*/
+#include <vtkPolyData.h>
// -------------------------------------------------------------------------
fpaPlugins::ExtractPathFromMinimumSpanningTree::
ExtractPathFromMinimumSpanningTree( )
: Superclass( )
{
- typedef cpPlugins::BaseObjects::DataObject _TData;
- typedef cpPlugins::DataObjects::Image _TMST;
- typedef cpPlugins::DataObjects::Mesh _TMesh;
+ typedef cpPlugins::BaseObjects::DataObject _TData;
+ typedef cpPlugins::DataObjects::Image _TMST;
+ typedef cpPlugins::DataObjects::PolyLineParametricPath _TPath;
this->_ConfigureInput< _TMST >( "MST", true, false );
this->_ConfigureInput< _TData >( "Seeds", true, false );
- this->_ConfigureOutput< _TMesh >( "Paths" );
-
- this->m_Parameters.ConfigureAsUintList( "Indices" );
+ this->_ConfigureOutput< _TPath >( "Paths" );
}
// -------------------------------------------------------------------------
_GD0( _TMST* mst )
{
typedef typename _TMST::IndexType _TIndex;
+ typedef typename _TMST::TPath _TPath;
// Get seeds
std::vector< _TIndex > seeds;
auto points = this->GetInputData< vtkPolyData >( "Seeds" );
if( points != NULL )
{
+ if( points->GetNumberOfPoints( ) < 2 )
+ this->_Error( "Not enough seeds (<2)." );
+
typename _TMST::PointType pnt;
typename _TMST::IndexType idx;
unsigned int dim =
( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
- for( unsigned int i = 0; i < points->GetNumberOfPoints( ); ++i )
+ for( unsigned int i = 0; i < 2; ++i )
{
double buf[ 3 ];
points->GetPoint( i, buf );
} // fi
- // Prepare result
- auto mesh = this->_CreateVTK< vtkPolyData >( );
- mesh->SetPoints( vtkSmartPointer< vtkPoints >::New( ) );
- mesh->SetVerts( vtkSmartPointer< vtkCellArray >::New( ) );
- mesh->SetLines( vtkSmartPointer< vtkCellArray >::New( ) );
- mesh->SetPolys( vtkSmartPointer< vtkCellArray >::New( ) );
- mesh->SetStrips( vtkSmartPointer< vtkCellArray >::New( ) );
- /* TODO
- vtkSmartPointer< vtkFloatArray > data =
- vtkSmartPointer< vtkFloatArray >::New( );
- data->SetNumberOfComponents( 1 );
- mesh->GetPointData( )->SetScalars( data );
- */
-
- // Compute
- auto indices = this->m_Parameters.GetUintList( "Indices" );
- for( unsigned int i = 0; i < indices.size( ); i += 2 )
- {
- if( i < indices.size( ) - 1 )
- {
- _TIndex a = seeds[ indices[ i ] ];
- _TIndex b = seeds[ indices[ i + 1 ] ];
-
- auto path = mst->GetEuclideanPath( a, b );
- for( unsigned long j = 0; j < path.size( ); ++j )
- {
- auto p = path[ j ];
- if( _TMST::ImageDimension == 2 )
- mesh->GetPoints( )->InsertNextPoint( p[ 0 ], p[ 1 ], 0 );
- else if( _TMST::ImageDimension == 3 )
- mesh->GetPoints( )->InsertNextPoint( p[ 0 ], p[ 1 ], p[ 2 ] );
- if( j > 0 )
- {
- mesh->GetLines( )->InsertNextCell( 2 );
- mesh->GetLines( )->InsertCellPoint( j - 1 );
- mesh->GetLines( )->InsertCellPoint( j );
-
- } // fi
-
- } // rof
-
- } // fi
-
- } // rof
- this->GetOutput( "Paths" )->SetVTK( mesh );
+ typename _TPath::Pointer path;
+ mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
+ this->GetOutput( "Paths" )->SetITK( path );
}
// eof - $RCSfile$