virtual ~Dijkstra( );
virtual void _AfterGenerateData( ) override;
- virtual void _UpdateOutputValue( const TNode& n ) override;
+ virtual void _UpdateOutputValue( TNode& n ) override;
private:
// Purposely not implemented.
// -------------------------------------------------------------------------
template< class _TAlgorithm, class _TMST >
void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-_UpdateOutputValue( const TNode& n )
+_UpdateOutputValue( TNode& n )
{
this->Superclass::_UpdateOutputValue( n );
this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
DijkstraBase( );
virtual ~DijkstraBase( );
- virtual TOutputValue _ComputeOutputValue( const TNode& n ) override;
+ virtual void _ComputeOutputValue( TNode& n ) override;
virtual void _QueueClear( ) override;
virtual TNode _QueuePop( ) override;
virtual void _QueuePush( const TNode& node ) override;
// -------------------------------------------------------------------------
template< class _TAlgorithm >
-typename fpa::Base::DijkstraBase< _TAlgorithm >::
-TOutputValue fpa::Base::DijkstraBase< _TAlgorithm >::
-_ComputeOutputValue( const TNode& n )
+void fpa::Base::DijkstraBase< _TAlgorithm >::
+_ComputeOutputValue( TNode& n )
{
TOutputValue c = this->m_WeightFunction->Evaluate( n.Vertex, n.Parent );
- return( c + this->_GetOutputValue( n.Parent ) );
+ n.Value = c + this->_GetOutputValue( n.Parent );
}
// -------------------------------------------------------------------------
virtual ~_TDijkstra( );
virtual void _BeforeGenerateData( ) override;
- virtual void _UpdateOutputValue( const TNode& n ) override;
+ virtual void _UpdateOutputValue( TNode& n ) override;
private:
// Purposely not implemented
// -------------------------------------------------------------------------
template< class _TInputImage, class _TDistanceMap >
void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::_TDijkstra::
-_UpdateOutputValue( const TNode& n )
+_UpdateOutputValue( TNode& n )
{
typedef typename _TSkeletonQueue::value_type _TSkeletonQueueValue;
RegionGrow_Tautology
RegionGrow_BinaryThreshold
MoriSegmentation
- # Dijkstra_Identity
- # Dijkstra_Gaussian
- # RandomWalker
- # SkeletonFilter
- # SkeletonToPolyData
+ Dijkstra_Identity
+ Dijkstra_Gaussian
+ RandomWalker
+ SkeletonFilter
+ SkeletonToPolyData
)
foreach(_e ${_examples})
add_executable(${_pfx}${_e} ${_e}.cxx)
int main( int argc, char* argv[] )
{
// Get arguments
- if( argc < 8 )
+ if( argc < 7 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
<< " input_image output_image output_marks alpha beta"
- << " stop_at_one_front visual_debug ..."
+ << " stop_at_one_front ..."
<< std::endl;
return( 1 );
double alpha = std::atoi( argv[ 4 ] );
double beta = std::atoi( argv[ 5 ] );
bool stop_at_one_front = ( argv[ 6 ][ 0 ] == '1' );
- bool visual_debug = ( argv[ 7 ][ 0 ] == '1' );
// Create image
TInputImage::Pointer image;
} // fi
- // Interact with image
- fpa::tests::image::Viewer< TFilter > viewer( image );
- if( visual_debug )
- {
- viewer.ActivateSeedWidget( );
- viewer.Show( );
-
- } // fi
-
// Prepare weight
TWeight::Pointer weight = TWeight::New( );
weight->SetAlpha( alpha );
filter->SetStopAtOneFront( stop_at_one_front );
// Get all seeds
- for( int i = 8; i < argc; i += 2 )
+ for( int i = 7; i < argc; i += 2 )
{
if( i + 1 < argc )
{
} // fi
} // rof
- viewer.AssociateSeedsTo( filter );
- // Prepare visual debug and update
- if( visual_debug )
- viewer.ObserveFilter( filter );
+ // Execute filter
filter->Update( );
// Save results
int main( int argc, char* argv[] )
{
// Get arguments
- if( argc < 6 )
+ if( argc < 5 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " output_image output_marks width height visual_debug ..."
+ << " output_image output_marks width height ..."
<< std::endl;
return( 1 );
std::string output_marks_filename = argv[ 2 ];
int width = std::atoi( argv[ 3 ] );
int height = std::atoi( argv[ 4 ] );
- bool visual_debug = ( argv[ 5 ][ 0 ] == '1' );
// Create image
TInputImage::Pointer image;
fpa::tests::image::CreateImage( image, 1, width, height, 1.0, 1.0 );
- // Interact with image
- fpa::tests::image::Viewer< TFilter > viewer( image );
- if( visual_debug )
- {
- viewer.ActivateSeedWidget( );
- viewer.Show( );
-
- } // fi
-
// Prepare weight
TWeight::Pointer weight = TWeight::New( );
filter->SetWeightFunction( weight );
// Get all seeds
- for( int i = 6; i < argc; i += 2 )
+ for( int i = 5; i < argc; i += 2 )
{
if( i + 1 < argc )
{
} // fi
} // rof
- viewer.AssociateSeedsTo( filter );
- // Prepare visual debug and update
- if( visual_debug )
- viewer.ObserveFilter( filter );
+ // Execute filter
filter->Update( );
// Save results
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " input_image [labels_image] output_image output_costs"
- << " alpha beta visual_debug"
+ << " input_image labels_image output_image output_costs"
+ << " alpha beta"
<< std::endl;
return( 1 );
} // fi
- int idx = ( argc == 7 )? 2: 3;
std::string input_image_filename = argv[ 1 ];
- std::string labels_image_filename = ( argc == 8 )? argv[ 2 ]: "";
- std::string output_image_filename = argv[ idx ];
- std::string output_costs_filename = argv[ idx + 1 ];
- double alpha = std::atof( argv[ idx + 2 ] );
- double beta = std::atof( argv[ idx + 3 ] );
- bool visual_debug = ( argv[ idx + 4 ][ 0 ] == '1' );
+ std::string labels_image_filename = argv[ 2 ];
+ std::string output_image_filename = argv[ 3 ];
+ std::string output_costs_filename = argv[ 4 ];
+ double alpha = std::atof( argv[ 5 ] );
+ double beta = std::atof( argv[ 6 ] );
// Read image
TInputImage::Pointer image;
// Read label
TLabelImage::Pointer labels;
- if( labels_image_filename != "" )
+ std::string err1 = fpa::tests::image::Read( labels, labels_image_filename );
+ if( err1 != "" )
{
- std::string err1 = fpa::tests::image::Read( labels, labels_image_filename );
- if( err1 != "" )
- {
- std::cerr << "Error caught: " << err1 << std::endl;
- return( 1 );
-
- } // fi
-
- } // fi
-
- // Interact with image
- fpa::tests::image::Viewer< TFilter > viewer( image );
- if( visual_debug )
- {
- if( labels.IsNull( ) )
- viewer.ActivateBrushWidget( );
- viewer.Show( );
+ std::cerr << "Error caught: " << err1 << std::endl;
+ return( 1 );
} // fi
TFilter::Pointer filter = TFilter::New( );
filter->SetInput( image );
filter->SetWeightFunction( weight );
- if( labels.IsNull( ) )
- viewer.AssociateLabelsTo( filter );
- else
- filter->SetLabels( labels );
+ filter->SetLabels( labels );
- // Prepare visual debug and update
- if( visual_debug )
- viewer.ObserveFilter( filter );
+ // Execute filter
try
{
filter->Update( );
} // yrt
// Save results
- std::string err1 =
- fpa::tests::image::Write( filter->GetMarks( ), output_image_filename );
std::string err2 =
+ fpa::tests::image::Write( filter->GetMarks( ), output_image_filename );
+ std::string err3 =
fpa::tests::image::Write( filter->GetOutput( ), output_costs_filename );
- if( err1 != "" ) std::cerr << "Error caught: " << err1 << std::endl;
if( err2 != "" ) std::cerr << "Error caught: " << err2 << std::endl;
+ if( err3 != "" ) std::cerr << "Error caught: " << err3 << std::endl;
return( 0 );
}