]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxViewer.h
BUG Threads MacOs
[creaImageIO.git] / src2 / creaImageIOWxViewer.h
1 #ifndef __creaImageIOWxViewer_h_INCLUDED__
2 #define __creaImageIOWxViewer_h_INCLUDED__
3
4 #ifdef USE_WXWIDGETS
5
6 // wx
7 #include <creaWx.h>
8 #include <wx/image.h>
9 #include <wx/imaglist.h>
10 #include <wx/splitter.h>
11
12 #include <creaImageIOSystem.h>
13
14 // For image preview 
15 // vtk and wxvtk classes
16 #include "creawxVTKRenderWindowInteractor.h"
17 #include "vtkImageViewer2.h"
18
19 namespace creaImageIO
20 {
21
22   class WxViewerPlayer;
23
24   class WxViewer : public wxPanel
25   {
26
27   public:
28     //    friend class ThreadedMovie;
29     /// Ctor 
30     WxViewer();
31     WxViewer(wxWindow *parent, 
32                    const wxWindowID id,
33                    wxString title,
34                    const wxPoint& pos, 
35                    const wxSize& size);
36     /// Dtor
37     virtual ~WxViewer();
38     ///Shows the image in the vector as a movie
39     //void ShowImages();
40     /// Sets the movie size
41     void SetMovieSize(unsigned int);
42     ///Sets the ith image of the movie
43     void SetImage(int i, vtkImageData* im);
44     ///Clears the selection of images
45     //  void ClearImages();
46     ///Returns true if the image vector is empty
47     bool ImagesEmpty();
48     /// 
49     void ShowNextImage();
50     
51     void OnInternalIdle();
52
53         void StartPlayer();
54
55     void StopPlayer();
56
57     bool RefreshIfNecessary();
58
59   private:
60    ///Shows the image passed as parameter
61     void ShowImage(vtkImageData* im);
62
63     /// Previewer
64     vtkImageViewer2* mViewer;
65     /// Associated wxvtk interactor
66     crea::creawxVTKRenderWindowInteractor  *mInteractor;
67     
68     /// Current extent 
69     int mx1,mx2,my1,my2,mz1,mz2;
70     /// Current spacing
71     double mspx,mspy,mspz;
72
73     /// The vector of images to show
74     std::vector<vtkImageData*> images;
75     /// 
76     int mCurrent;
77     ///The threaded movie player
78     WxViewerPlayer* mPlayer;
79
80     /// The mutex
81     wxMutex mMutex;
82
83     /// 
84     bool mNeedRefresh;
85     vtkImageData* mLastImageShown;
86
87   };
88
89 }
90
91 #endif // USE_WIDGETS
92 // EOF
93 #endif