]> Creatis software - cpPlugins.git/commitdiff
Use of MPR simplified
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Dec 2014 13:46:05 +0000 (14:46 +0100)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Dec 2014 13:46:05 +0000 (14:46 +0100)
appli/ImageMPR/ImageMPR.cxx
appli/ImageMPR/ImageMPR.h
lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.cxx
lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h
lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx [new file with mode: 0644]
lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h [new file with mode: 0644]

index 6ee1fb02454f29fc0780cda1142d1690d6f08d18..26c8f349076c6e8c50a8047c2f7a4a200dc2d474 100644 (file)
@@ -6,26 +6,6 @@
 #include <QFileDialog>
 #include <QMessageBox>
 
-/*
-#include <algorithm>
-#include <cctype>
-#include <fstream>
-
-#include <vtkAnnotatedCubeActor.h>
-#include <vtkAxesActor.h>
-#include <vtkPropAssembly.h>
-#include <vtkProperty.h>
-
-#include <cpPlugins/Interface/Image.h>
-
-// -------------------------------------------------------------------------
-#define IDMS_QT_ACTION( name )                                         \
-  QObject::connect(                                                    \
-    this->m_UI->action##name, SIGNAL( triggered( ) ),                  \
-    this, SLOT( _triggered_action##name( ) )                           \
-    )
-*/
-
 // -------------------------------------------------------------------------
 ImageMPR::ImageMPR( QWidget* parent )
   : QMainWindow( parent ),
@@ -35,74 +15,14 @@ ImageMPR::ImageMPR( QWidget* parent )
   this->m_UI->setupUi( this );
 
   // Create and associate renderers
-  this->m_3DRenderer = vtkSmartPointer< vtkRenderer >::New( );
-  this->m_XPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
-  this->m_YPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
-  this->m_ZPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
-  this->m_3DRenderer->SetBackground( 0.2, 0.2, 0.2 );
-  this->m_XPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
-  this->m_YPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
-  this->m_ZPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
-  this->m_UI->m_3DVTK->GetRenderWindow( )->
-    AddRenderer( this->m_3DRenderer );
-  this->m_UI->m_XPlaneVTK->GetRenderWindow( )->
-    AddRenderer( this->m_XPlaneRenderer );
-  this->m_UI->m_YPlaneVTK->GetRenderWindow( )->
-    AddRenderer( this->m_YPlaneRenderer );
-  this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->
-    AddRenderer( this->m_ZPlaneRenderer );
-
-  // Configure MPR actors
-  this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
-
-  // Prepare interaction
-  this->m_XStyle = vtkSmartPointer< TStyle >::New( );
-  this->m_YStyle = vtkSmartPointer< TStyle >::New( );
-  this->m_ZStyle = vtkSmartPointer< TStyle >::New( );
-  this->m_XStyle->
-    Configure( this->m_MPRActors->GetSliceActors( 0 ), this->m_MPRActors );
-  this->m_YStyle->
-    Configure( this->m_MPRActors->GetSliceActors( 1 ), this->m_MPRActors );
-  this->m_ZStyle->
-    Configure( this->m_MPRActors->GetSliceActors( 2 ), this->m_MPRActors );
-  this->m_XStyle->
-    SetInteractor( this->m_UI->m_XPlaneVTK->GetInteractor( ), 0 );
-  this->m_YStyle->
-    SetInteractor( this->m_UI->m_YPlaneVTK->GetInteractor( ), 1 );
-  this->m_ZStyle->
-    SetInteractor( this->m_UI->m_ZPlaneVTK->GetInteractor( ), 2 );
-  this->m_XStyle->SetModeToNavigation( );
-  this->m_YStyle->SetModeToNavigation( );
-  this->m_ZStyle->SetModeToNavigation( );
-
-  this->m_XStyle->AssociateInteractor(
-    this->m_UI->m_YPlaneVTK->GetInteractor( )
-    );
-  this->m_XStyle->AssociateInteractor(
-    this->m_UI->m_ZPlaneVTK->GetInteractor( )
-    );
-  this->m_XStyle->AssociateInteractor(
-    this->m_UI->m_3DVTK->GetInteractor( )
-    );
-  this->m_YStyle->AssociateInteractor(
-    this->m_UI->m_XPlaneVTK->GetInteractor( )
-    );
-  this->m_YStyle->AssociateInteractor(
-    this->m_UI->m_ZPlaneVTK->GetInteractor( )
-    );
-  this->m_YStyle->AssociateInteractor(
-    this->m_UI->m_3DVTK->GetInteractor( )
-    );
-  this->m_ZStyle->AssociateInteractor(
-    this->m_UI->m_XPlaneVTK->GetInteractor( )
-    );
-  this->m_ZStyle->AssociateInteractor(
-    this->m_UI->m_YPlaneVTK->GetInteractor( )
-    );
-  this->m_ZStyle->AssociateInteractor(
-    this->m_UI->m_3DVTK->GetInteractor( )
+  this->m_MPR = new TMPR(
+    this->m_UI->m_XPlaneVTK->GetRenderWindow( ),
+    this->m_UI->m_YPlaneVTK->GetRenderWindow( ),
+    this->m_UI->m_ZPlaneVTK->GetRenderWindow( ),
+    this->m_UI->m_3DVTK->GetRenderWindow( )
     );
 
+  // signals <-> slots
   QObject::connect(
     this->m_UI->actionOpenPlugins, SIGNAL( triggered( ) ),
     this, SLOT( _triggered_actionOpenPlugins( ) )
@@ -125,6 +45,7 @@ ImageMPR::
 
   // Delete objects
   delete this->m_UI;
+  delete this->m_MPR;
   if( this->m_InputImage != NULL ) delete this->m_InputImage;
 }
 
@@ -234,28 +155,7 @@ _triggered_actionOpenInputImage( )
   } // fi
 
   if( this->m_InputImage != NULL )
-  {
-    this->m_MPRActors->SetInputData( this->m_InputImage->GetVTKImageData( ) );
-    this->m_MPRActors->PushDataInto(
-      this->m_XPlaneRenderer,
-      this->m_YPlaneRenderer,
-      this->m_ZPlaneRenderer,
-      this->m_3DRenderer
-      );
-
-    // Reset all cameras
-    this->m_3DRenderer->ResetCamera( );
-    this->m_XPlaneRenderer->ResetCamera( );
-    this->m_YPlaneRenderer->ResetCamera( );
-    this->m_ZPlaneRenderer->ResetCamera( );
-
-    // Ok, start!
-    this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
-    this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
-    this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
-    this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
-
-  } // fi
+    this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) );
 }
 
 // eof - $RCSfile$
index 3a834ae6ee1c6bb1f453e457964d14e088680fbc..69b883afeccdf9fe48b07fb4953b4500e5816755 100644 (file)
@@ -9,7 +9,6 @@
 #include <QMainWindow>
 
 // vtk stuff
-#include <vtkRenderer.h>
 #include <vtkSmartPointer.h>
 
 // Plugins interface
 #include <cpPlugins/Interface/ProcessObject.h>
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/DataObject.h>
-#include <cpPlugins/Extensions/Visualization/MPRActors.h>
-#include <cpPlugins/Extensions/Visualization/ImageInteractorStyle.h>
-
-
-/*
-  #include <vtkOrientationMarkerWidget.h>
-
-// Local stuff
-#include "InteractorStyleImage.h"
-#include "VolumeActors.h"
-
-
-  #include <itkImage.h>
-  #include <itkImageToVTKImageFilter.h>
-
-  #include <cpm/DataStructures/QuadEdgeMesh.h>
-
-  #include <cpm/VTK/MeshMapper.h>
-  #include <cpm/Algorithms/QuadEdge/MeshPlaneCutterFilter.h>
-*/
+#include <cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h>
 
 // -------------------------------------------------------------------------
 namespace Ui
@@ -62,9 +42,7 @@ public:
   typedef TPlugin::TParameters                TParameters;
 
   typedef std::map< std::string, std::string > TStringMap;
-  typedef cpPlugins::Extensions::Visualization::MPRActors TMPRActors;
-  typedef cpPlugins::Extensions::Visualization::ImageInteractorStyle TStyle;
-
+  typedef cpPlugins::Extensions::Visualization::MPRWithDifferentWindows TMPR;
 
 public:
   explicit ImageMPR( QWidget* parent = 0 );
@@ -87,26 +65,11 @@ private:
   TPluginImage* m_InputImage;
 
   // Visualization stuff
-  vtkSmartPointer< vtkRenderer > m_3DRenderer;
-  vtkSmartPointer< vtkRenderer > m_XPlaneRenderer;
-  vtkSmartPointer< vtkRenderer > m_YPlaneRenderer;
-  vtkSmartPointer< vtkRenderer > m_ZPlaneRenderer;
-  vtkSmartPointer< TMPRActors >  m_MPRActors;
-  vtkSmartPointer< TStyle > m_XStyle;
-  vtkSmartPointer< TStyle > m_YStyle;
-  vtkSmartPointer< TStyle > m_ZStyle;
+  TMPR* m_MPR;
 
   /* TODO
-     vtkSmartPointer< idms::VolumeActors > m_ImageActors;
      vtkSmartPointer< vtkOrientationMarkerWidget > m_3DOrientationWidget;
   */
-
-  /*
-    TTriangulation::Pointer                 m_Mesh;
-    vtkSmartPointer< TTriangulationMapper > m_MeshMapper;
-    vtkSmartPointer< vtkActor >             m_MeshActor;
-    TCutter::Pointer m_ZCutter;
-  */
 };
 
 #endif // __IMAGEMPR__H__
index d017cb2c3a8148f1aac4b43eed5def93db266643..a72f68bc95ff9ea8815c52b1326191aa7ccbef6a 100644 (file)
@@ -114,8 +114,11 @@ SetInteractor( vtkRenderWindowInteractor* interactor, const int& axis )
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnMouseMove( )
 {
+  if( this->m_MPRActors == NULL )
+    return;
+  
   double pos[ 3 ];
-  if( this->CursorMoving && this->m_MPRActors != NULL )
+  if( this->CursorMoving )
   {
     bool picked = this->_PickPosition( pos );
     if( picked )
@@ -127,6 +130,21 @@ OnMouseMove( )
       this->_RenderAssociateInteractors( );
 
     } // fi
+  }
+  else
+  {
+    switch( this->State )
+    {
+    case VTKIS_WINDOW_LEVEL:
+      this->WindowLevel( );
+      break;
+    case VTKIS_DOLLY:
+      this->Dolly( );
+      break;
+    case VTKIS_PAN:
+      this->Pan( );
+      break;
+    } // hctiws
 
   } // fi
 }
@@ -141,8 +159,6 @@ OnLeftButtonDown( )
   this->FindPokedRenderer( x, y );
   if( this->CurrentRenderer == NULL )
     return;
-
-  // Redefine this button to handle window/level
   this->GrabFocus( this->EventCallbackCommand );
 
   if( this->Interactor->GetControlKey( ) )
@@ -184,35 +200,92 @@ void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnLeftButtonUp( )
 {
   if( this->CursorMoving )
+  {
     this->EndCursorMoving( );
+    if( this->Interactor )
+      this->ReleaseFocus( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnMiddleButtonDown( )
 {
-  std::cout << "middown" << std::endl;
+  int x = this->Interactor->GetEventPosition( )[ 0 ];
+  int y = this->Interactor->GetEventPosition( )[ 1 ];
+
+  this->FindPokedRenderer( x, y );
+  if( this->CurrentRenderer == NULL )
+    return;
+  this->GrabFocus( this->EventCallbackCommand );
+
+  if( this->Interactor->GetAltKey( ) )
+  {
+  }
+  else if( this->Interactor->GetControlKey( ) )
+  {
+  }
+  else if( this->Interactor->GetShiftKey( ) )
+  {
+  }
+  else
+    this->StartPan( );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnMiddleButtonUp( )
 {
-  std::cout << "midup" << std::endl;
+  switch( this->State )
+  {
+  case VTKIS_PAN:
+    this->EndPan( );
+    break;
+  } // hctiws
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnRightButtonDown( )
 {
-  std::cout << "ridown" << std::endl;
+  int x = this->Interactor->GetEventPosition( )[ 0 ];
+  int y = this->Interactor->GetEventPosition( )[ 1 ];
+
+  this->FindPokedRenderer( x, y );
+  if( this->CurrentRenderer == NULL )
+    return;
+  this->GrabFocus( this->EventCallbackCommand );
+
+  if( this->Interactor->GetControlKey( ) )
+  {
+    this->WindowLevelStartPosition[ 0 ] = x;
+    this->WindowLevelStartPosition[ 1 ] = y;
+    this->StartWindowLevel( );
+  }
+  else
+  {
+    this->StartDolly( );
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnRightButtonUp( )
 {
-  std::cout << "riup" << std::endl;
+  switch( this->State )
+  {
+  case VTKIS_WINDOW_LEVEL:
+  {
+    this->EndWindowLevel( );
+    if( this->Interactor )
+      this->ReleaseFocus( );
+  }
+  break;
+  case VTKIS_DOLLY:
+    this->EndDolly( );
+    break;
+  } // hctiws
 }
 
 // -------------------------------------------------------------------------
@@ -251,98 +324,119 @@ OnMouseWheelBackward( )
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 OnChar( )
 {
-  std::cout << "char" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Rotate( )
-{
-  std::cout << "Rotate" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Pan( )
-{
-  std::cout << "pan" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Spin( )
-{
-  std::cout << "spin" << std::endl;
-}
+  switch( this->Interactor->GetKeyCode( ) )
+  {
+  case 'r': case 'R':
+  {
+    vtkRenderer* ren =
+      this->Interactor->GetRenderWindow( )->
+      GetRenderers( )->GetFirstRenderer( );
+    if( ren != NULL )
+      ren->ResetCamera( );
+    this->Interactor->Render( );
+  }
+  break;
+  case 'w': case 'W': case 'l': case 'L':
+  {
+    if( this->m_MPRActors != NULL )
+    {
+      this->m_MPRActors->ResetWindowLevel( );
+      this->Interactor->Render( );
+      this->_RenderAssociateInteractors( );
 
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Zoom( )
-{
-  std::cout << "Zoom" << std::endl;
+    } // fi
+  }
+  break;
+  } // hctiws
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 WindowLevel( )
 {
-  std::cout << "wl" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Pick( )
-{
-  std::cout << "Pick" << std::endl;
-}
+  if( this->Mode == Self::NavigationMode )
+  {
+    if( this->Interactor == NULL )
+      return;
+    vtkRenderer* ren =
+      this->Interactor->GetRenderWindow( )->
+      GetRenderers( )->GetFirstRenderer( );
+    if( ren == NULL )
+      return;
+
+    // Compute scales
+    this->WindowLevelCurrentPosition[ 0 ] =
+      this->Interactor->GetEventPosition( )[ 0 ];
+    this->WindowLevelCurrentPosition[ 1 ] =
+      this->Interactor->GetEventPosition( )[ 1 ];
+    int* size = ren->GetSize( );
+    double sw = double(
+      this->WindowLevelCurrentPosition[ 0 ] -
+      this->WindowLevelStartPosition[ 0 ]
+      ) / double( size[ 0 ] );
+    double sl = (
+      this->WindowLevelStartPosition[ 1 ] -
+      this->WindowLevelCurrentPosition[ 1 ]
+      ) / double( size[ 1 ] );
+
+    double w = this->WindowLevelInitial[ 0 ] * ( double( 1 ) + sw );
+    double l = this->WindowLevelInitial[ 1 ] * ( double( 1 ) + sl );
+    double minw = this->m_MPRActors->GetMinWindow( );
+    double maxw = this->m_MPRActors->GetMaxWindow( );
+    double minl = this->m_MPRActors->GetMinLevel( );
+    double maxl = this->m_MPRActors->GetMaxLevel( );
+
+    if( w < minw ) w = minw;
+    if( maxw < w ) w = maxw;
+    if( l < minl ) l = minl;
+    if( maxl < l ) l = maxl;
+
+    this->m_MPRActors->SetWindowLevel( w, l );
+    this->Interactor->Render( );
+    this->_RenderAssociateInteractors( );
+  }
+  else if( this->Mode == Self::DeformationMode )
+  {
+    // TODO
 
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-Slice( )
-{
-  std::cout << "Slice" << std::endl;
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
 StartWindowLevel( )
 {
-  std::cout << "swl" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-EndWindowLevel( )
-{
-  std::cout << "ewl" << std::endl;
-}
+  if( this->State != VTKIS_NONE )
+    return;
+  if( this->Mode == Self::NavigationMode )
+  {
+    this->StartState( VTKIS_WINDOW_LEVEL );
 
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-StartPick( )
-{
-  std::cout << "sp" << std::endl;
-}
+    this->WindowLevelInitial[ 0 ] = this->m_MPRActors->GetWindow( );
+    this->WindowLevelInitial[ 1 ] = this->m_MPRActors->GetLevel( );
+  }
+  else if( this->Mode == Self::DeformationMode )
+  {
+    // TODO
 
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-EndPick( )
-{
-  std::cout << "ep" << std::endl;
+  } // fi
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-StartSlice( )
+EndWindowLevel( )
 {
-  std::cout << "ss" << std::endl;
-}
+  if( this->Mode == Self::NavigationMode )
+  {
+    if( this->State != VTKIS_WINDOW_LEVEL )
+      return;
+    this->StopState( );
+  }
+  else
+  {
+    // TODO
 
-// -------------------------------------------------------------------------
-void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
-EndSlice( )
-{
-  std::cout << "es" << std::endl;
+  } // fi
 }
 
 // -------------------------------------------------------------------------
index 2eb6f12390013b2bb3bb2bc5fb6026bf4b12c722..3cac84ec4f477cee8b9bedbc82aa4c554750a006 100644 (file)
@@ -79,21 +79,21 @@ namespace cpPlugins
         // they might be called from OnTimer, they do not have mouse coord
         // parameters (use interactor's GetEventPosition and
         // GetLastEventPosition)
-        virtual void Rotate( );
-        virtual void Pan( );
-        virtual void Spin( );
-        virtual void Zoom( );
+
+        virtual void Rotate( ) { }
+        virtual void Spin( )   { }
+        virtual void Zoom( )   { }
+        virtual void Pick( )   { }
+        virtual void Slice( )  { }
         virtual void WindowLevel( );
-        virtual void Pick( );
-        virtual void Slice( );
 
         // Interaction mode entry points used internally.
+        virtual void StartPick( )  { }
+        virtual void EndPick( )    { }
+        virtual void StartSlice( ) { }
+        virtual void EndSlice( )   { }
         virtual void StartWindowLevel( );
         virtual void EndWindowLevel( );
-        virtual void StartPick( );
-        virtual void EndPick( );
-        virtual void StartSlice( );
-        virtual void EndSlice( );
 
         // New events
         virtual void StartCursorMoving( );
diff --git a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.cxx
new file mode 100644 (file)
index 0000000..f66c258
--- /dev/null
@@ -0,0 +1,128 @@
+#include <cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+MPRWithDifferentWindows(
+  vtkRenderWindow* xWin,
+  vtkRenderWindow* yWin,
+  vtkRenderWindow* zWin,
+  vtkRenderWindow* auxWin
+  )
+{
+  this->m_Windows[ 0 ] = xWin;
+  this->m_Windows[ 1 ] = yWin;
+  this->m_Windows[ 2 ] = zWin;
+  this->m_Windows[ 3 ] = auxWin;
+
+  // Prepare actors
+  this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
+
+  // Prepare renderers
+  for( int i = 0; i < 4; ++i )
+  {
+    if( this->m_Windows[ i ] == NULL )
+      continue;
+
+    // Renderers
+    this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
+    this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 );
+    this->m_Windows[ i ]->AddRenderer( this->m_Renderers[ i ] );
+
+    // Image styles (just for 2D windows)
+    if( i < 3 )
+    {
+      this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
+      this->m_Styles[ i ]->Configure(
+        this->m_MPRActors->GetSliceActors( i ), this->m_MPRActors
+        );
+
+      this->m_Styles[ i ]->
+        SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
+      this->m_Styles[ i ]->SetModeToNavigation( );
+
+    } // fi
+
+  } // rof
+  if( this->m_Windows[ 3 ] != NULL )
+    this->m_Renderers[ 3 ]->SetBackground( 0.2, 0.2, 0.2 );
+
+  for( int i = 0; i < 3; ++i )
+  {
+    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( ) );
+
+    } // rof
+    if( this->m_Windows[ 3 ] != NULL )
+      this->m_Styles[ i ]->
+        AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
+
+  } // rof
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+~MPRWithDifferentWindows( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+SetImage( vtkImageData* image )
+{
+  this->m_MPRActors->SetInputData( image );
+  this->m_MPRActors->PushDataInto(
+    this->m_Renderers[ 0 ],
+    this->m_Renderers[ 1 ],
+    this->m_Renderers[ 2 ],
+    this->m_Renderers[ 3 ]
+    );
+
+  // First rendering
+  this->ResetCameras( );
+  this->RenderAll( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+ResetCamera( const int& id )
+{
+  if( id < 4 )
+    if( this->m_Windows[ id ] != NULL )
+      this->m_Renderers[ id ]->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+ResetCameras( )
+{
+  for( int i = 0; i < 4; ++i )
+    if( this->m_Windows[ i ] != NULL )
+      this->m_Renderers[ i ]->ResetCamera( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+Render( const int& id )
+{
+  if( id < 4 )
+    if( this->m_Windows[ id ] != NULL )
+      this->m_Windows[ id ]->Render( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
+RenderAll( )
+{
+  for( int i = 0; i < 4; ++i )
+    if( this->m_Windows[ i ] != NULL )
+      this->m_Windows[ i ]->Render( );
+}
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h b/lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h
new file mode 100644 (file)
index 0000000..152ea99
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
+#define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
+
+#include <cpPlugins/Extensions/Visualization/MPRActors.h>
+#include <cpPlugins/Extensions/Visualization/ImageInteractorStyle.h>
+
+#include <vtkImageData.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkSmartPointer.h>
+
+namespace cpPlugins
+{
+  namespace Extensions
+  {
+    namespace Visualization
+    {
+      /**
+       */
+      class MPRWithDifferentWindows
+      {
+      public:
+        typedef cpPlugins::Extensions::Visualization::
+        MPRActors TMPRActors;
+        typedef cpPlugins::Extensions::Visualization::
+        ImageInteractorStyle TStyle;
+
+      public:
+        MPRWithDifferentWindows(
+          vtkRenderWindow* xWin = NULL,
+          vtkRenderWindow* yWin = NULL,
+          vtkRenderWindow* zWin = NULL,
+          vtkRenderWindow* auxWin = NULL
+          );
+        virtual ~MPRWithDifferentWindows( );
+
+        void SetImage( vtkImageData* image );
+
+        void ResetCamera( const int& id );
+        void ResetCameras( );
+        void Render( const int& id );
+        void RenderAll( );
+
+      protected:
+        // Inputs
+        vtkRenderWindow* m_Windows[ 4 ];
+
+        // Internal pipelines
+        vtkSmartPointer< TMPRActors >  m_MPRActors;
+        vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
+        vtkSmartPointer< TStyle >      m_Styles[ 3 ];
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
+
+
+// eof - $RCSfile$