1 #include <cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h>
3 // -------------------------------------------------------------------------
4 cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
5 MPRWithDifferentWindows(
9 vtkRenderWindow* auxWin
12 this->m_Windows[ 0 ] = xWin;
13 this->m_Windows[ 1 ] = yWin;
14 this->m_Windows[ 2 ] = zWin;
15 this->m_Windows[ 3 ] = auxWin;
18 this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
21 for( int i = 0; i < 4; ++i )
23 if( this->m_Windows[ i ] == NULL )
27 this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
28 this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 );
29 this->m_Windows[ i ]->AddRenderer( this->m_Renderers[ i ] );
31 // Image styles (just for 2D windows)
34 this->m_Styles[ i ] = vtkSmartPointer< TStyle >::New( );
35 this->m_Styles[ i ]->Configure(
36 this->m_MPRActors->GetSliceActors( i ), this->m_MPRActors
40 SetInteractor( this->m_Windows[ i ]->GetInteractor( ), i );
41 this->m_Styles[ i ]->SetModeToNavigation( );
46 if( this->m_Windows[ 3 ] != NULL )
47 this->m_Renderers[ 3 ]->SetBackground( 0.2, 0.2, 0.2 );
49 for( int i = 0; i < 3; ++i )
51 for( int j = 0; j < 3; ++j )
54 this->m_Windows[ i ] != NULL &&
55 this->m_Windows[ j ] != NULL &&
59 AssociateInteractor( this->m_Windows[ j ]->GetInteractor( ) );
62 if( this->m_Windows[ 3 ] != NULL )
64 AssociateInteractor( this->m_Windows[ 3 ]->GetInteractor( ) );
69 // -------------------------------------------------------------------------
70 cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
71 ~MPRWithDifferentWindows( )
75 // -------------------------------------------------------------------------
76 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
77 SetImage( vtkImageData* image )
79 this->m_MPRActors->SetInputData( image );
80 this->m_MPRActors->PushDataInto(
81 this->m_Renderers[ 0 ],
82 this->m_Renderers[ 1 ],
83 this->m_Renderers[ 2 ],
84 this->m_Renderers[ 3 ]
88 this->ResetCameras( );
92 // -------------------------------------------------------------------------
93 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
94 SetSegmentation( vtkImageData* image )
96 this->m_MPRActors->SetSegmentationData( image );
97 this->m_MPRActors->PushDataInto(
98 this->m_Renderers[ 0 ],
99 this->m_Renderers[ 1 ],
100 this->m_Renderers[ 2 ],
101 this->m_Renderers[ 3 ]
109 // -------------------------------------------------------------------------
110 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
111 SetModeToNavigation( )
113 for( unsigned int i = 0; i < 3; ++i )
115 if( this->m_Styles[ i ].GetPointer( ) != NULL )
116 this->m_Styles[ i ]->SetModeToNavigation( );
121 // -------------------------------------------------------------------------
122 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
123 SetModeToDeformation( )
125 for( unsigned int i = 0; i < 3; ++i )
127 if( this->m_Styles[ i ].GetPointer( ) != NULL )
128 this->m_Styles[ i ]->SetModeToDeformation( );
133 // -------------------------------------------------------------------------
134 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
135 ResetCamera( const int& id )
138 if( this->m_Windows[ id ] != NULL )
139 this->m_Renderers[ id ]->ResetCamera( );
142 // -------------------------------------------------------------------------
143 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
146 for( int i = 0; i < 4; ++i )
147 if( this->m_Windows[ i ] != NULL )
148 this->m_Renderers[ i ]->ResetCamera( );
151 // -------------------------------------------------------------------------
152 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
153 Render( const int& id )
156 if( this->m_Windows[ id ] != NULL )
157 this->m_Windows[ id ]->Render( );
160 // -------------------------------------------------------------------------
161 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
164 for( int i = 0; i < 4; ++i )
165 if( this->m_Windows[ i ] != NULL )
166 this->m_Windows[ i ]->Render( );