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 AddDoubleClickObserver( vtkCommand* observer )
79 for( int i = 0; i < 3; ++i )
80 if( this->m_Styles[ i ].GetPointer( ) != NULL )
81 this->m_Styles[ i ]->AddDoubleClickObserver( observer );
84 // -------------------------------------------------------------------------
85 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
86 RemoveDoubleClickObserver( vtkCommand* observer )
88 for( int i = 0; i < 3; ++i )
89 if( this->m_Styles[ i ].GetPointer( ) != NULL )
90 this->m_Styles[ i ]->RemoveDoubleClickObserver( observer );
93 // -------------------------------------------------------------------------
94 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
95 RemoveDoubleClickObservers( )
97 for( int i = 0; i < 3; ++i )
98 if( this->m_Styles[ i ].GetPointer( ) != NULL )
99 this->m_Styles[ i ]->RemoveDoubleClickObservers( );
102 // -------------------------------------------------------------------------
103 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
104 SetImage( vtkImageData* image )
106 this->m_MPRActors->SetInputData( image );
107 this->m_MPRActors->PushDataInto(
108 this->m_Renderers[ 0 ],
109 this->m_Renderers[ 1 ],
110 this->m_Renderers[ 2 ],
111 this->m_Renderers[ 3 ]
115 this->ResetCameras( );
119 // -------------------------------------------------------------------------
120 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
121 SetSegmentation( vtkImageData* image )
123 this->m_MPRActors->SetSegmentationData( image );
124 this->m_MPRActors->PushDataInto(
125 this->m_Renderers[ 0 ],
126 this->m_Renderers[ 1 ],
127 this->m_Renderers[ 2 ],
128 this->m_Renderers[ 3 ]
136 // -------------------------------------------------------------------------
137 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
138 ResetCamera( const int& id )
141 if( this->m_Windows[ id ] != NULL )
142 this->m_Renderers[ id ]->ResetCamera( );
145 // -------------------------------------------------------------------------
146 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
149 for( int i = 0; i < 4; ++i )
150 if( this->m_Windows[ i ] != NULL )
151 this->m_Renderers[ i ]->ResetCamera( );
154 // -------------------------------------------------------------------------
155 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
156 Render( const int& id )
159 if( this->m_Windows[ id ] != NULL )
160 this->m_Windows[ id ]->Render( );
163 // -------------------------------------------------------------------------
164 void cpPlugins::Extensions::Visualization::MPRWithDifferentWindows::
167 for( int i = 0; i < 4; ++i )
168 if( this->m_Windows[ i ] != NULL )
169 this->m_Windows[ i ]->Render( );