+ TImage::PointType pnt;
+ input_image->TransformIndexToPhysicalPoint( *bIt, pnt );
+ bifurcations_points->InsertNextPoint( pnt[ 0 ], pnt[ 1 ], pnt[ 2 ] );
+ bifurcations_vertices->InsertNextCell( 1 );
+ bifurcations_vertices->InsertCellPoint( bifurcations_points->GetNumberOfPoints( ) - 1 );
+
+ } // rof
+
+ vtkSmartPointer< vtkPolyData > bifurcations_polydata =
+ vtkSmartPointer< vtkPolyData >::New( );
+ bifurcations_polydata->SetPoints( bifurcations_points );
+ bifurcations_polydata->SetVerts( bifurcations_vertices );
+
+
+
+
+
+ // Build branches from endpoints to seed
+ vtkSmartPointer< vtkPoints > branches_points =
+ vtkSmartPointer< vtkPoints >::New( );
+ vtkSmartPointer< vtkCellArray > branches_cells =
+ vtkSmartPointer< vtkCellArray >::New( );
+
+ const TFilter::TBranches& branches = filter->GetBranches( );
+ TFilter::TBranches::const_iterator brIt = branches.begin( );
+ for( ; brIt != branches.end( ); ++brIt )
+ {
+ TFilter::TBranch::const_iterator brsIt = brIt->second.begin( );
+ for( ; brsIt != brIt->second.end( ); ++brsIt )
+ {
+ TImage::PointType pnt0, pnt1;
+ input_image->TransformIndexToPhysicalPoint( brIt->first, pnt0 );
+ input_image->TransformIndexToPhysicalPoint( brsIt->first, pnt1 );
+ branches_points->InsertNextPoint( pnt0[ 0 ], pnt0[ 1 ], pnt0[ 2 ] );
+ branches_points->InsertNextPoint( pnt1[ 0 ], pnt1[ 1 ], pnt1[ 2 ] );
+
+ branches_cells->InsertNextCell( 2 );
+ branches_cells->InsertCellPoint( branches_points->GetNumberOfPoints( ) - 2 );
+ branches_cells->InsertCellPoint( branches_points->GetNumberOfPoints( ) - 1 );
+
+ } // rof
+
+ } // rof
+
+ vtkSmartPointer< vtkPolyData > branches_polydata =
+ vtkSmartPointer< vtkPolyData >::New( );
+ branches_polydata->SetPoints( branches_points );
+ branches_polydata->SetLines( branches_cells );
+
+ view.AddPolyData( endpoints_polydata, 1, 0, 0, 1 );
+ view.AddPolyData( bifurcations_polydata, 0, 0, 1, 1 );
+ view.AddPolyData( branches_polydata, 0, 1, 0, 1 );
+ view.Render( );
+ view.Start( );
+
+ // Save final total cost map
+ SaveImage( filter->GetOutput( ), output_costmap_fn );
+ SaveImage( dmap.GetPointer( ), distancemap_fn );
+ SaveImage( filter->GetLabelImage( ), output_labels_fn );