]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOWxGimmick.h
*** empty log message ***
[creaImageIO.git] / src / creaImageIOWxGimmick.h
index 062d8de3116d0de65f1a68653a4a76089dc518c2..aceaa5e5cb4b4e13fef081119c8a7676e9ad8d6e 100644 (file)
@@ -19,7 +19,7 @@
 
 // For image preview 
 // vtk and wxvtk classes
-#include "wxVTKRenderWindowInteractor.h"
+#include "creawxVTKRenderWindowInteractor.h"
 #include "vtkImageViewer2.h"
 // multi-thread image reader
 #include <creaImageIOMultiThreadImageReader.h>
@@ -35,48 +35,58 @@ namespace creaImageIO
   class WxGimmickDicomNodeData;
   //====================================================================
 
+#define GIMMICK_NO_IMAGE_SELECTION 0
+#define GIMMICK_2D_IMAGE_SELECTION 2
+#define GIMMICK_3D_IMAGE_SELECTION 3
+#define GIMMICK_4D_IMAGE_SELECTION 4
+
   //====================================================================
   class CREAIMAGEIO_EXPORT WxGimmick : public wxPanel,
-                                 public MultiThreadImageReaderUser
+                                      public MultiThreadImageReaderUser
   {
   public:
+
     WxGimmick(wxWindow *parent, const wxWindowID id,
-                           const wxPoint& pos, const wxSize& size,
-                           int number_of_threads = 0);
+             const wxPoint& pos, const wxSize& size,
+             int image_type = GIMMICK_3D_IMAGE_SELECTION,
+             int number_of_threads = 0);
 
     virtual ~WxGimmick();
 
+    int GetSelectionSize() { return mTreeListCtrl->GetSelectionSize(); } 
+    bool IsSelectionValid();
+    void GetSelectedFiles(std::vector<std::string>&);
+    void GetSelectedImages(std::vector<vtkImageData*>&);
+    void GetSelectedDicomNodes(std::vector<DicomNode*>&);
+    void GetSelectedItems(std::vector<wxTreeItemId>&);
+    DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i);
+
+    static const int UserMenuFirstId;
+
+    typedef WxGimmickSettings Settings;
+    const Settings& GetSettings() const { return mSettings; }
+    Settings& GetSettings() { return mSettings; }
+
+    typedef WxGimmickEvent EventType;
+
     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
 
-    DicomDatabaseListType& GetDicomDatabaseList() { return mDicomDatabaseList; }
-    const DicomDatabaseListType& GetDicomDatabaseList() const { return mDicomDatabaseList; }
+    DicomDatabaseListType& GetDicomDatabaseList() 
+    { return mDicomDatabaseList; }
+    const DicomDatabaseListType& GetDicomDatabaseList() const 
+    { return mDicomDatabaseList; }
     
     wxTreeListCtrl* GetTreeListCtrl() { return mTreeListCtrl; }
     const wxTreeListCtrl* GetTreeListCtrl() const { return mTreeListCtrl; }
 
     void SetConfigurationFile(const std::string& filename) 
-    {
-      mConfigurationFile = filename;
-    }
+    { mConfigurationFile = filename;}
     void LoadConfiguration();
     void SaveConfiguration();
     void SetSaveConfigurationOnClose(bool v) 
     { mSaveConfigurationOnClose = v; }
 
 
-    void GetSelectedImages(std::vector<std::string>&);
-    void GetSelectedDicomNodes(std::vector<DicomNode*>&);
-    void GetSelectedItems(std::vector<wxTreeItemId>&);
-    DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i);
-
-
-    static const int UserMenuFirstId;
-
-    typedef WxGimmickSettings Settings;
-    const Settings& GetSettings() const { return mSettings; }
-    Settings& GetSettings() { return mSettings; }
-
-    typedef WxGimmickEvent EventType;
 
   protected:
     void RebuildView();
@@ -92,13 +102,20 @@ namespace creaImageIO
     void InsertDicomDatabase(wxTreeItemId& id, DicomDatabase* r);
     void DeleteDicomDatabase(wxTreeItemId& id, DicomDatabase* r);
 
+    void LoadChildren( wxTreeItemId& id );
     friend class WxGimmickEvent;
 
+    void ShowHelp();
+
   private:
 
     WxGimmick() { }
     WxGimmick(const WxGimmick& ) { }
 
+    int mSelectionType;
+    int mSelectionMaxImageDimension;
+    int mCurrentSelectionImageSize[4];
+
     DicomDatabaseListType mDicomDatabaseList;
 
     wxTreeListCtrl* mTreeListCtrl;
@@ -117,8 +134,16 @@ namespace creaImageIO
     const std::string& GetDatabaseExtension() { return mDatabaseExtension; }
     void SetDatabaseExtension(const std::string& ext) 
     { mDatabaseExtension = ext; }
+
+
+    /// Settings
     Settings mSettings;
 
+
+    // Help 
+    WxGimmickHelpWindow* mHelpWindow;
+    bool mJustStarted;
+
     int  mFirstDicomDatabaseIconIndex;
     // Id of the item which activated the popup menu 
     wxTreeItemId mItemOfMenu;
@@ -138,7 +163,7 @@ namespace creaImageIO
    // Previewer
     vtkImageViewer2* mViewer;
     // Associated wxvtk interactor
-    crea::wxVTKRenderWindowInteractor  *mInteractor;
+       crea::creawxVTKRenderWindowInteractor  *mInteractor;
   
     int mx1,mx2,my1,my2,mz1,mz2;
     double mspx,mspy,mspz;
@@ -197,6 +222,7 @@ namespace creaImageIO
     void OnItemCollapsing(wxTreeEvent& event);
     void OnSelChanged(wxTreeEvent& event);
     void OnSelChanging(wxTreeEvent& event);
+    bool IsImageSelectable(DicomNode* node);
     void OnTreeKeyDown(wxTreeEvent& event);
     void OnItemActivated(wxTreeEvent& event);
     void OnItemRightClick(wxTreeEvent& event);