#ifdef cpExtensions_QT4
#include <cpExtensions/Interaction/ImageSliceStyle.h>
+#include <cpExtensions/Visualization/LUTImageActor.h>
#include <cpExtensions/Visualization/MeshActor.h>
#include <cpExtensions/Visualization/OutlineSource.h>
#include <cpExtensions/Visualization/WindowLevelImageActor.h>
+#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkImageData.h>
+#include <vtkImageProperty.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
cpExtensions::QT::ImageWidget::
~ImageWidget( )
{
+ this->Clear( );
if( this->m_OutlineActor != NULL )
delete this->m_OutlineActor;
+ for( auto a = this->m_Actors.begin( ); a != this->m_Actors.end( ); ++a )
+ delete *a;
+ this->m_Actors.clear( );
}
// -------------------------------------------------------------------------
this->m_WLActor->SetImage( image );
this->m_WLActor->SetOrientation( orientation );
+ this->m_LUTActor = vtkSmartPointer< TLUTActor >::New( );
+ this->m_LUTActor->SetOrientation( orientation );
+
this->m_Outline = vtkSmartPointer< TOutline >::New( );
this->m_Outline->SetBounds( image->GetBounds( ) );
this->m_Outline->Update( );
this->ResetCamera( );
}
+// -------------------------------------------------------------------------
+void cpExtensions::QT::ImageWidget::
+Add( vtkDataSet* data, const std::string& name )
+{
+ auto image = dynamic_cast< vtkImageData* >( data );
+ auto pdata = dynamic_cast< vtkPolyData* >( data );
+ if( image != NULL )
+ {
+ this->m_LUTActor->AddImage( image );
+ this->m_LUTActor->GetProperty( )->SetOpacity( 0.5 );
+ this->AddViewProp( this->m_LUTActor, "__LUT_IMAGE__" );
+ this->Render( );
+ }
+ else if( pdata != NULL )
+ {
+ TActor* actor = new TActor( );
+ actor->SetMesh( pdata );
+ this->m_Actors.push_back( actor );
+ this->AddViewProp( actor->GetActor( ), name );
+ this->Render( );
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
void cpExtensions::QT::ImageWidget::
ResetCamera( )
}
else if( ori == 2 )
{
- if ( this->m_Quadrant == 0 ) up[ 1 ] = double( 1 );
- else if( this->m_Quadrant == 1 ) up[ 1 ] = double( 1 );
- else if( this->m_Quadrant == 2 ) up[ 1 ] = double( 1 );
- else if( this->m_Quadrant == 3 ) up[ 1 ] = double( 1 );
+ if ( this->m_Quadrant == 0 ) up[ 1 ] = double( -1 );
+ else if( this->m_Quadrant == 1 ) up[ 1 ] = double( -1 );
+ else if( this->m_Quadrant == 2 ) up[ 1 ] = double( -1 );
+ else if( this->m_Quadrant == 3 ) up[ 1 ] = double( -1 );
pos[ 2 ] *= double( -1 );
} // fi
return( this->m_WLActor );
}
+// -------------------------------------------------------------------------
+void cpExtensions::QT::ImageWidget::
+SetColor( const std::string& name, double r, double g, double b )
+{
+ auto props = this->GetViewProps( name );
+ for( auto p = props.begin( ); p != props.end( ); ++p )
+ {
+ auto actor = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( actor != NULL )
+ actor->GetProperty( )->SetColor( r, g, b );
+
+ } // rof
+ this->Render( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::ImageWidget::
+SetLineWidth( const std::string& name, double w )
+{
+ auto props = this->GetViewProps( name );
+ for( auto p = props.begin( ); p != props.end( ); ++p )
+ {
+ auto actor = dynamic_cast< vtkActor* >( p->GetPointer( ) );
+ if( actor != NULL )
+ actor->GetProperty( )->SetLineWidth( w );
+
+ } // rof
+ this->Render( );
+}
+
/* TODO
// -------------------------------------------------------------------------