]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRObjects.cxx
Intermediary commit
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRObjects.cxx
index ddc1747f9faed73e0b3b2b7d22af9f89c6e8064e..0e522491b933349501a6286a1fd75682f8799e45 100644 (file)
@@ -1,5 +1,9 @@
 #include <cpExtensions/Visualization/MPRObjects.h>
 
+#include <cmath>
+#include <vtkImageData.h>
+#include <vtkLookupTable.h>
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::MPRObjects*
 cpExtensions::Visualization::MPRObjects::
@@ -47,21 +51,13 @@ void cpExtensions::Visualization::MPRObjects::
 SetImage( vtkImageData* image )
 {
   this->m_MPRActors->AddInputData( image );
-  this->m_MPRActors->PushDataInto(
-    this->m_Renderers[ 0 ],
-    this->m_Renderers[ 1 ],
-    this->m_Renderers[ 2 ],
-    this->m_Renderers[ 3 ]
+  this->m_MPRActors->PushActorsInto(
+    this->m_Windows[ 0 ],
+    this->m_Windows[ 1 ],
+    this->m_Windows[ 2 ],
+    this->m_Windows[ 3 ]
     );
 
-  // Correct cameras positions
-  /* TODO
-     vtkCamera* zCam = this->m_Renderers[ 2 ]->GetActiveCamera( );
-     zCam->SetViewUp( 0, -1, 0 );
-     zCam->SetPosition( 0, 0, -1 );
-     zCam->SetFocalPoint( 0, 0, 0 );
-  */
-
   // First rendering
   this->m_MPRActors->ResetSlices( );
   this->ResetCameras( );
@@ -72,15 +68,17 @@ SetImage( vtkImageData* image )
 void cpExtensions::Visualization::MPRObjects::
 AddAuxiliaryImage( vtkImageData* image )
 {
-  this->m_MPRActors->AddInputData( image );
-
-#error Definir LUT de la nueva imagen
-
-  this->m_MPRActors->PushDataInto(
-    this->m_Renderers[ 0 ],
-    this->m_Renderers[ 1 ],
-    this->m_Renderers[ 2 ],
-    this->m_Renderers[ 3 ]
+  // Try to add new image
+  int id = this->m_MPRActors->AddInputData( image );
+  if( id < 0 )
+    return;
+
+  // Push everything on renderers
+  this->m_MPRActors->PushActorsInto(
+    this->m_Windows[ 0 ],
+    this->m_Windows[ 1 ],
+    this->m_Windows[ 2 ],
+    this->m_Windows[ 3 ]
     );
 
   // Rendering
@@ -97,7 +95,7 @@ ActivateInteractors( )
     // Check prerrequisites
     if( this->m_Windows[ i ] == NULL || this->m_Renderers[ i ] == NULL )
     {
-      this->m_Styles[ i ] = NULL;
+      // TODO: this->m_Styles[ i ] = NULL;
       continue;
 
     } // fi
@@ -105,16 +103,18 @@ ActivateInteractors( )
     ImageSliceActors* actors = this->m_MPRActors->GetSliceActors( i );
     if( actors == NULL )
     {
-      this->m_Styles[ i ] = NULL;
+      // TODO: this->m_Styles[ i ] = NULL;
       continue;
 
     } // fi
 
-    this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
-    this->m_Styles[ i ]->Configure( actors, this->m_MPRActors );
-    this->m_Styles[ i ]->
-      SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
-    this->m_Styles[ i ]->SetModeToNavigation( );
+    /* TODO
+       this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
+       this->m_Styles[ i ]->Configure( actors, this->m_MPRActors );
+       this->m_Styles[ i ]->
+       SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
+       this->m_Styles[ i ]->SetModeToNavigation( );
+    */
 
   } // rof
 
@@ -123,23 +123,27 @@ ActivateInteractors( )
   {
     for( int j = 0; j < 3; ++j )
     {
-      if(
-        this->m_Windows[ i ] != NULL &&
-        this->m_Windows[ j ] != NULL &&
-        i != j
-        )
-        this->m_Styles[ i ]->
-          AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) );
+      /* TODO
+         if(
+         this->m_Windows[ i ] != NULL &&
+         this->m_Windows[ j ] != NULL &&
+         i != j
+         )
+         this->m_Styles[ i ]->
+         AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) );
+      */
 
     } // rof
-    if( this->m_Windows[ 3 ] != NULL )
-      this->m_Styles[ i ]->
-        AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
+    /* TODO
+       if( this->m_Windows[ 3 ] != NULL )
+       this->m_Styles[ i ]->
+       AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
+    */
 
   } // rof
 
   // Finish interactor linking
-  this->m_MPRActors->LinkInteractors( );
+  // TODO: this->m_MPRActors->LinkInteractors( );
 
   // Restart rendering
   this->ResetCameras( );
@@ -238,6 +242,22 @@ Get3DRenderer( ) const
   return( this->m_Renderers[ 3 ] );
 }
 
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::MPRObjects::
+TMPRActors* cpExtensions::Visualization::MPRObjects::
+GetMPRActors( )
+{
+  return( this->m_MPRActors );
+}
+
+// -------------------------------------------------------------------------
+const cpExtensions::Visualization::MPRObjects::
+TMPRActors* cpExtensions::Visualization::MPRObjects::
+GetMPRActors( ) const
+{
+  return( this->m_MPRActors );
+}
+
 // -------------------------------------------------------------------------
 cpExtensions::Visualization::MPRObjects::
 MPRObjects( )