1 #ifndef __creaImageIOWxGimmickView_h_INCLUDED__
2 #define __creaImageIOWxGimmickView_h_INCLUDED__
6 #include <creaImageIOGimmickView.h>
9 #include <wx/splitter.h>
10 #include <wx/toolbar.h>
11 #include <wx/tbarbase.h>
12 #include <wx/notebook.h>
19 //=====================================================================
21 //=====================================================================
22 /// Concrete derivative of GimmickView which implements a wxWidgets-based view
23 class WxGimmickView : public wxPanel, virtual public GimmickView
26 typedef int EventType;
29 WxGimmickView(Gimmick*,
32 const wxPoint& pos, const wxSize& size,
33 int image_type = GIMMICK_3D_IMAGE_SELECTION,
34 int number_of_threads = 0);
35 /// Virtual destructor
36 virtual ~WxGimmickView();
39 /// Creates the tool bar
42 /// Create the tree view for TreeHandler provided
43 /// (overloaded from GimmickView)
44 void CreateTreeView( TreeHandler* );
47 /// The ToolBar and the tools
49 wxToolBarToolBase* mToolAddFile;
50 wxToolBarToolBase* mToolAddDir;
51 wxToolBarToolBase* mToolRemove;
52 wxToolBarToolBase* mToolAddDatabase;
53 wxToolBarToolBase* mToolHelp;
55 wxSplitterWindow* mSplitter;
56 wxPanel* mBottomPanel;
57 wxNotebook* mNotebook;
61 void CreateIconList();
64 /// Callback for adding files
65 void OnAddFiles(wxCommandEvent& event);
66 /// Callback for adding dir
67 void OnAddDir(wxCommandEvent& event);
68 /// Display a message box with the last addition statistics
69 void DisplayAddSummary();
72 /// AddProgress Gimmick callback
73 void OnAddProgress( Gimmick::AddProgress& );
75 wxProgressDialog* mProgressDialog;
78 wxString mCurrentDirectory;
82 // EO class WxGimmickView
83 //=====================================================================
95 //====================================================================
97 //====================================================================
99 /// Returns the size of the current selection
100 virtual int GetSelectionSize() { return 0; }
101 /// Returns true if there is a valid selection
102 virtual bool IsSelectionValid(){ return false; }
103 /// Returns the vector of full filenames of selected images
104 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
105 /// Returns the vector of images corresponding to selection
106 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
107 /// Returns the vector of DicomNode corresponding to selection
108 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
109 /// Returns the DicomNode corresponding to the tree item
110 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
113 /// Type of list of DicomDatabase
114 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
115 /// Returns the list of DicomDatabase open
116 virtual DicomDatabaseListType& GetDicomDatabaseList()
118 /// Returns the list of DicomDatabase open (const)
119 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
123 ///Opens an existing database, or else, creates a local database.
124 virtual void OpenOrNewDatabase(bool open){ return; }
126 virtual void ShowHelp();
129 ///Gets the extension of the database
130 const std::string& GetDatabaseExtension() { return null; }
131 ///Sets the extension of the database
132 virtual void SetDatabaseExtension(const std::string& ext){ return; }
135 //====================================================================
136 // Preview Display Related
137 //====================================================================
140 ///Shows the image sent as a parameter
142 virtual void ShowImage(vtkImageData* image){ return; }
144 //====================================================================
146 //====================================================================
150 ///Loads or creates a favorites database
151 virtual void LoadOrCreateFavoritesDatabase(){ return; }
153 ///Creates the user settings directory
154 void CreateUserSettingsDirectory(){ return; }
155 ///Obtains the user settings directory
156 const std::string& GetUserSettingsDirectory(){ return null; }
158 //====================================================================
159 // Attribute Display Related
160 //====================================================================
163 ///Shows the Information regarding the node sent as a parameter
165 virtual void ShowInformation(DicomNode*){ return; }
167 //====================================================================
168 // Tree Display Related
169 //====================================================================
172 /// Completely rebuilds the view with
173 /// current DicomDatabaseList
174 virtual void RebuildView(){ return; }
175 /// Recursively updates the part of the view corresponding
176 /// to the DicomDatabase passed
177 /// i.e. creates items for the DicomNode which do not have
178 /// deletes obsolete items (whose DicomNode has been deleted)
179 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
180 /// Recursively updates the part of the view corresponding
181 /// to the DicomNode provided.
182 /// parent is its parent in the tree (where to insert / remove it)
183 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
186 ///Type definition of the data regarding the tree
187 typedef WxGimmickTreeItemData TreeItemData;
188 ///Gets the item data of the tree item passed as a parameter
189 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
190 ///Type definition of the data insid a node of the tree
191 typedef WxGimmickDicomNodeData NodeData;
194 //====================================================================
196 //====================================================================
200 int mSelectionMaxImageDimension;
201 int mCurrentSelectionImageSize[4];
203 ///Existent Database List
204 DicomDatabaseListType mDicomDatabaseList;
205 ///Favorites database
206 DicomDatabase* mFavoriteDatabase;
208 ///Path to the database list file
209 std::string mDatabaseListFile;
210 ///Extension of the database
211 std::string mDatabaseExtension;
215 int mFirstDicomDatabaseIconIndex;
218 vtkImageViewer2* mViewer;
220 int mx1,mx2,my1,my2,mz1,mz2;
221 double mspx,mspy,mspz;
224 // Multi-thread image reader
225 MultiThreadImageReader mReader;
226 // map of images name to node
227 std::map<std::string,DicomNode*> mImageFileNameToNode;
230 } // EO namespace creaImageIO
232 #endif // USE_WIDGETS