#include <wx/splitter.h>
#include <creaImageIOSystem.h>
+#include <creaImageIOImagePointerHolder.h>
// For image preview
// vtk and wxvtk classes
namespace creaImageIO
{
- class ThreadedMovie;
+ class WxViewerPlayer;
- class WxViewer : public wxFrame
+ class WxViewer : public wxPanel
{
-
- public:
- friend class ThreadedMovie;
- /// Ctor
+
+ public:
+ /// Ctors
WxViewer();
WxViewer(wxWindow *parent,
const wxWindowID id,
const wxSize& size);
/// Dtor
virtual ~WxViewer();
- ///Shows the image in the vector as a movie
- void ShowImages();
- ///Shows the image passed as parameter
- void ShowImage(vtkImageData* im);
- ///Adds an image to the selection
- void AddImage(vtkImageData* im);
- ///Clears the selection of images
- void ClearImages();
- ///Returns true if the image vector is empty
- bool ImagesEmpty();
+ /// Shows the next image in the image vector
+ void ShowNextImage();
+ ///Starts the image player
+ void StartPlayer();
+ ///Stops the image player
+ void StopPlayer();
+ ///Refreshes the interface if the current image shown has changed
+ bool RefreshIfNecessary();
+ ///Sets a new image vector to be read
+ void SetImageVector(std::vector<ImagePointerHolder*>& pointers);
+
private:
- /// Previewer
+ ///Shows the image passed as parameter
+ void ShowImage(vtkImageData* im);
+ /// Previewer
vtkImageViewer2* mViewer;
/// Associated wxvtk interactor
- crea::creawxVTKRenderWindowInteractor *mInteractor;
-
+ crea::creawxVTKRenderWindowInteractor *mInteractor;
+ /// Current extent
int mx1,mx2,my1,my2,mz1,mz2;
+ /// Current spacing
double mspx,mspy,mspz;
-
- /// The vector of images to show
- std::vector<vtkImageData*> images;
- ///The threaded movie
- ThreadedMovie* mMovie;
+ /// Current image shown
+ int mCurrent;
+ ///The threaded movie player
+ WxViewerPlayer* mPlayer;
+ /// The mutex
+ wxMutex mMutex;
+ /// Boolean that declares if the player needs to be refreshed
+ bool mNeedRefresh;
+ ///Last image shown
+ vtkImageData* mLastImageShown;
+ ///The vectors of images to be shown
+ std::vector<ImagePointerHolder*> imagePointers;
};