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 min_dim = GIMMICK_2D_IMAGE_SELECTION,
34 int max_dim = GIMMICK_3D_IMAGE_SELECTION,
35 int number_of_threads = 0);
36 /// Virtual destructor
37 virtual ~WxGimmickView();
39 /// Returns the selected Images so that they comply with the given parameter(<4D)
40 ///(overloaded from GimmickView)
41 vtkImageData* GetSelectedImage(int dim);
42 /// Returns the selected Images so that they comply with the given parameter(4D)
43 //(overloaded from GimmickView)
44 void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
47 /// Creates the tool bar
50 /// Create the tree view for TreeHandler provided
51 /// (overloaded from GimmickView)
52 void CreateTreeView( TreeHandler* );
56 /// The ToolBar and the tools
58 wxToolBarToolBase* mToolAddFile;
59 wxToolBarToolBase* mToolAddDir;
60 wxToolBarToolBase* mToolRemove;
61 wxToolBarToolBase* mToolAddDatabase;
62 wxToolBarToolBase* mToolHelp;
64 wxSplitterWindow* mSplitter;
65 wxPanel* mBottomPanel;
66 wxNotebook* mNotebook;
70 void CreateIconList();
73 /// Callback for adding files
74 void OnAddFiles(wxCommandEvent& event);
75 /// Callback for adding dir
76 void OnAddDir(wxCommandEvent& event);
77 /// Callback for removing files
78 void OnRemove(wxCommandEvent& event);
79 /// Display a message box with the last addition statistics
80 void DisplayAddSummary();
83 /// AddProgress Gimmick callback
84 void OnAddProgress( Gimmick::AddProgress& );
86 wxProgressDialog* mProgressDialog;
89 wxString mCurrentDirectory;
93 // EO class WxGimmickView
94 //=====================================================================
106 //====================================================================
108 //====================================================================
110 /// Returns the size of the current selection
111 virtual int GetSelectionSize() { return 0; }
112 /// Returns true if there is a valid selection
113 virtual bool IsSelectionValid(){ return false; }
114 /// Returns the vector of full filenames of selected images
115 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
116 /// Returns the vector of images corresponding to selection
117 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
118 /// Returns the vector of DicomNode corresponding to selection
119 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
120 /// Returns the DicomNode corresponding to the tree item
121 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
124 /// Type of list of DicomDatabase
125 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
126 /// Returns the list of DicomDatabase open
127 virtual DicomDatabaseListType& GetDicomDatabaseList()
129 /// Returns the list of DicomDatabase open (const)
130 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
134 ///Opens an existing database, or else, creates a local database.
135 virtual void OpenOrNewDatabase(bool open){ return; }
137 virtual void ShowHelp();
140 ///Gets the extension of the database
141 const std::string& GetDatabaseExtension() { return null; }
142 ///Sets the extension of the database
143 virtual void SetDatabaseExtension(const std::string& ext){ return; }
146 //====================================================================
147 // Preview Display Related
148 //====================================================================
151 ///Shows the image sent as a parameter
153 virtual void ShowImage(vtkImageData* image){ return; }
155 //====================================================================
157 //====================================================================
161 ///Loads or creates a favorites database
162 virtual void LoadOrCreateFavoritesDatabase(){ return; }
164 ///Creates the user settings directory
165 void CreateUserSettingsDirectory(){ return; }
166 ///Obtains the user settings directory
167 const std::string& GetUserSettingsDirectory(){ return null; }
169 //====================================================================
170 // Attribute Display Related
171 //====================================================================
174 ///Shows the Information regarding the node sent as a parameter
176 virtual void ShowInformation(DicomNode*){ return; }
178 //====================================================================
179 // Tree Display Related
180 //====================================================================
183 /// Completely rebuilds the view with
184 /// current DicomDatabaseList
185 virtual void RebuildView(){ return; }
186 /// Recursively updates the part of the view corresponding
187 /// to the DicomDatabase passed
188 /// i.e. creates items for the DicomNode which do not have
189 /// deletes obsolete items (whose DicomNode has been deleted)
190 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
191 /// Recursively updates the part of the view corresponding
192 /// to the DicomNode provided.
193 /// parent is its parent in the tree (where to insert / remove it)
194 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
197 ///Type definition of the data regarding the tree
198 typedef WxGimmickTreeItemData TreeItemData;
199 ///Gets the item data of the tree item passed as a parameter
200 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
201 ///Type definition of the data insid a node of the tree
202 typedef WxGimmickDicomNodeData NodeData;
205 //====================================================================
207 //====================================================================
211 int mSelectionMaxImageDimension;
212 int mCurrentSelectionImageSize[4];
214 ///Existent Database List
215 DicomDatabaseListType mDicomDatabaseList;
216 ///Favorites database
217 DicomDatabase* mFavoriteDatabase;
219 ///Path to the database list file
220 std::string mDatabaseListFile;
221 ///Extension of the database
222 std::string mDatabaseExtension;
226 int mFirstDicomDatabaseIconIndex;
229 vtkImageViewer2* mViewer;
231 int mx1,mx2,my1,my2,mz1,mz2;
232 double mspx,mspy,mspz;
235 // Multi-thread image reader
236 MultiThreadImageReader mReader;
237 // map of images name to node
238 std::map<std::string,DicomNode*> mImageFileNameToNode;
241 } // EO namespace creaImageIO
243 #endif // USE_WIDGETS