]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRActors.cxx
Widget integration (step 6/6): Interactive architecture finished. Needs to be tested...
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.cxx
index 55f271c44c7026cc30f710b1ba0537f7fa1ea759..a02c8bc28d52ad37ff20848e333a3a5d4f1606a8 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <vtkAlgorithmOutput.h>
 #include <vtkImageData.h>
+#include <vtkOutlineSource.h>
+#include <vtkProperty.h>
 #include <vtkRenderer.h>
 #include <vtkRendererCollection.h>
 #include <vtkRenderWindow.h>
@@ -40,6 +42,28 @@ AddInputConnection( vtkAlgorithmOutput* aout )
           this->Slices[ i ][ j ]->AddInputConnection(
             ( ( imap != NULL )? imap->GetOutputPort( ): aout ), j
             );
+
+    // Create bounding box
+    vtkImageData* new_image = dynamic_cast< vtkImageData* >(
+      aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
+      );
+
+    // Create 3D outline
+    double bb[ 6 ];
+    new_image->GetBounds( bb );
+
+    vtkSmartPointer< vtkOutlineSource > img_ol =
+      vtkSmartPointer< vtkOutlineSource >::New( );
+    img_ol->SetBounds( bb );
+
+    vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
+      vtkSmartPointer< vtkPolyDataMapper >::New( );
+    img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
+    this->ImageOutlineActor->SetMapper( img_ol_mapper );
+    this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
+    this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
+
+    this->AddItem( this->ImageOutlineActor );
   }
   else
   {
@@ -108,6 +132,23 @@ AddInputData( vtkImageData* new_image )
             this->Slices[ i ][ j ]->AddInputData( new_image, j );
 
         } // fi
+
+    // Create 3D outline
+    double bb[ 6 ];
+    new_image->GetBounds( bb );
+
+    vtkSmartPointer< vtkOutlineSource > img_ol =
+      vtkSmartPointer< vtkOutlineSource >::New( );
+    img_ol->SetBounds( bb );
+
+    vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
+      vtkSmartPointer< vtkPolyDataMapper >::New( );
+    img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
+    this->ImageOutlineActor->SetMapper( img_ol_mapper );
+    this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
+    this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
+
+    this->AddItem( this->ImageOutlineActor );
   }
   else
   {