+#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$