]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Extensions/Visualization/ImageSliceActors.cxx
Kalman filter added
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / ImageSliceActors.cxx
index 0ec6bb85a1d2167d388bb3e58e9cd82745696520..2b52fb98827755edaa5c67a979e50178e26e2421 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <vtkAlgorithmOutput.h>
 #include <vtkCellArray.h>
+#include <vtkImageData.h>
 #include <vtkInformation.h>
 #include <vtkPlane.h>
 #include <vtkPoints.h>
@@ -21,7 +22,6 @@ New( )
 void cpPlugins::Extensions::Visualization::ImageSliceActors::
 SetInputConnection( vtkAlgorithmOutput* aout, int axis )
 {
-  this->InputAlgorithm = aout;
   this->SliceMapper->SetInputConnection( aout );
   this->SliceMapper->SetOrientation( axis );
   this->SliceMapper->Update( );
@@ -33,16 +33,14 @@ SetInputConnection( vtkAlgorithmOutput* aout, int axis )
 
 // -------------------------------------------------------------------------
 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( );
 }
 
@@ -92,18 +90,9 @@ GetSliceNumberMaxValue( ) 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 );
@@ -190,7 +179,7 @@ SetSliceNumber( const int& slice )
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageSliceActors::
-UpdateText( const double& w, const double& l )
+UpdateText( )
 {
   char axis;
   int axId = this->SliceMapper->GetOrientation( );
@@ -199,8 +188,8 @@ UpdateText( const double& w, const double& l )
   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( );
@@ -210,26 +199,19 @@ UpdateText( const double& w, const double& l )
 // -------------------------------------------------------------------------
 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 );
 
@@ -268,7 +250,6 @@ ImageSliceActors( )
   vtkCoordinate* coord = this->TextActor->GetPositionCoordinate( );
   coord->SetCoordinateSystemToNormalizedViewport( );
   coord->SetValue( 0.01, 0.01 );
-
 }
 
 // -------------------------------------------------------------------------