X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FQT%2FSimpleMPRWidget.h;h=6d32fc9dc3a41360e9fb0dfdab4ad3a561942744;hb=f1747c7248d5eead5ea9d7e57bda0b081bcef065;hp=f04362fc939e43039ac8b42c08c0cce352cf33e4;hpb=d33ca0ef613a3037614d9729bbea065124b07cce;p=cpPlugins.git diff --git a/lib/cpExtensions/QT/SimpleMPRWidget.h b/lib/cpExtensions/QT/SimpleMPRWidget.h index f04362f..6d32fc9 100644 --- a/lib/cpExtensions/QT/SimpleMPRWidget.h +++ b/lib/cpExtensions/QT/SimpleMPRWidget.h @@ -1,102 +1,116 @@ -#ifndef __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ -#define __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ +#ifndef __cpExtensions__QT__SimpleMPRWidget__h__ +#define __cpExtensions__QT__SimpleMPRWidget__h__ #include #ifdef cpExtensions_QT4 -#include -#include +#include #include -#include -#include -#include #include -#include - -#define cpExtensions_MAX_POLYS 65535 +#include +#include // ------------------------------------------------------------------------- -class QVTKWidget2; +class vtkDataSet; +class vtkProp; +class vtkPropCollection; -namespace Ui -{ - class SimpleMPRWidget; -} +namespace Ui { class SimpleMPRWidget; } // ------------------------------------------------------------------------- namespace cpExtensions { namespace QT { + class MPR3DWidget; + class ImageWidget; + /** */ class cpExtensions_EXPORT SimpleMPRWidget - : public QWidget + : public QWidget, + public ActorsWidgetInterface { Q_OBJECT; public: - typedef SimpleMPRWidget Self; - - struct TActorCmp - { - bool operator()( - const vtkSmartPointer< vtkProp >& a, - const vtkSmartPointer< vtkProp >& b - ) const - { return( a.GetPointer( ) < b.GetPointer( ) ); } - }; - typedef std::set< vtkSmartPointer< vtkProp >, TActorCmp > TActors; - typedef std::map< std::string, TActors > TNamedActors; - typedef cpExtensions::Visualization::ImageSliceActors TSliceActors; + typedef SimpleMPRWidget Self; + typedef QWidget Superclass; + typedef ActorsWidgetInterface Superclass2; - protected: - /** - */ - class _3DInteractorStyle - : public vtkInteractorStyleTrackballCamera - { - public: - vtkTypeMacro( - _3DInteractorStyle, vtkInteractorStyleTrackballCamera - ); - - public: - static _3DInteractorStyle* New( ); - - virtual void OnChar( ) { } - virtual void OnKeyDown( ) { } - virtual void OnKeyUp( ) { } - virtual void OnKeyRelease( ) { } - virtual void OnKeyPress( ); - }; + typedef vtkSmartPointer< vtkPropCollection > TProp; + typedef std::set< TProp > TProps; + + // typedef cpExtensions::Visualization::MeshActor TMeshActor; public: - explicit SimpleMPRWidget( QWidget* parent = 0 ); + explicit SimpleMPRWidget( QWidget* parent = NULL, Qt::WindowFlags f = 0 ); virtual ~SimpleMPRWidget( ); - // Data management - void Clear( ); - void SetMainImage( vtkImageData* image, const std::string& name ); - void SetMainActor( vtkImageActor* actor, const std::string& name ); - void AddImage( vtkImageData* image, const std::string& name ); - void AddImageActor( vtkImageActor* actor, const std::string& name ); - void AddMesh( vtkPolyData* mesh, const std::string& name ); - void AddMeshActor( vtkProp3D* actor, const std::string& name ); - void AddActor( vtkProp* actor, const std::string& name ); - const TActors& GetActors( const std::string& name ) const; - - void SetWindowLevel( double win, double lev ); - void ResetWindowLevel( ); - - // Visual objects - vtkRenderWindowInteractor* GetInteractor( unsigned int i ); - vtkRenderer* GetRenderer( unsigned int i ); - vtkRenderWindow* GetRenderWindow( unsigned int i ); - - protected: - void _AssociateSlices( ); + void Configure( char q1, char q2, char q3, char q4 ); + + bool HasImage( ) const; + void SetImage( vtkImageData* image, const std::string& name ); + + bool Add( vtkDataSet* data, const std::string& name ); + + TProps GetViewProps( const std::string& name ) const; + TProps GetImageProps( ) const; + + vtkRenderWindowInteractor* GetXInteractor( ); + const vtkRenderWindowInteractor* GetXInteractor( ) const; + vtkRenderWindowInteractor* GetYInteractor( ); + const vtkRenderWindowInteractor* GetYInteractor( ) const; + vtkRenderWindowInteractor* GetZInteractor( ); + const vtkRenderWindowInteractor* GetZInteractor( ) const; + vtkRenderWindowInteractor* GetWInteractor( ); + const vtkRenderWindowInteractor* GetWInteractor( ) const; + + vtkRenderWindow* GetXRenderWindow( ); + const vtkRenderWindow* GetXRenderWindow( ) const; + vtkRenderWindow* GetYRenderWindow( ); + const vtkRenderWindow* GetYRenderWindow( ) const; + vtkRenderWindow* GetZRenderWindow( ); + const vtkRenderWindow* GetZRenderWindow( ) const; + vtkRenderWindow* GetWRenderWindow( ); + const vtkRenderWindow* GetWRenderWindow( ) 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 ); @@ -104,13 +118,14 @@ namespace cpExtensions protected: Ui::SimpleMPRWidget* m_UI; - QVTKWidget2* m_VTK[ 4 ]; - vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ]; - vtkSmartPointer< TSliceActors > m_2DSlices[ 3 ]; - vtkSmartPointer< TSliceActors > m_3DSlices[ 3 ]; + ImageWidget* m_XImage; + ImageWidget* m_YImage; + ImageWidget* m_ZImage; + MPR3DWidget* m_3DView; - TNamedActors m_NamedActors; + std::string m_MainImageName; + vtkSmartPointer< vtkImageData > m_MainImage; }; } // ecapseman @@ -119,6 +134,6 @@ namespace cpExtensions #endif // cpExtensions_QT4 -#endif // __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ +#endif // __cpExtensions__QT__SimpleMPRWidget__h__ // eof - $RCSfile$