- // 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 );