#include <vtkAlgorithmOutput.h>
#include <vtkCellArray.h>
+#include <vtkImageData.h>
#include <vtkInformation.h>
#include <vtkPlane.h>
#include <vtkPoints.h>
void cpPlugins::Extensions::Visualization::ImageSliceActors::
SetInputConnection( vtkAlgorithmOutput* aout, int axis )
{
- this->InputAlgorithm = aout;
this->SliceMapper->SetInputConnection( aout );
this->SliceMapper->SetOrientation( axis );
this->SliceMapper->Update( );
// -------------------------------------------------------------------------
void cpPlugins::Extensions::Visualization::ImageSliceActors::
-SetSegmentationConnection( vtkAlgorithmOutput* aout )
+SetInputData( vtkImageData* data, int axis )
{
- this->SegmentationAlgorithm = aout;
- this->SegmentationSliceMapper->SetInputConnection( aout );
- this->SegmentationSliceMapper->
- SetOrientation( this->SliceMapper->GetOrientation( ) );
- this->SegmentationSliceMapper->
- SetSliceNumber( this->SliceMapper->GetSliceNumber( ) );
- this->SegmentationActor->SetMapper( this->SegmentationSliceMapper );
- this->SegmentationActor->Modified( );
+ this->SliceMapper->SetInputData( data );
+ this->SliceMapper->SetOrientation( axis );
+ this->SliceMapper->Update( );
+ this->SetSliceNumber( this->SliceMapper->GetSliceNumber( ) );
+ this->ImageActor->SetMapper( this->SliceMapper );
+ this->ImageActor->Modified( );
this->Modified( );
}
+// -------------------------------------------------------------------------
+double* cpPlugins::Extensions::Visualization::ImageSliceActors::
+GetDisplayBounds( ) const
+{
+ return( this->ImageActor->GetDisplayBounds( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::ImageSliceActors::
+GetDisplayBounds( double bounds[ 6 ] ) const
+{
+ this->ImageActor->GetDisplayBounds( bounds );
+}
+
// -------------------------------------------------------------------------
int cpPlugins::Extensions::Visualization::ImageSliceActors::
GetAxis( ) const
void cpPlugins::Extensions::Visualization::ImageSliceActors::
SetSliceNumber( const int& slice )
{
- if( this->InputAlgorithm == NULL )
- return;
this->SliceMapper->SetSliceNumber( slice );
this->SliceMapper->Update( );
- if( this->SegmentationAlgorithm != NULL )
- {
- this->SegmentationSliceMapper->SetSliceNumber( slice );
- this->SegmentationSliceMapper->Update( );
-
- } // fi
-
// Compute plane
vtkAlgorithm* algo = this->SliceMapper->GetInputAlgorithm( );
vtkInformation* info = algo->GetOutputInformation( 0 );
// -------------------------------------------------------------------------
void cpPlugins::Extensions::Visualization::ImageSliceActors::
-UpdateText( const double& w, const double& l )
+UpdateText( )
{
char axis;
int axId = this->SliceMapper->GetOrientation( );
else if( axId == 2 ) axis = 'Z';
std::sprintf(
- this->TextBuffer, "Axis: %c (%d)\nWin/Lev: %.2f/%.2f",
- axis, this->SliceMapper->GetSliceNumber( ), w, l
+ this->TextBuffer, "Axis: %c (%d)",
+ axis, this->SliceMapper->GetSliceNumber( )
);
this->TextActor->SetInput( this->TextBuffer );
this->TextActor->Modified( );
// -------------------------------------------------------------------------
cpPlugins::Extensions::Visualization::ImageSliceActors::
ImageSliceActors( )
- : Superclass( ),
- InputAlgorithm( NULL ),
- SegmentationAlgorithm( NULL )
+ : Superclass( )
{
this->SliceMapper = vtkSmartPointer< vtkImageSliceMapper >::New( );
- this->SegmentationSliceMapper =
- vtkSmartPointer< vtkImageSliceMapper >::New( );
this->PlaneSource = vtkSmartPointer< vtkPolyData >::New( );
this->PlaneMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->ImageActor = vtkSmartPointer< vtkImageActor >::New( );
- this->SegmentationActor = vtkSmartPointer< vtkImageActor >::New( );
- this->TextActor = vtkSmartPointer< vtkTextActor >::New( );
- this->PlaneActor = vtkSmartPointer< vtkActor >::New( );
+ this->ImageActor = vtkSmartPointer< vtkImageActor >::New( );
+ this->TextActor = vtkSmartPointer< vtkTextActor >::New( );
+ this->PlaneActor = vtkSmartPointer< vtkActor >::New( );
this->ImageActorIndex = this->GetNumberOfItems( );
- this->SegmentationActorIndex = this->ImageActorIndex + 1;
- this->TextActorIndex = this->ImageActorIndex + 2;
- this->PlaneActorIndex = this->ImageActorIndex + 3;
+ this->TextActorIndex = this->ImageActorIndex + 1;
+ this->PlaneActorIndex = this->ImageActorIndex + 2;
this->AddItem( this->ImageActor );
- this->AddItem( this->SegmentationActor );
this->AddItem( this->TextActor );
this->AddItem( this->PlaneActor );
vtkCoordinate* coord = this->TextActor->GetPositionCoordinate( );
coord->SetCoordinateSystemToNormalizedViewport( );
coord->SetValue( 0.01, 0.01 );
-
}
// -------------------------------------------------------------------------