creaImageIOWxGimmickView.h

Go to the documentation of this file.
00001 #ifndef __creaImageIOWxGimmickView_h_INCLUDED__
00002 #define __creaImageIOWxGimmickView_h_INCLUDED__
00003 
00004 #ifdef USE_WXWIDGETS
00005 
00006 #include <creaImageIOGimmickView.h>
00007 #include <creaImageIOWxViewer.h>
00008 #include <creaImageIOWxGimmickTools.h>
00009 #include <creaImageIOListener.h>
00010 #include <creaWx.h>
00011 #include "wx/wx.h"
00012 #include <wx/splitter.h>
00013 #include <wx/toolbar.h> 
00014 #include <wx/tbarbase.h> 
00015 #include <wx/notebook.h>
00016 
00017 namespace creaImageIO
00018 {
00022   //=====================================================================
00023   
00024   //=====================================================================
00026 
00027   class WxGimmickView : public wxPanel, virtual public GimmickView
00028   {
00029   public:
00030     
00031     typedef int EventType;
00032     
00034     WxGimmickView(Gimmick*, 
00035                   wxWindow *parent, 
00036                   const wxWindowID id,
00037                   const wxPoint& pos, const wxSize& size,
00038                   int min_dim = GIMMICK_2D_IMAGE_SELECTION,
00039                   int max_dim = GIMMICK_3D_IMAGE_SELECTION,
00040                   int number_of_threads = 0);
00042     virtual ~WxGimmickView();
00043     
00046     void GetSelectedFiles(std::vector<std::string>& s);
00047     
00050     void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
00051 
00054     //(overloaded from GimmickView) 
00055     void GetImages(int dim, const std::vector<std::string>& files, 
00056                    std::vector<vtkImageData*>& s);
00057     
00059     //(overloaded from GimmickView)
00060     void OnSelectionChange(const std::vector<tree::Node*>& s, 
00061                            bool isSelection, int selection, bool mProcess);
00063     void StopPlayer(){mViewer->StopPlayer();}
00065     void AddIgnoreFile(tree::Node* toRemove);
00067     void ClearSelection();
00069         void CopyFiles(const std::vector<std::string>& filenames);
00071         void AddDir(std::string dirName);
00072     
00073     
00075     void ReadImageThreaded(const std::vector<tree::Node*>& sel);
00076 
00078         void OnSaveSettingsCallback(const std::string& copyPath,
00079           const std::string& dbPath,
00080           const std::string& syncEvent,
00081           const std::string& syncFreq);
00082         
00084         void OnListenerCallback(const std::string& drive, bool addFiles, bool removeFiles);
00085 
00087         void OnDriveMount(bool mount);
00088 
00090         void StartListeningThread();
00091 
00093         void StopListeningThread();
00094 
00096         void OnFieldsEdited(tree::Node* node, const std::string& name, const std::string& key, const std::string& val);
00097 
00099         void GetVisibleAttributes(std::vector<std::string>& shown,std::vector<std::string>& nShown, int level);
00100 
00102         void OnAttributesChanged(const std::vector<std::string>& nShown, int level);
00103     
00104   protected:
00106     void CreateToolBar(); 
00107     
00110     void CreateTreeView( TreeHandler* );
00111     
00112     
00113   private:
00117     bool mConstructed;
00119     wxToolBar*         mToolBar;
00120     wxToolBarToolBase* mToolAddFile;
00121     wxToolBarToolBase* mToolAddDir;
00122     wxToolBarToolBase* mToolRemove;
00123     wxToolBarToolBase* mToolAddDatabase;
00124     wxToolBarToolBase* mToolHelp;
00125         wxToolBarToolBase* mToolSynchronize;
00126         wxToolBarToolBase* mToolSettings;
00127         wxToolBarToolBase* mToolTools;
00128     
00129     wxSplitterWindow* mSplitter;
00130     wxPanel*          mBottomPanel;
00131     wxStaticText *    mText;
00132     wxNotebook*       mNotebook;
00133     
00135     wxImageList *    mIcon;
00136     void CreateIconList();
00137     
00138     Gimmick * mGimmick;
00139         
00140         Listener* mListener;
00142     void OnAddFiles(wxCommandEvent& event);
00144     void OnAddDir(wxCommandEvent& event);
00146     void OnRemove(wxCommandEvent& event);
00148     void OnSynchronize(wxCommandEvent& event);
00150     void OnSettings(wxCommandEvent& event);
00152     void OnTools(wxCommandEvent& event);
00154         void CreateSettingsDialog(wxNotebook* nb, wxDialog* dial);
00155     
00157     void DisplayAddSummary();
00158 
00160         bool isNeedRecursive(std::string i_name);
00161     
00163     void OnAddProgress( Gimmick::AddProgress& );
00165     void OnInternalIdle();
00166 
00168         void OnAddDB(wxCommandEvent& event);
00169     
00171         void OnCreateDB(wxCommandEvent& event);
00172 
00174         void CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys);
00175  
00177     wxProgressDialog* mProgressDialog;
00179     int mSelectionMaxDimension;
00181     int mSelectionMinDimension;
00183     WxViewer* mViewer;
00185     tree::Node* mCurImageItemToShow;
00186     //Pointer holders for images to be shown
00187     std::vector<ImagePointerHolder*> pointers;
00188     
00189     
00190     wxString mCurrentDirectory;
00191     
00192     DECLARE_EVENT_TABLE()
00193       };
00194   // EO class WxGimmickView
00195   //=====================================================================
00196   
00197   
00198   /*
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207         //====================================================================
00208         // General
00209         //====================================================================
00210 
00212     virtual int GetSelectionSize() { return 0; } 
00214     virtual bool IsSelectionValid(){ return false; }
00216     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
00218     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
00220     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
00222     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
00223 
00224         
00226     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
00228     virtual DicomDatabaseListType& GetDicomDatabaseList() 
00229     { return null; }
00231     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
00232     { return null; }
00233 
00234         protected:
00236     virtual void OpenOrNewDatabase(bool open){ return; }
00238         virtual void ShowHelp();
00239 
00240         private:
00242         const std::string& GetDatabaseExtension() { return null; }
00244     virtual void SetDatabaseExtension(const std::string& ext){ return; }
00245 
00246 
00247         //====================================================================
00248     // Preview Display Related
00249         //====================================================================
00250 
00251 
00253         private:
00254          virtual void ShowImage(vtkImageData* image){ return; }
00255 
00256         //====================================================================
00257     // Favorites Related
00258         //====================================================================
00259 
00260 
00261         public:
00263     virtual void LoadOrCreateFavoritesDatabase(){ return; }
00264         private:
00266     void CreateUserSettingsDirectory(){ return; }
00268         const std::string& GetUserSettingsDirectory(){ return null; }
00269 
00270         //====================================================================  
00271         // Attribute Display Related
00272         //====================================================================
00273 
00274 
00276         private:
00277      virtual void ShowInformation(DicomNode*){ return; }
00278    
00279         //====================================================================
00280     // Tree Display Related
00281     //====================================================================
00282 
00283         protected:
00286     virtual void RebuildView(){ return; }
00291     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
00295         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
00296     
00297         private:
00299     typedef WxGimmickTreeItemData TreeItemData;
00301     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
00303     typedef WxGimmickDicomNodeData NodeData;
00304 
00305 
00306         //====================================================================
00307     // Class Attributes
00308     //====================================================================
00309 
00310         
00311         int mSelectionType;
00312     int mSelectionMaxImageDimension;
00313     int mCurrentSelectionImageSize[4];
00314 
00316     DicomDatabaseListType mDicomDatabaseList;
00318     DicomDatabase* mFavoriteDatabase;
00319 
00321     std::string mDatabaseListFile;
00323     std::string mDatabaseExtension;
00324 
00325     bool mJustStarted;
00326 
00327     int  mFirstDicomDatabaseIconIndex;
00328 
00329    // Previewer
00330     vtkImageViewer2* mViewer;
00331     
00332     int mx1,mx2,my1,my2,mz1,mz2;
00333     double mspx,mspy,mspz;
00334   
00335     // Image preview :
00336     // Multi-thread image reader
00337     MultiThreadImageReader mReader;
00338     // map of images name to node
00339     std::map<std::string,DicomNode*> mImageFileNameToNode;
00340   */
00341  
00342 } // EO namespace creaImageIO
00343 
00344 #endif // USE_WIDGETS
00345 // EOF
00346 #endif  

Generated on Mon Jun 22 10:49:30 2009 for CreaImageIO by  doxygen 1.5.3