cpBaseQtApplication_ConnectAction( ActionAddEnvironmentPath, _addEnvironmentPaths );
cpBaseQtApplication_ConnectAction( ActionLoadPluginFile, _loadPlugins );
cpBaseQtApplication_ConnectAction( ActionLoadPluginDirectory, _loadPluginsFromPath );
+ cpBaseQtApplication_ConnectAction( ActionActorsProperties, _actorsProperties );
}
// -------------------------------------------------------------------------
<height>60</height>
</size>
</property>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
</widget>
<widget class="cpBaseQtApplication::Canvas" name="Canvas" native="true">
<property name="minimumSize">
<x>0</x>
<y>0</y>
<width>640</width>
- <height>22</height>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<addaction name="ActionShowPlugins"/>
<addaction name="ActionAddEnvironmentPath"/>
</widget>
+ <widget class="QMenu" name="menuProperties">
+ <property name="title">
+ <string>P&roperties</string>
+ </property>
+ <addaction name="ActionActorsProperties"/>
+ </widget>
<addaction name="menuFile"/>
+ <addaction name="menuProperties"/>
<addaction name="menuPlugins"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<string>Ctrl+F9</string>
</property>
</action>
+ <action name="ActionActorsProperties">
+ <property name="text">
+ <string>&Actors</string>
+ </property>
+ <property name="toolTip">
+ <string>Actors properties</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+V</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
#include <QMessageBox>
#include <cpExtensions/QT/SimpleMPRWidget.h>
+#include <cpExtensions/QT/ConfigurationChooser.h>
#include <vtkDataSet.h>
this->_loadPluginsFromPath( d.selectedFiles( ).begin( )->toStdString( ) );
}
+// -------------------------------------------------------------------------
+void cpBaseQtApplication::MainWindow::
+_actorsProperties( )
+{
+ if( this->m_MPR != NULL )
+ {
+ auto dlg = new cpExtensions::QT::ConfigurationChooser( this );
+ dlg->setData( this->m_MPR );
+ dlg->exec( );
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
/* TODO
void cpBaseQtApplication::MainWindow::
void _loadPlugins( );
void _loadPluginsFromPath( const std::string& path );
void _loadPluginsFromPath( );
+ void _actorsProperties( );
/* TODO
void _ClearWorkspace( );
--- /dev/null
+#ifndef __cpExtensions__QT__ActorsWidgetInterface__h__
+#define __cpExtensions__QT__ActorsWidgetInterface__h__
+
+#include <cpExtensions/Config.h>
+
+#ifdef cpExtensions_QT4
+
+#include <string>
+#include <set>
+
+namespace cpExtensions
+{
+ namespace QT
+ {
+ /**
+ */
+ class cpExtensions_EXPORT ActorsWidgetInterface
+ {
+ public:
+ typedef ActorsWidgetInterface Self;
+
+ public:
+ ActorsWidgetInterface( ) { }
+ virtual ~ActorsWidgetInterface( ) { }
+
+ virtual std::set< std::string > GetActorsNames( ) const = 0;
+ virtual bool IsWindowLevelImageActor( const std::string& name ) const = 0;
+ virtual bool IsLUTImageActor( const std::string& name ) const = 0;
+ virtual bool Is3DActor( const std::string& name ) const = 0;
+
+ virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const = 0;
+ virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const = 0;
+ virtual double GetWindow( const std::string& name ) const = 0;
+ virtual double GetLevel( const std::string& name ) const = 0;
+ virtual char GetImageInterpolation( const std::string& name ) const = 0;
+
+ virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const = 0;
+ virtual double GetOpacity( const std::string& name ) const = 0;
+ virtual double GetPointSize( const std::string& name ) const = 0;
+ virtual double GetLineWidth( const std::string& name ) const = 0;
+ virtual int GetRepresentation( const std::string& name ) const = 0;
+
+ virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) = 0;
+ virtual void SetScalarRange( const std::string& name, double min, double max ) = 0;
+ virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) = 0;
+ virtual void SetWindowLevel( const std::string& name, double w, double l ) = 0;
+ virtual void SetWindow( const std::string& name, double w ) = 0;
+ virtual void SetLevel( const std::string& name, double l ) = 0;
+ virtual void SetImageInterpolation( const std::string& name, char i ) = 0;
+
+ virtual void SetColor( const std::string& name, double r, double g, double b ) = 0;
+ virtual void SetOpacity( const std::string& name, double o ) = 0;
+ virtual void SetPointSize( const std::string& name, double s ) = 0;
+ virtual void SetLineWidth( const std::string& name, double w ) = 0;
+ virtual void SetRepresentationToPoints( const std::string& name ) = 0;
+ virtual void SetRepresentationToSurface( const std::string& name ) = 0;
+ virtual void SetRepresentationToWireframe( const std::string& name ) = 0;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // cpExtensions_QT4
+
+#endif // __cpExtensions__QT__ActorsWidgetInterface__h__
+
+// eof - $RCSfile$
#ifdef cpExtensions_QT4
#include <cpExtensions/QT/ui_ConfigurationChooser.h>
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
#include <cpExtensions/QT/WindowLevelImageConfiguration.h>
-#include <cpExtensions/QT/SimpleMPRWidget.h>
// -------------------------------------------------------------------------
cpExtensions::QT::ConfigurationChooser::
// -------------------------------------------------------------------------
void cpExtensions::QT::ConfigurationChooser::
-setData( SimpleMPRWidget* data )
+setData( ActorsWidgetInterface* data )
{
this->m_Data = data;
if( this->m_Data != NULL )
{
- auto wl_wdg = new WindowLevelImageConfiguration( this );
- wl_wdg->setData( data );
- this->m_UI->Configurations->addTab( wl_wdg, "Image" );
+ auto actors = this->m_Data->GetActorsNames( );
+ for( auto n = actors.begin( ); n != actors.end( ); ++n )
+ {
+ if( this->m_Data->IsWindowLevelImageActor( *n ) )
+ {
+ auto wl_wdg = new WindowLevelImageConfiguration( this );
+ wl_wdg->setData( data, *n );
+ this->m_UI->Configurations->addTab( wl_wdg, n->c_str( ) );
+ }
+ else if( this->m_Data->IsLUTImageActor( *n ) )
+ {
+ }
+ else if( this->m_Data->Is3DActor( *n ) )
+ {
+ } // fi
+
+ } // rof
} // fi
}
{
namespace QT
{
- class SimpleMPRWidget;
+ class ActorsWidgetInterface;
/**
*/
explicit ConfigurationChooser( QWidget* parent = NULL, Qt::WindowFlags f = 0 );
virtual ~ConfigurationChooser( );
- void setData( SimpleMPRWidget* data );
+ void setData( ActorsWidgetInterface* data );
protected:
Ui::ConfigurationChooser* m_UI;
- SimpleMPRWidget* m_Data;
+ ActorsWidgetInterface* m_Data;
};
} // ecapseman
#include <vtkProperty.h>
#include <vtkRenderer.h>
-/* TODO
- #include <cpExtensions/Visualization/ImageViewerActors.h>
- #include <cpExtensions/Visualization/LUTImageActor.h>
- #include <vtkImageData.h>
- #include <vtkImageProperty.h>
-*/
-
// -------------------------------------------------------------------------
cpExtensions::QT::ImageWidget::
ImageWidget( QWidget* parent, Qt::WindowFlags f )
this->Render( );
}
-
-/* TODO
-// -------------------------------------------------------------------------
-vtkInteractorStyle* cpExtensions::QT::ImageWidget::
-GetInteractorStyle( )
-{
- return( this->m_ImageSliceStyle );
-}
-
-// -------------------------------------------------------------------------
-const vtkInteractorStyle* cpExtensions::QT::ImageWidget::
-GetInteractorStyle( ) const
-{
- return( this->m_ImageSliceStyle );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetImage( vtkImageData* image, int orientation, const std::string& name )
-{
- if( this->m_ImageName != "" )
- {
- // TODO: Clear visualization
-
- } // fi
- this->m_ImageName = name;
-
- this->GetActiveCamera( )->ParallelProjectionOn( );
-
- this->m_ImageViewerActors =
- vtkSmartPointer< cpExtensions::Visualization::ImageViewerActors >::New( );
- this->m_ImageViewerActors->SetImage( image, orientation );
-
- this->m_ImageSliceStyle->SetActors( this->m_ImageViewerActors );
-
- this->AddViewProp(
- this->m_ImageViewerActors->GetWindowLevelImageActor( ),
- this->m_ImageName
- );
- this->AddAuxViewProps( this->m_ImageViewerActors, this->m_ImageName );
- this->ResetCamera( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-Add( vtkDataSet* data, const std::string& name )
-{
- auto image = dynamic_cast< vtkImageData* >( data );
-
- if( image == NULL )
- {
- if( this->m_ImageName == "" )
- this->SetImage( data, name );
- {
- } // fi
- return;
-
- } // fi
-
- if( this->m_ImageName == "" )
- return;
-
- if( this->m_ImageViewerActors.GetPointer( ) != NULL )
- {
- if( this->m_ImageViewerActors->AddLUTImage( image ) > 0 )
- {
- this->AddViewProp(
- this->m_ImageViewerActors->GetLUTImageActor( ),
- name
- );
- this->Render( );
-
- } // fi
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-int cpExtensions::QT::ImageWidget::
-GetOrientation( ) const
-{
- return( this->m_ImageViewerActors->GetOrientation( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetSliceNumber( int slice )
-{
- this->m_ImageViewerActors->SetSliceNumber( slice );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-GetScalarRange( double r[ 2 ] ) const
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- actor->GetRange( r );
- else
- r[ 0 ] = r[ 1 ] = double( 0 );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-GetWindowLevel( double wl[ 2 ] ) const
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- wl[ 0 ] = actor->GetWindow( );
- wl[ 1 ] = actor->GetLevel( );
- }
- else
- wl[ 0 ] = wl[ 1 ] = double( 0 );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::ImageWidget::
-GetImageOpacity( ) const
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- return( actor->GetProperty( )->GetOpacity( ) );
- else
- return( double( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-unsigned char cpExtensions::QT::ImageWidget::
-GetImageInterpolation( ) const
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- int int_type = actor->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 );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetScalarRange( double r[ 2 ] )
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- actor->ConfigureWindowLevel( r[ 0 ], r[ 1 ] );
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetWindowLevel( double wl[ 2 ] )
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- actor->SetWindowLevel( wl[ 0 ], wl[ 1 ] );
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetImageOpacity( double o )
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- actor->GetProperty( )->SetOpacity( o );
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::ImageWidget::
-SetImageInterpolation( unsigned char i )
-{
- auto actor = this->m_ImageViewerActors->GetWindowLevelImageActor( );
- if( actor != NULL )
- {
- int int_type = 0;
- 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
- actor->GetProperty( )->SetInterpolationType( int_type );
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-vtkProp* cpExtensions::QT::ImageWidget::
-GetImageActor( )
-{
- return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) );
-}
-
-// -------------------------------------------------------------------------
-const vtkProp* cpExtensions::QT::ImageWidget::
-GetImageActor( ) const
-{
- return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) );
-}
-*/
-
#endif // cpExtensions_QT4
// eof - $RCSfile$
void SetColor( const std::string& name, double r, double g, double b );
void SetLineWidth( const std::string& name, double w );
- /* TODO
- void SetImage(
- vtkImageData* image, int orientation, const std::string& name
- );
-
- // TODO: std::vector< vtkProp* > GetActors( const std::string& name ) const;
- int GetOrientation( ) const;
- void SetSliceNumber( int slice );
-
-
- void GetScalarRange( double r[ 2 ] ) const;
- void GetWindowLevel( double wl[ 2 ] ) const;
- double GetImageOpacity( ) const;
- unsigned char GetImageInterpolation( ) const;
-
- void SetScalarRange( double r[ 2 ] );
- void SetWindowLevel( double wl[ 2 ] );
- void SetImageOpacity( double o );
- void SetImageInterpolation( unsigned char i );
-
- vtkProp* GetImageActor( );
- const vtkProp* GetImageActor( ) const;
- */
-
protected:
std::string m_ImageName;
std::vector< TActor* > m_Actors;
vtkSmartPointer< TStyle > m_Style;
-
- /* TODO
- protected:
- vtkSmartPointer< cpExtensions::Visualization::ImageViewerActors >
- m_ImageViewerActors;
- vtkSmartPointer< cpExtensions::Interaction::ImageSliceStyle >
- m_ImageSliceStyle;
- std::string m_ImageName;
- */
};
} // ecapseman
#include <vtkPlane.h>
#include <vtkPolyData.h>
-/* TODO
- #include <cpExtensions/Visualization/MPR3DActors.h>
- #include <cpExtensions/Visualization/LUTImageActor.h>
-
- #include <vtkActor.h>
-*/
-
// -------------------------------------------------------------------------
cpExtensions::QT::MPR3DWidget::
MPR3DWidget( QWidget* parent, Qt::WindowFlags f )
: Superclass( parent, f ),
m_ImageName( "" )
{
- /* TODO
- this->m_Actors =
- vtkSmartPointer< cpExtensions::Visualization::MPR3DActors >::New( );
- */
}
// -------------------------------------------------------------------------
this->Render( );
}
-// -------------------------------------------------------------------------
-/*
-void cpExtensions::QT::MPR3DWidget::
-SetImage( vtkImageData* image, const std::string& name )
-{
- if( this->m_ImageName != "" )
- {
- // TODO: Clear visualization
-
- } // fi
-
- this->m_Actors->SetImage( image );
- this->m_ImageName = name;
-
- vtkSmartPointer< vtkPropCollection > props =
- vtkSmartPointer< vtkPropCollection >::New( );
- props->AddItem( this->m_Actors->GetWindowLevelImageActor( 0 ) );
- props->AddItem( this->m_Actors->GetWindowLevelImageActor( 1 ) );
- props->AddItem( this->m_Actors->GetWindowLevelImageActor( 2 ) );
- this->AddViewProps( props, name );
- this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 0 ), name );
- this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 1 ), name );
- this->AddAuxViewProp( this->m_Actors->GetImageOutlineActor( 2 ), name );
- this->ResetCamera( );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetSliceNumber( int orientation, int slice )
-{
- this->m_Actors->SetSliceNumber( orientation, slice );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetSlicesNumbers( int x, int y, int z )
-{
- this->m_Actors->SetSliceNumber( 0, x );
- this->m_Actors->SetSliceNumber( 1, y );
- this->m_Actors->SetSliceNumber( 2, z );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetScalarRange( double r[ 2 ] )
-{
- this->m_Actors->SetScalarRange( r );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetWindowLevel( double wl[ 2 ] )
-{
- this->m_Actors->SetWindowLevel( wl );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetImageOpacity( double o )
-{
- this->m_Actors->SetImageOpacity( o );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::MPR3DWidget::
-SetImageInterpolation( unsigned char i )
-{
- this->m_Actors->SetImageInterpolation( i );
- this->Render( );
-}
- */
-
#endif // cpExtensions_QT4
// eof - $RCSfile$
void SetSliceNumber( int orientation, int slice );
void SetSlicesNumbers( int x, int y, int z );
- /* TODO
- void SetImage( vtkImageData* image, const std::string& name );
-
-
- void SetScalarRange( double r[ 2 ] );
- void SetWindowLevel( double wl[ 2 ] );
- void SetImageOpacity( double o );
- void SetImageInterpolation( unsigned char i );
- */
-
protected:
std::string m_ImageName;
vtkSmartPointer< TWLActor > m_WLActors[ 3 ];
vtkSmartPointer< TOLActor > m_OLActors[ 3 ];
std::vector< TActor* > m_Actors;
-
- /* TODO
- vtkSmartPointer< cpExtensions::Visualization::MPR3DActors > m_Actors;
- std::string m_ImageName;
- */
};
} // ecapseman
#include <vtkAxesActor.h>
#include <vtkCamera.h>
+#include <vtkImageProperty.h>
#include <vtkInteractorStyle.h>
#include <vtkOrientationMarkerWidget.h>
+#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
+#include <cpExtensions/Visualization/LUTImageActor.h>
+#include <cpExtensions/Visualization/WindowLevelImageActor.h>
// -------------------------------------------------------------------------
cpExtensions::QT::RendererWidget::
RendererWidget( QWidget* parent, Qt::WindowFlags f )
- : Superclass( parent, f )
+ : Superclass( parent, f ),
+ Superclass2( )
{
this->m_Renderer = vtkSmartPointer< vtkRenderer >::New( );
this->GetRenderWindow( )->AddRenderer( this->m_Renderer );
this->GetRenderWindow( )->Render( );
}
+// -------------------------------------------------------------------------
+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
+}
+
#endif // cpExtensions_QT4
// eof - $RCSfile$
#ifdef cpExtensions_QT4
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
#include <vtkSmartPointer.h>
#include <map>
#include <set>
// -------------------------------------------------------------------------
namespace cpExtensions
{
+ namespace Visualization
+ {
+ class LUTImageActor;
+ class WindowLevelImageActor;
+ }
+
namespace QT
{
/**
*/
class cpExtensions_EXPORT RendererWidget
- : public cpExtensions_QVTKWidget
+ : public cpExtensions_QVTKWidget,
+ public ActorsWidgetInterface
{
Q_OBJECT;
public:
typedef RendererWidget Self;
typedef cpExtensions_QVTKWidget Superclass;
+ typedef ActorsWidgetInterface Superclass2;
typedef std::set< vtkSmartPointer< vtkProp > > TProps;
typedef std::map< std::string, TProps > TPropCollection;
+ typedef cpExtensions::Visualization::LUTImageActor TLUTActor;
+ typedef cpExtensions::Visualization::WindowLevelImageActor TWLActor;
+
public:
explicit RendererWidget(
QWidget* parent = NULL, Qt::WindowFlags f = 0
virtual void ResetCamera( );
virtual void Render( );
+ virtual std::set< std::string > GetActorsNames( ) const cpExtensions_OVERRIDE;
+ virtual bool IsWindowLevelImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool IsLUTImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool Is3DActor( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual double GetWindow( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLevel( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual char GetImageInterpolation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const cpExtensions_OVERRIDE;
+ virtual double GetOpacity( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetPointSize( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLineWidth( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual int GetRepresentation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetScalarRange( const std::string& name, double min, double max ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double w, double l ) cpExtensions_OVERRIDE;
+ virtual void SetWindow( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetLevel( const std::string& name, double l ) cpExtensions_OVERRIDE;
+ virtual void SetImageInterpolation( const std::string& name, char i ) cpExtensions_OVERRIDE;
+
+ virtual void SetColor( const std::string& name, double r, double g, double b ) cpExtensions_OVERRIDE;
+ virtual void SetOpacity( const std::string& name, double o ) cpExtensions_OVERRIDE;
+ virtual void SetPointSize( const std::string& name, double s ) cpExtensions_OVERRIDE;
+ virtual void SetLineWidth( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToPoints( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToSurface( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToWireframe( const std::string& name ) cpExtensions_OVERRIDE;
+
protected:
vtkSmartPointer< vtkRenderer > m_Renderer;
vtkSmartPointer< vtkOrientationMarkerWidget > m_Marker;
cpExtensions::QT::SimpleMPRWidget::
SimpleMPRWidget( QWidget* parent, Qt::WindowFlags f )
: Superclass( parent, f ),
+ Superclass2( ),
m_UI( new Ui::SimpleMPRWidget ),
m_MainImageName( "" )
{
this->m_UI->Bottom, SIGNAL( splitterMoved( int, int ) ),
this, SLOT( _SyncTop( int, int ) )
);
- this->connect(
- this->m_UI->ConfigurationButton, SIGNAL( clicked( ) ),
- this, SLOT( _ConfigurationButton( ) )
- );
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-GetScalarRange( double r[ 2 ] ) const
+ResetCameras( )
+{
+/*
+ this->m_XImage->ResetCamera( );
+ this->m_YImage->ResetCamera( );
+ this->m_ZImage->ResetCamera( );
+ this->m_3DView->ResetCamera( );
+*/
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+Render( )
+{
+/*
+ this->m_XImage->Render( );
+ this->m_YImage->Render( );
+ this->m_ZImage->Render( );
+ this->m_3DView->Render( );
+*/
+}
+
+// -------------------------------------------------------------------------
+std::set< std::string > cpExtensions::QT::SimpleMPRWidget::
+GetActorsNames( ) const
+{
+ std::set< std::string > names = this->m_XImage->GetActorsNames( );
+ std::set< std::string > y = this->m_YImage->GetActorsNames( );
+ std::set< std::string > z = this->m_ZImage->GetActorsNames( );
+ std::set< std::string > w = this->m_3DView->GetActorsNames( );
+ names.insert( y.begin( ), y.end( ) );
+ names.insert( z.begin( ), z.end( ) );
+ names.insert( w.begin( ), w.end( ) );
+ return( names );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+IsWindowLevelImageActor( const std::string& name ) const
+{
+ return( this->m_XImage->IsWindowLevelImageActor( name ) );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+IsLUTImageActor( const std::string& name ) const
+{
+ return( this->m_XImage->IsLUTImageActor( name ) );
+}
+
+// -------------------------------------------------------------------------
+bool cpExtensions::QT::SimpleMPRWidget::
+Is3DActor( const std::string& name ) const
+{
+ return(
+ this->m_XImage->Is3DActor( name ) || this->m_3DView->Is3DActor( name )
+ );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+GetScalarRange( const std::string& name, double r[ 2 ] ) const
{
-// this->m_XImage->GetScalarRange( r );
+ this->m_XImage->GetScalarRange( name, r );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-GetWindowLevel( double wl[ 2 ] ) const
+GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
{
-// this->m_XImage->GetWindowLevel( wl );
+ this->m_XImage->GetWindowLevel( name, wl );
}
// -------------------------------------------------------------------------
double cpExtensions::QT::SimpleMPRWidget::
-GetImageOpacity( ) const
+GetWindow( const std::string& name ) const
{
-// return( this->m_XImage->GetImageOpacity( ) );
+ return( this->m_XImage->GetWindow( name ) );
}
// -------------------------------------------------------------------------
-unsigned char cpExtensions::QT::SimpleMPRWidget::
-GetImageInterpolation( ) const
+double cpExtensions::QT::SimpleMPRWidget::
+GetLevel( const std::string& name ) const
{
-// return( this->m_XImage->GetImageInterpolation( ) );
+ return( this->m_XImage->GetLevel( name ) );
+}
+
+// -------------------------------------------------------------------------
+char cpExtensions::QT::SimpleMPRWidget::
+GetImageInterpolation( const std::string& name ) const
+{
+ return( this->m_XImage->GetImageInterpolation( name ) );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-SetScalarRange( double r[ 2 ] )
+GetColor( const std::string& name, double& r, double& g, double& b ) const
{
-/*
- this->m_XImage->SetScalarRange( r );
- this->m_YImage->SetScalarRange( r );
- this->m_ZImage->SetScalarRange( r );
- this->m_3DView->SetScalarRange( r );
-*/
+ this->m_XImage->GetColor( name, r, g, b );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetOpacity( const std::string& name ) const
+{
+ return( this->m_XImage->GetOpacity( name ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetPointSize( const std::string& name ) const
+{
+ return( this->m_XImage->GetPointSize( name ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::QT::SimpleMPRWidget::
+GetLineWidth( const std::string& name ) const
+{
+ return( this->m_XImage->GetLineWidth( name ) );
+}
+
+// -------------------------------------------------------------------------
+int cpExtensions::QT::SimpleMPRWidget::
+GetRepresentation( const std::string& name ) const
+{
+ return( this->m_XImage->GetRepresentation( name ) );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-SetWindowLevel( double wl[ 2 ] )
+SetScalarRange( const std::string& name, double r[ 2 ] )
{
-/*
- this->m_XImage->SetWindowLevel( wl );
- this->m_YImage->SetWindowLevel( wl );
- this->m_ZImage->SetWindowLevel( wl );
- this->m_3DView->SetWindowLevel( wl );
-*/
+ this->m_XImage->SetScalarRange( name, r );
+ this->m_YImage->SetScalarRange( name, r );
+ this->m_ZImage->SetScalarRange( name, r );
+ this->m_3DView->SetScalarRange( name, r );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-SetImageOpacity( double o )
+SetScalarRange( const std::string& name, double min, double max )
{
-/*
- this->m_XImage->SetImageOpacity( o );
- this->m_YImage->SetImageOpacity( o );
- this->m_ZImage->SetImageOpacity( o );
- this->m_3DView->SetImageOpacity( o );
-*/
+ this->m_XImage->SetScalarRange( name, min, max );
+ this->m_YImage->SetScalarRange( name, min, max );
+ this->m_ZImage->SetScalarRange( name, min, max );
+ this->m_3DView->SetScalarRange( name, min, max );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-SetImageInterpolation( unsigned char i )
+SetWindowLevel( const std::string& name, double wl[ 2 ] )
{
- /*
- this->m_XImage->SetImageInterpolation( i );
- this->m_YImage->SetImageInterpolation( i );
- this->m_ZImage->SetImageInterpolation( i );
- this->m_3DView->SetImageInterpolation( i );
-*/
+ this->m_XImage->SetWindowLevel( name, wl );
+ this->m_YImage->SetWindowLevel( name, wl );
+ this->m_ZImage->SetWindowLevel( name, wl );
+ this->m_3DView->SetWindowLevel( name, wl );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-ResetCameras( )
+SetWindowLevel( const std::string& name, double w, double l )
{
-/*
- this->m_XImage->ResetCamera( );
- this->m_YImage->ResetCamera( );
- this->m_ZImage->ResetCamera( );
- this->m_3DView->ResetCamera( );
-*/
+ this->m_XImage->SetWindowLevel( name, w, l );
+ this->m_YImage->SetWindowLevel( name, w, l );
+ this->m_ZImage->SetWindowLevel( name, w, l );
+ this->m_3DView->SetWindowLevel( name, w, l );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-Render( )
+SetWindow( const std::string& name, double w )
{
-/*
- this->m_XImage->Render( );
- this->m_YImage->Render( );
- this->m_ZImage->Render( );
- this->m_3DView->Render( );
-*/
+ this->m_XImage->SetWindow( name, w );
+ this->m_YImage->SetWindow( name, w );
+ this->m_ZImage->SetWindow( name, w );
+ this->m_3DView->SetWindow( name, w );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-_SyncBottom( int a, int b )
+SetLevel( const std::string& name, double l )
{
- this->m_UI->Bottom->setSizes( this->m_UI->Top->sizes( ) );
+ this->m_XImage->SetLevel( name, l );
+ this->m_YImage->SetLevel( name, l );
+ this->m_ZImage->SetLevel( name, l );
+ this->m_3DView->SetLevel( name, l );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-_SyncTop( int a, int b )
+SetImageInterpolation( const std::string& name, char i )
{
- this->m_UI->Top->setSizes( this->m_UI->Bottom->sizes( ) );
+ this->m_XImage->SetImageInterpolation( name, i );
+ this->m_YImage->SetImageInterpolation( name, i );
+ this->m_ZImage->SetImageInterpolation( name, i );
+ this->m_3DView->SetImageInterpolation( name, i );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetColor( const std::string& name, double r, double g, double b )
+{
+ this->m_XImage->SetColor( name, r, g, b );
+ this->m_YImage->SetColor( name, r, g, b );
+ this->m_ZImage->SetColor( name, r, g, b );
+ this->m_3DView->SetColor( name, r, g, b );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetOpacity( const std::string& name, double o )
+{
+ this->m_XImage->SetOpacity( name, o );
+ this->m_YImage->SetOpacity( name, o );
+ this->m_ZImage->SetOpacity( name, o );
+ this->m_3DView->SetOpacity( name, o );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-_ConfigurationButton( )
+SetPointSize( const std::string& name, double s )
{
- auto dlg = new cpExtensions::QT::ConfigurationChooser( NULL );
- dlg->setData( this );
- dlg->exec( );
+ this->m_XImage->SetPointSize( name, s );
+ this->m_YImage->SetPointSize( name, s );
+ this->m_ZImage->SetPointSize( name, s );
+ this->m_3DView->SetPointSize( name, s );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetLineWidth( const std::string& name, double w )
+{
+ this->m_XImage->SetLineWidth( name, w );
+ this->m_YImage->SetLineWidth( name, w );
+ this->m_ZImage->SetLineWidth( name, w );
+ this->m_3DView->SetLineWidth( name, w );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToPoints( const std::string& name )
+{
+ this->m_XImage->SetRepresentationToPoints( name );
+ this->m_YImage->SetRepresentationToPoints( name );
+ this->m_ZImage->SetRepresentationToPoints( name );
+ this->m_3DView->SetRepresentationToPoints( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToSurface( const std::string& name )
+{
+ this->m_XImage->SetRepresentationToSurface( name );
+ this->m_YImage->SetRepresentationToSurface( name );
+ this->m_ZImage->SetRepresentationToSurface( name );
+ this->m_3DView->SetRepresentationToSurface( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetRepresentationToWireframe( const std::string& name )
+{
+ this->m_XImage->SetRepresentationToWireframe( name );
+ this->m_YImage->SetRepresentationToWireframe( name );
+ this->m_ZImage->SetRepresentationToWireframe( name );
+ this->m_3DView->SetRepresentationToWireframe( name );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+_SyncBottom( int a, int b )
+{
+ this->m_UI->Bottom->setSizes( this->m_UI->Top->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+_SyncTop( int a, int b )
+{
+ this->m_UI->Top->setSizes( this->m_UI->Bottom->sizes( ) );
}
#endif // cpExtensions_QT4
#ifdef cpExtensions_QT4
-// TODO: #include <cpExtensions/Visualization/MeshActor.h>
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
#include <QWidget>
#include <vtkSmartPointer.h>
#include <map>
/**
*/
class cpExtensions_EXPORT SimpleMPRWidget
- : public QWidget
+ : public QWidget,
+ public ActorsWidgetInterface
{
Q_OBJECT;
public:
- typedef SimpleMPRWidget Self;
- typedef QWidget Superclass;
+ typedef SimpleMPRWidget Self;
+ typedef QWidget Superclass;
+ typedef ActorsWidgetInterface Superclass2;
typedef vtkSmartPointer< vtkPropCollection > TProp;
typedef std::set< TProp > TProps;
vtkRenderWindow* GetWRenderWindow( );
const vtkRenderWindow* GetWRenderWindow( ) const;
- void GetScalarRange( double r[ 2 ] ) const;
- void GetWindowLevel( double wl[ 2 ] ) const;
- double GetImageOpacity( ) const;
- unsigned char GetImageInterpolation( ) const;
-
- void SetScalarRange( double r[ 2 ] );
- void SetWindowLevel( double wl[ 2 ] );
- void SetImageOpacity( double o );
- void SetImageInterpolation( unsigned char i );
-
- /* TODO
- std::vector< vtkProp* > GetActors( const std::string& name ) const;
- */
-
void ResetCameras( );
void Render( );
+ virtual std::set< std::string > GetActorsNames( ) const cpExtensions_OVERRIDE;
+ virtual bool IsWindowLevelImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool IsLUTImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual bool Is3DActor( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const cpExtensions_OVERRIDE;
+ virtual double GetWindow( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLevel( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual char GetImageInterpolation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const cpExtensions_OVERRIDE;
+ virtual double GetOpacity( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetPointSize( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual double GetLineWidth( const std::string& name ) const cpExtensions_OVERRIDE;
+ virtual int GetRepresentation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+ virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetScalarRange( const std::string& name, double min, double max ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) cpExtensions_OVERRIDE;
+ virtual void SetWindowLevel( const std::string& name, double w, double l ) cpExtensions_OVERRIDE;
+ virtual void SetWindow( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetLevel( const std::string& name, double l ) cpExtensions_OVERRIDE;
+ virtual void SetImageInterpolation( const std::string& name, char i ) cpExtensions_OVERRIDE;
+
+ virtual void SetColor( const std::string& name, double r, double g, double b ) cpExtensions_OVERRIDE;
+ virtual void SetOpacity( const std::string& name, double o ) cpExtensions_OVERRIDE;
+ virtual void SetPointSize( const std::string& name, double s ) cpExtensions_OVERRIDE;
+ virtual void SetLineWidth( const std::string& name, double w ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToPoints( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToSurface( const std::string& name ) cpExtensions_OVERRIDE;
+ virtual void SetRepresentationToWireframe( const std::string& name ) cpExtensions_OVERRIDE;
+
private slots:
void _SyncBottom( int a, int b );
void _SyncTop( int a, int b );
- void _ConfigurationButton( );
protected:
Ui::SimpleMPRWidget* m_UI;
<rect>
<x>0</x>
<y>0</y>
- <width>94</width>
- <height>40</height>
+ <width>495</width>
+ <height>394</height>
</rect>
</property>
<property name="windowTitle">
</widget>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="ConfigurationButton">
- <property name="minimumSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
<resources/>
cpExtensions::QT::WindowLevelImageConfiguration::
WindowLevelImageConfiguration( QWidget* parent, Qt::WindowFlags f )
: Superclass( parent, f ),
- m_UI( new Ui::WindowLevelImageConfiguration )
+ m_UI( new Ui::WindowLevelImageConfiguration ),
+ m_Data( NULL ),
+ m_Name( "" )
{
this->m_UI->setupUi( this );
}
// -------------------------------------------------------------------------
void cpExtensions::QT::WindowLevelImageConfiguration::
-setData( SimpleMPRWidget* data )
+setData( ActorsWidgetInterface* data, const std::string& name )
{
if( this->m_Data != data )
{
this->m_Data = data;
+ this->m_Name = name;
// Get data
double range[ 2 ], win_lev[ 2 ];
- this->m_Data->GetScalarRange( range );
- this->m_Data->GetWindowLevel( win_lev );
+ this->m_Data->GetScalarRange( this->m_Name, range );
+ this->m_Data->GetWindowLevel( this->m_Name, win_lev );
// Intensity range
this->m_UI->MinimumBox->setMinimum( -1000000 );
this->m_UI->LevelSlider->setValue( l );
// Opacity
- double o = this->m_Data->GetImageOpacity( );
+ double o = this->m_Data->GetOpacity( this->m_Name );
o *=
double( this->m_UI->OpacitySlider->maximum( ) ) -
double( this->m_UI->OpacitySlider->minimum( ) );
this->m_UI->OpacitySlider->setValue( o );
// Interpolation mode
- switch( this->m_Data->GetImageInterpolation( ) )
+ switch( this->m_Data->GetImageInterpolation( this->m_Name ) )
{
case 'L': this->m_UI->InterpolatorBox->setCurrentIndex( 1 ); break;
case 'C': this->m_UI->InterpolatorBox->setCurrentIndex( 2 ); break;
double range[ 2 ];
range[ 0 ] = double( this->m_UI->MinimumBox->value( ) );
range[ 1 ] = double( v );
- this->m_Data->SetScalarRange( range );
+ this->m_Data->SetScalarRange( this->m_Name, range );
}
// -------------------------------------------------------------------------
double range[ 2 ];
range[ 0 ] = double( v );
range[ 1 ] = double( this->m_UI->MaximumBox->value( ) );
- this->m_Data->SetScalarRange( range );
+ this->m_Data->SetScalarRange( this->m_Name, range );
}
// -------------------------------------------------------------------------
double r[ 2 ];
double l, s;
- this->m_Data->GetScalarRange( r );
+ this->m_Data->GetScalarRange( this->m_Name, r );
if( this->sender( ) == this->m_UI->LevelSlider )
{
s = double( v ) / double( this->m_UI->LevelSlider->maximum( ) );
this->m_UI->LevelBox->setValue( l );
this->m_UI->LevelBox->blockSignals( b );
- double wl[ 2 ];
- this->m_Data->GetWindowLevel( wl );
- wl[ 1 ] = l;
- this->m_Data->SetWindowLevel( wl );
+ this->m_Data->SetLevel( this->m_Name, l );
}
// -------------------------------------------------------------------------
double r[ 2 ];
double w, s;
- this->m_Data->GetScalarRange( r );
+ this->m_Data->GetScalarRange( this->m_Name, r );
if( this->sender( ) == this->m_UI->WindowSlider )
{
s = double( v ) / double( this->m_UI->WindowSlider->maximum( ) );
this->m_UI->WindowBox->setValue( w );
this->m_UI->WindowBox->blockSignals( b );
- double wl[ 2 ];
- this->m_Data->GetWindowLevel( wl );
- wl[ 0 ] = w;
- this->m_Data->SetWindowLevel( wl );
+ this->m_Data->SetWindow( this->m_Name, w );
}
// -------------------------------------------------------------------------
o /=
double( this->m_UI->OpacitySlider->maximum( ) ) -
double( this->m_UI->OpacitySlider->minimum( ) );
- this->m_Data->SetImageOpacity( o );
+ this->m_Data->SetOpacity( this->m_Name, o );
} // fi
}
{
switch( v )
{
- case 1 : this->m_Data->SetImageInterpolation( 'L' ); break;
- case 2 : this->m_Data->SetImageInterpolation( 'C' ); break;
- default : this->m_Data->SetImageInterpolation( 'N' ); break;
+ case 1 : this->m_Data->SetImageInterpolation( this->m_Name, 'L' ); break;
+ case 2 : this->m_Data->SetImageInterpolation( this->m_Name, 'C' ); break;
+ default : this->m_Data->SetImageInterpolation( this->m_Name, 'N' ); break;
} // hctiws
}
{
namespace QT
{
- class SimpleMPRWidget;
+ class ActorsWidgetInterface;
/**
*/
);
virtual ~WindowLevelImageConfiguration( );
- void setData( SimpleMPRWidget* data );
+ void setData( ActorsWidgetInterface* data, const std::string& name );
protected slots:
void _maximumValue( int v );
protected:
Ui::WindowLevelImageConfiguration* m_UI;
- SimpleMPRWidget* m_Data;
+ ActorsWidgetInterface* m_Data;
+ std::string m_Name;
};
} // ecapseman