1 #include <cpExtensions/Visualization/MPR3DActors.h>
2 #include <cpExtensions/Visualization/ImageSliceActors.h>
3 #include <cpExtensions/Visualization/LUTImageActor.h>
4 #include <cpExtensions/Visualization/WindowLevelImageActor.h>
6 #include <vtkImageProperty.h>
7 #include <vtkPolyData.h>
9 // -------------------------------------------------------------------------
10 cpExtensions::Visualization::MPR3DActors::
11 Self* cpExtensions::Visualization::MPR3DActors::
14 return( new Self( ) );
17 // -------------------------------------------------------------------------
18 vtkImageData* cpExtensions::Visualization::MPR3DActors::
21 return( this->m_Slices[ 0 ]->GetImage( ) );
24 // -------------------------------------------------------------------------
25 const vtkImageData* cpExtensions::Visualization::MPR3DActors::
28 return( this->m_Slices[ 0 ]->GetImage( ) );
31 // -------------------------------------------------------------------------
32 cpExtensions::Visualization::
33 WindowLevelImageActor* cpExtensions::Visualization::MPR3DActors::
34 GetWindowLevelImageActor( int o )
36 return( this->m_Slices[ o % 3 ]->GetWindowLevelImageActor( ) );
39 // -------------------------------------------------------------------------
40 const cpExtensions::Visualization::
41 WindowLevelImageActor* cpExtensions::Visualization::MPR3DActors::
42 GetWindowLevelImageActor( int o ) const
44 return( this->m_Slices[ o % 3 ]->GetWindowLevelImageActor( ) );
47 // -------------------------------------------------------------------------
48 cpExtensions::Visualization::
49 LUTImageActor* cpExtensions::Visualization::MPR3DActors::
50 GetLUTImageActor( int o )
52 return( this->m_Slices[ o % 3 ]->GetLUTImageActor( ) );
55 // -------------------------------------------------------------------------
56 const cpExtensions::Visualization::
57 LUTImageActor* cpExtensions::Visualization::MPR3DActors::
58 GetLUTImageActor( int o ) const
60 return( this->m_Slices[ o % 3 ]->GetLUTImageActor( ) );
63 // -------------------------------------------------------------------------
64 cpExtensions::Visualization::
65 ImageOutlineActor* cpExtensions::Visualization::MPR3DActors::
66 GetImageOutlineActor( int o )
68 return( this->m_Slices[ o % 3 ]->GetImageOutlineActor( ) );
71 // -------------------------------------------------------------------------
72 const cpExtensions::Visualization::
73 ImageOutlineActor* cpExtensions::Visualization::MPR3DActors::
74 GetImageOutlineActor( int o ) const
76 return( this->m_Slices[ o % 3 ]->GetImageOutlineActor( ) );
79 // -------------------------------------------------------------------------
80 int cpExtensions::Visualization::MPR3DActors::
81 GetSliceNumber( int o ) const
83 return( this->m_Slices[ o % 3 ]->GetSliceNumber( ) );
86 // -------------------------------------------------------------------------
87 void cpExtensions::Visualization::MPR3DActors::
88 SetImage( vtkImageData* image )
90 this->RemoveAllItems( );
91 for( int i = 0; i < 3; ++i )
93 this->m_Slices[ i ]->SetImage( image, i );
94 this->m_Slices[ i ]->InitTraversal( );
95 while( vtkProp* p = this->m_Slices[ i ]->GetNextProp( ) )
101 // -------------------------------------------------------------------------
102 unsigned int cpExtensions::Visualization::MPR3DActors::
103 AddLUTImage( vtkImageData* image )
105 for( int i = 0; i < 3; ++i )
107 this->m_Slices[ i ]->AddLUTImage( image );
108 this->AddItem( this->m_Slices[ i ]->GetLUTImageActor( ) );
113 // -------------------------------------------------------------------------
114 void cpExtensions::Visualization::MPR3DActors::
115 SetSliceNumber( int o, int s )
117 this->m_Slices[ o % 3 ]->SetSliceNumber( s );
120 // -------------------------------------------------------------------------
121 vtkActor* cpExtensions::Visualization::MPR3DActors::
122 AddMesh( vtkPolyData* mesh )
125 actor.SetMesh( mesh );
126 this->m_Meshes[ mesh ] = actor;
127 this->AddItem( actor.GetActor( ) );
128 return( actor.GetActor( ) );
131 // -------------------------------------------------------------------------
132 void cpExtensions::Visualization::MPR3DActors::
133 SetScalarRange( double r[ 2 ] )
135 this->m_Slices[ 0 ]->GetWindowLevelImageActor( )->SetRange( r );
136 this->m_Slices[ 1 ]->GetWindowLevelImageActor( )->SetRange( r );
137 this->m_Slices[ 2 ]->GetWindowLevelImageActor( )->SetRange( r );
140 // -------------------------------------------------------------------------
141 void cpExtensions::Visualization::MPR3DActors::
142 SetWindowLevel( double wl[ 2 ] )
144 this->m_Slices[ 0 ]->GetWindowLevelImageActor( )->SetWindowLevel( wl );
145 this->m_Slices[ 1 ]->GetWindowLevelImageActor( )->SetWindowLevel( wl );
146 this->m_Slices[ 2 ]->GetWindowLevelImageActor( )->SetWindowLevel( wl );
149 // -------------------------------------------------------------------------
150 void cpExtensions::Visualization::MPR3DActors::
151 SetImageOpacity( double o )
153 this->m_Slices[ 0 ]->GetWindowLevelImageActor( )->
154 GetProperty( )->SetOpacity( o );
155 this->m_Slices[ 1 ]->GetWindowLevelImageActor( )->
156 GetProperty( )->SetOpacity( o );
157 this->m_Slices[ 2 ]->GetWindowLevelImageActor( )->
158 GetProperty( )->SetOpacity( o );
161 // -------------------------------------------------------------------------
162 void cpExtensions::Visualization::MPR3DActors::
163 SetImageInterpolation( unsigned char i )
168 // -------------------------------------------------------------------------
169 cpExtensions::Visualization::MPR3DActors::
173 this->m_Slices[ 0 ] = vtkSmartPointer< ImageSliceActors >::New( );
174 this->m_Slices[ 1 ] = vtkSmartPointer< ImageSliceActors >::New( );
175 this->m_Slices[ 2 ] = vtkSmartPointer< ImageSliceActors >::New( );
178 // -------------------------------------------------------------------------
179 cpExtensions::Visualization::MPR3DActors::