]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/QT/ImageWidget.h
18073d6aa6327bdf26bcc84ff87987bb9758f42d
[cpPlugins.git] / lib / cpExtensions / QT / ImageWidget.h
1 #ifndef __cpExtensions__QT__ImageWidget__h__
2 #define __cpExtensions__QT__ImageWidget__h__
3
4 #include <cpExtensions/QT/RendererWidget.h>
5
6 // -------------------------------------------------------------------------
7 class vtkDataSet;
8
9 // -------------------------------------------------------------------------
10 namespace cpExtensions
11 {
12   namespace Visualization
13   {
14     class OutlineSource;
15     class LUTImageActor;
16     class WindowLevelImageActor;
17     class MeshActor;
18   }
19   namespace Interaction { class ImageSliceStyle; }
20
21   namespace QT
22   {
23     /**
24      */
25     class cpExtensions_EXPORT ImageWidget
26       : public RendererWidget
27     {
28       Q_OBJECT;
29
30     public:
31       typedef ImageWidget    Self;
32       typedef RendererWidget Superclass;
33
34       typedef cpExtensions::Visualization::OutlineSource         TOutline;
35       typedef cpExtensions::Visualization::MeshActor             TActor;
36       typedef cpExtensions::Visualization::LUTImageActor         TLUTActor;
37       typedef cpExtensions::Visualization::WindowLevelImageActor TWLActor;
38       typedef cpExtensions::Interaction::ImageSliceStyle         TStyle;
39
40     public:
41       explicit ImageWidget( QWidget* parent = NULL, Qt::WindowFlags f = 0 );
42       virtual ~ImageWidget( );
43
44       void Clear( );
45       void SetImage(
46         vtkImageData* image, const std::string& name, int orientation = 2
47         );
48       void Add( vtkDataSet* data, const std::string& name );
49       virtual void ResetCamera( ) cpExtensions_OVERRIDE;
50
51       TWLActor* GetImageActor( );
52       const TWLActor* GetImageActor( ) const;
53
54       void SetColor( const std::string& name, double r, double g, double b ) override;
55       void SetLineWidth( const std::string& name, double w ) override;
56
57     protected:
58       std::string m_ImageName;
59
60       vtkSmartPointer< TWLActor > m_WLActor;
61       vtkSmartPointer< TLUTActor > m_LUTActor;
62       vtkSmartPointer< TOutline > m_Outline;
63       TActor* m_OutlineActor;
64       std::vector< TActor* > m_Actors;
65
66       vtkSmartPointer< TStyle > m_Style;
67     };
68
69   } // ecapseman
70
71 } // ecapseman
72
73 #endif // __cpExtensions__QT__ImageWidget__h__
74
75 // eof - $RCSfile$