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 files
43 ///(overloaded from GimmickView)
44 void GetSelectedFiles(std::vector<std::string>& s);
45 /// Returns the selected Images so that they comply with the given parameter(4D)
46 //(overloaded from GimmickView)
47 void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
48 /// Validates the selected images
49 bool ValidateSelection(void *);
52 /// Creates the tool bar
55 /// Create the tree view for TreeHandler provided
56 /// (overloaded from GimmickView)
57 void CreateTreeView( TreeHandler* );
61 /// The ToolBar and the tools
63 wxToolBarToolBase* mToolAddFile;
64 wxToolBarToolBase* mToolAddDir;
65 wxToolBarToolBase* mToolRemove;
66 wxToolBarToolBase* mToolAddDatabase;
67 wxToolBarToolBase* mToolHelp;
69 wxSplitterWindow* mSplitter;
70 wxPanel* mBottomPanel;
72 wxNotebook* mNotebook;
76 void CreateIconList();
79 /// Callback for adding files
80 void OnAddFiles(wxCommandEvent& event);
81 /// Callback for adding dir
82 void OnAddDir(wxCommandEvent& event);
83 /// Callback for removing files
84 void OnRemove(wxCommandEvent& event);
86 /// Display a message box with the last addition statistics
87 void DisplayAddSummary();
90 /// AddProgress Gimmick callback
91 void OnAddProgress( Gimmick::AddProgress& );
94 wxProgressDialog* mProgressDialog;
95 ///The selection's maximum dimension
96 int mSelectionMaxDimension;
97 ///The selection's minimum dimension
98 int mSelectionMinDimension;
101 wxString mCurrentDirectory;
103 DECLARE_EVENT_TABLE()
105 // EO class WxGimmickView
106 //=====================================================================
118 //====================================================================
120 //====================================================================
122 /// Returns the size of the current selection
123 virtual int GetSelectionSize() { return 0; }
124 /// Returns true if there is a valid selection
125 virtual bool IsSelectionValid(){ return false; }
126 /// Returns the vector of full filenames of selected images
127 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
128 /// Returns the vector of images corresponding to selection
129 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
130 /// Returns the vector of DicomNode corresponding to selection
131 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
132 /// Returns the DicomNode corresponding to the tree item
133 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
136 /// Type of list of DicomDatabase
137 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
138 /// Returns the list of DicomDatabase open
139 virtual DicomDatabaseListType& GetDicomDatabaseList()
141 /// Returns the list of DicomDatabase open (const)
142 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
146 ///Opens an existing database, or else, creates a local database.
147 virtual void OpenOrNewDatabase(bool open){ return; }
149 virtual void ShowHelp();
152 ///Gets the extension of the database
153 const std::string& GetDatabaseExtension() { return null; }
154 ///Sets the extension of the database
155 virtual void SetDatabaseExtension(const std::string& ext){ return; }
158 //====================================================================
159 // Preview Display Related
160 //====================================================================
163 ///Shows the image sent as a parameter
165 virtual void ShowImage(vtkImageData* image){ return; }
167 //====================================================================
169 //====================================================================
173 ///Loads or creates a favorites database
174 virtual void LoadOrCreateFavoritesDatabase(){ return; }
176 ///Creates the user settings directory
177 void CreateUserSettingsDirectory(){ return; }
178 ///Obtains the user settings directory
179 const std::string& GetUserSettingsDirectory(){ return null; }
181 //====================================================================
182 // Attribute Display Related
183 //====================================================================
186 ///Shows the Information regarding the node sent as a parameter
188 virtual void ShowInformation(DicomNode*){ return; }
190 //====================================================================
191 // Tree Display Related
192 //====================================================================
195 /// Completely rebuilds the view with
196 /// current DicomDatabaseList
197 virtual void RebuildView(){ return; }
198 /// Recursively updates the part of the view corresponding
199 /// to the DicomDatabase passed
200 /// i.e. creates items for the DicomNode which do not have
201 /// deletes obsolete items (whose DicomNode has been deleted)
202 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
203 /// Recursively updates the part of the view corresponding
204 /// to the DicomNode provided.
205 /// parent is its parent in the tree (where to insert / remove it)
206 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
209 ///Type definition of the data regarding the tree
210 typedef WxGimmickTreeItemData TreeItemData;
211 ///Gets the item data of the tree item passed as a parameter
212 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
213 ///Type definition of the data insid a node of the tree
214 typedef WxGimmickDicomNodeData NodeData;
217 //====================================================================
219 //====================================================================
223 int mSelectionMaxImageDimension;
224 int mCurrentSelectionImageSize[4];
226 ///Existent Database List
227 DicomDatabaseListType mDicomDatabaseList;
228 ///Favorites database
229 DicomDatabase* mFavoriteDatabase;
231 ///Path to the database list file
232 std::string mDatabaseListFile;
233 ///Extension of the database
234 std::string mDatabaseExtension;
238 int mFirstDicomDatabaseIconIndex;
241 vtkImageViewer2* mViewer;
243 int mx1,mx2,my1,my2,mz1,mz2;
244 double mspx,mspy,mspz;
247 // Multi-thread image reader
248 MultiThreadImageReader mReader;
249 // map of images name to node
250 std::map<std::string,DicomNode*> mImageFileNameToNode;
253 } // EO namespace creaImageIO
255 #endif // USE_WIDGETS