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;
87 //The selection's maximum dimension
88 int mSelectionMaxDimension;
89 //The selection's minimum dimension
90 int mSelectionMinDimension;
93 wxString mCurrentDirectory;
97 // EO class WxGimmickView
98 //=====================================================================
110 //====================================================================
112 //====================================================================
114 /// Returns the size of the current selection
115 virtual int GetSelectionSize() { return 0; }
116 /// Returns true if there is a valid selection
117 virtual bool IsSelectionValid(){ return false; }
118 /// Returns the vector of full filenames of selected images
119 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
120 /// Returns the vector of images corresponding to selection
121 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
122 /// Returns the vector of DicomNode corresponding to selection
123 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
124 /// Returns the DicomNode corresponding to the tree item
125 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
128 /// Type of list of DicomDatabase
129 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
130 /// Returns the list of DicomDatabase open
131 virtual DicomDatabaseListType& GetDicomDatabaseList()
133 /// Returns the list of DicomDatabase open (const)
134 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
138 ///Opens an existing database, or else, creates a local database.
139 virtual void OpenOrNewDatabase(bool open){ return; }
141 virtual void ShowHelp();
144 ///Gets the extension of the database
145 const std::string& GetDatabaseExtension() { return null; }
146 ///Sets the extension of the database
147 virtual void SetDatabaseExtension(const std::string& ext){ return; }
150 //====================================================================
151 // Preview Display Related
152 //====================================================================
155 ///Shows the image sent as a parameter
157 virtual void ShowImage(vtkImageData* image){ return; }
159 //====================================================================
161 //====================================================================
165 ///Loads or creates a favorites database
166 virtual void LoadOrCreateFavoritesDatabase(){ return; }
168 ///Creates the user settings directory
169 void CreateUserSettingsDirectory(){ return; }
170 ///Obtains the user settings directory
171 const std::string& GetUserSettingsDirectory(){ return null; }
173 //====================================================================
174 // Attribute Display Related
175 //====================================================================
178 ///Shows the Information regarding the node sent as a parameter
180 virtual void ShowInformation(DicomNode*){ return; }
182 //====================================================================
183 // Tree Display Related
184 //====================================================================
187 /// Completely rebuilds the view with
188 /// current DicomDatabaseList
189 virtual void RebuildView(){ return; }
190 /// Recursively updates the part of the view corresponding
191 /// to the DicomDatabase passed
192 /// i.e. creates items for the DicomNode which do not have
193 /// deletes obsolete items (whose DicomNode has been deleted)
194 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
195 /// Recursively updates the part of the view corresponding
196 /// to the DicomNode provided.
197 /// parent is its parent in the tree (where to insert / remove it)
198 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
201 ///Type definition of the data regarding the tree
202 typedef WxGimmickTreeItemData TreeItemData;
203 ///Gets the item data of the tree item passed as a parameter
204 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
205 ///Type definition of the data insid a node of the tree
206 typedef WxGimmickDicomNodeData NodeData;
209 //====================================================================
211 //====================================================================
215 int mSelectionMaxImageDimension;
216 int mCurrentSelectionImageSize[4];
218 ///Existent Database List
219 DicomDatabaseListType mDicomDatabaseList;
220 ///Favorites database
221 DicomDatabase* mFavoriteDatabase;
223 ///Path to the database list file
224 std::string mDatabaseListFile;
225 ///Extension of the database
226 std::string mDatabaseExtension;
230 int mFirstDicomDatabaseIconIndex;
233 vtkImageViewer2* mViewer;
235 int mx1,mx2,my1,my2,mz1,mz2;
236 double mspx,mspy,mspz;
239 // Multi-thread image reader
240 MultiThreadImageReader mReader;
241 // map of images name to node
242 std::map<std::string,DicomNode*> mImageFileNameToNode;
245 } // EO namespace creaImageIO
247 #endif // USE_WIDGETS