#include <itkSignedMaurerDistanceMapImageFilter.h>
+#include <vtkOutlineSource.h>
+
#include <fpa/Base/Functors/InvertCostFunction.h>
#include <fpa/Image/DijkstraWithEndPointDetection.h>
-#include <fpa/VTK/Image2DObserver.h>
+#include <fpa/VTK/Image3DObserver.h>
#include <fpa/IO/MinimumSpanningTreeWriter.h>
#include <fpa/IO/UniqueValuesContainerWriter.h>
#include <fpa/IO/MatrixValuesContainerWriter.h>
#include "fpa_Utility.h"
// -------------------------------------------------------------------------
-const unsigned int Dim = 2;
+const unsigned int Dim = 3;
typedef unsigned char TPixel;
typedef float TScalar;
typedef itk::Image< TPixel, Dim > TImage;
vtk_input_image->SetInput( input_image );
vtk_input_image->Update( );
+ vtkSmartPointer<vtkOutlineSource> outline =
+ vtkSmartPointer<vtkOutlineSource>::New();
+ outline->SetBounds(vtk_input_image->GetOutput( )->GetBounds());
+
+ vtkSmartPointer<vtkPolyDataMapper> mapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New( );
+ mapper->SetInputConnection( outline->GetOutputPort( ) );
+
+ vtkSmartPointer<vtkActor> actor =
+ vtkSmartPointer<vtkActor>::New( );
+ actor->SetMapper( mapper );
+ vtkSmartPointer<vtkRenderer> aRenderer =
+ vtkSmartPointer<vtkRenderer>::New();
+ vtkSmartPointer<vtkRenderWindow> renWin =
+ vtkSmartPointer<vtkRenderWindow>::New();
+ renWin->AddRenderer(aRenderer);
+
+ vtkSmartPointer<vtkRenderWindowInteractor> iren =
+ vtkSmartPointer<vtkRenderWindowInteractor>::New();
+ iren->SetRenderWindow(renWin);
+
+ aRenderer->AddActor( actor );
+iren->Initialize();
+ iren->Start();
+
+ /*
fpa_Utility::Viewer2DWithSeeds viewer;
viewer.SetImage( vtk_input_image->GetOutput( ) );
while( viewer.GetNumberOfSeeds( ) == 0 )
viewer.Start( );
+ */
// Compute squared distance map
itk::SignedMaurerDistanceMapImageFilter< TImage, TScalarImage >::Pointer
// Associate seed
TImage::PointType pnt;
TImage::IndexType idx;
- viewer.GetSeed( pnt, 0 );
+ /*
+ viewer.GetSeed( pnt, 0 );
+ */
+ pnt[ 0 ] = 0.879066;
+ pnt[ 1 ] = -109.36591;
+ pnt[ 2 ] = 1942.480988;
+
if( input_image->TransformPhysicalPointToIndex( pnt, idx ) )
filter->AddSeed( idx, 0 );
// Prepare graphical debugger
- typedef fpa::VTK::Image2DObserver< TFilter, vtkRenderWindow > TDebugger;
+ typedef fpa::VTK::Image3DObserver< TFilter, vtkRenderWindow > TDebugger;
TDebugger::Pointer debugger = TDebugger::New( );
- debugger->SetRenderWindow( viewer.Window );
- debugger->SetRenderPercentage( 0.01 );
+ debugger->SetRenderWindow( renWin );
+ debugger->SetRenderPercentage( 0.0001 );
filter->AddObserver( itk::AnyEvent( ), debugger );
filter->ThrowEventsOn( );
endpoints_actor->SetMapper( endpoints_mapper );
endpoints_actor->GetProperty( )->SetColor( 0, 1, 0 );
endpoints_actor->GetProperty( )->SetPointSize( 5 );
- viewer.Renderer->AddActor( endpoints_actor );
+ aRenderer->AddActor( endpoints_actor );
TVertices2PD bifurcations2pd = TVertices2PD::New( );
bifurcations2pd->SetInput( filter->GetBifurcations( ) );
bifurcations_actor->SetMapper( bifurcations_mapper );
bifurcations_actor->GetProperty( )->SetColor( 1, 0, 0 );
bifurcations_actor->GetProperty( )->SetPointSize( 5 );
- viewer.Renderer->AddActor( bifurcations_actor );
+ aRenderer->AddActor( bifurcations_actor );
// Some more interaction and finish
- viewer.Render( );
- viewer.Start( );
+iren->Initialize();
+ iren->Start();
// Save results
err = fpa_Utility::SaveImage( filter->GetLabelImage( ), output_labels_fn );