+// -------------------------------------------------------------------------
+std::set< std::string > cpExtensions::QT::RendererWidget::
+GetActorsNames( ) const
+{
+ std::set< std::string > names;
+ for(
+ auto p = this->m_ViewProps.begin( );
+ p != this->m_ViewProps.end( );
+ ++p
+ )
+ names.insert( p->first );
+ return( names );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+IsWindowLevelImageActor( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto a = it->second.begin( );
+ if( a != it->second.end( ) )
+ return( dynamic_cast< TWLActor* >( a->GetPointer( ) ) != NULL );
+ else
+ return( false );
+ }
+ else
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+IsLUTImageActor( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto a = it->second.begin( );
+ if( a != it->second.end( ) )
+ return( dynamic_cast< TLUTActor* >( a->GetPointer( ) ) != NULL );
+ else
+ return( false );
+ }
+ else
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::RendererWidget::
+Is3DActor( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto a = it->second.begin( );
+ if( a != it->second.end( ) )
+ return( dynamic_cast< vtkActor* >( a->GetPointer( ) ) != NULL );
+ else
+ return( false );
+ }
+ else
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+GetScalarRange( const std::string& name, double r[ 2 ] ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ TWLActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ a->GetRange( r );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ TWLActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ a->GetWindowLevel( wl );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetWindow( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ TWLActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetWindow( ) );
+ else
+ return( 0 );
+ }
+ else
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetLevel( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ TWLActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetLevel( ) );
+ else
+ return( 0 );
+ }
+ else
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+char cpExtensions::QT::RendererWidget::
+GetImageInterpolation( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ TWLActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ {
+ int int_type = a->GetProperty( )->GetInterpolationType( );
+ char ret = 0;
+ switch( int_type )
+ {
+ case VTK_NEAREST_INTERPOLATION: ret = 'N'; break;
+ case VTK_LINEAR_INTERPOLATION: ret = 'L'; break;
+ case VTK_CUBIC_INTERPOLATION: ret = 'C'; break;
+ default: ret = 0; break;
+ } // hctiws
+ return( ret );
+ }
+ else
+ return( 0 );
+ }
+ else
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+GetColor( const std::string& name, double& r, double& g, double& b ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ vtkActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetProperty( )->GetColor( r, g, b ) );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetOpacity( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ vtkActor* a = NULL;
+ vtkImageSlice* s = NULL;
+ while( a == NULL && s == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetProperty( )->GetOpacity( ) );
+ else if( s != NULL )
+ return( s->GetProperty( )->GetOpacity( ) );
+ else
+ return( 0 );
+ }
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetPointSize( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ vtkActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetProperty( )->GetPointSize( ) );
+ else
+ return( 0 );
+ }
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::RendererWidget::
+GetLineWidth( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ vtkActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetProperty( )->GetLineWidth( ) );
+ else
+ return( 0 );
+ }
+ return( 0 );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::QT::RendererWidget::
+GetRepresentation( const std::string& name ) const
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ auto p = it->second.begin( );
+ vtkActor* a = NULL;
+ while( a == NULL && p != it->second.end( ) )
+ {
+ a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ p++;
+
+ } // elihw
+ if( a != NULL )
+ return( a->GetProperty( )->GetRepresentation( ) );
+ else
+ return( -1 );
+ }
+ return( -1 );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetScalarRange( const std::string& name, double r[ 2 ] )
+{
+ this->SetScalarRange( name, r[ 0 ], r[ 1 ] );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetScalarRange( const std::string& name, double min, double max )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->SetRange( min, max );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetWindowLevel( const std::string& name, double wl[ 2 ] )
+{
+ this->SetWindowLevel( name, wl[ 0 ], wl[ 1 ] );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetWindowLevel( const std::string& name, double w, double l )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->SetWindowLevel( w, l );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetWindow( const std::string& name, double w )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->SetWindow( w );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetLevel( const std::string& name, double l )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->SetLevel( l );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetImageInterpolation( const std::string& name, char i )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ int int_type = VTK_NEAREST_INTERPOLATION;
+ switch( i )
+ {
+ case 'L': int_type = VTK_LINEAR_INTERPOLATION; break;
+ case 'C': int_type = VTK_CUBIC_INTERPOLATION; break;
+ default: int_type = VTK_NEAREST_INTERPOLATION; break;
+ } // hctiws
+ a->GetProperty( )->SetInterpolationType( int_type );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetColor( const std::string& name, double r, double g, double b )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetColor( r, g, b );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetOpacity( const std::string& name, double o )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ vtkImageSlice* s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetOpacity( o );
+ }
+ else if( s != NULL )
+ {
+ render = true;
+ s->GetProperty( )->SetOpacity( o );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetPointSize( const std::string& name, double s )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetPointSize( s );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetLineWidth( const std::string& name, double w )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetLineWidth( w );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToPoints( const std::string& name )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetRepresentationToPoints( );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToSurface( const std::string& name )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetRepresentationToSurface( );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::RendererWidget::
+SetRepresentationToWireframe( const std::string& name )
+{
+ auto it = this->m_ViewProps.find( name );
+ if( it != this->m_ViewProps.end( ) )
+ {
+ bool render = false;
+ for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
+ {
+ vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( a != NULL )
+ {
+ render = true;
+ a->GetProperty( )->SetRepresentationToWireframe( );
+
+ } // fi
+
+ } // rof
+ if( render )
+ this->Render( );
+
+ } // fi
+}
+