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);
45 /// Sets the message state
46 void SetMessage(wxString& mess);
49 /// Creates the tool bar
52 /// Create the tree view for TreeHandler provided
53 /// (overloaded from GimmickView)
54 void CreateTreeView( TreeHandler* );
58 /// The ToolBar and the tools
60 wxToolBarToolBase* mToolAddFile;
61 wxToolBarToolBase* mToolAddDir;
62 wxToolBarToolBase* mToolRemove;
63 wxToolBarToolBase* mToolAddDatabase;
64 wxToolBarToolBase* mToolHelp;
66 wxSplitterWindow* mSplitter;
67 wxPanel* mBottomPanel;
69 wxNotebook* mNotebook;
73 void CreateIconList();
76 /// Callback for adding files
77 void OnAddFiles(wxCommandEvent& event);
78 /// Callback for adding dir
79 void OnAddDir(wxCommandEvent& event);
80 /// Callback for removing files
81 void OnRemove(wxCommandEvent& event);
82 /// Display a message box with the last addition statistics
83 void DisplayAddSummary();
86 /// AddProgress Gimmick callback
87 void OnAddProgress( Gimmick::AddProgress& );
90 wxProgressDialog* mProgressDialog;
91 //The selection's maximum dimension
92 int mSelectionMaxDimension;
93 //The selection's minimum dimension
94 int mSelectionMinDimension;
97 wxString mCurrentDirectory;
101 // EO class WxGimmickView
102 //=====================================================================
114 //====================================================================
116 //====================================================================
118 /// Returns the size of the current selection
119 virtual int GetSelectionSize() { return 0; }
120 /// Returns true if there is a valid selection
121 virtual bool IsSelectionValid(){ return false; }
122 /// Returns the vector of full filenames of selected images
123 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
124 /// Returns the vector of images corresponding to selection
125 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
126 /// Returns the vector of DicomNode corresponding to selection
127 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
128 /// Returns the DicomNode corresponding to the tree item
129 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
132 /// Type of list of DicomDatabase
133 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
134 /// Returns the list of DicomDatabase open
135 virtual DicomDatabaseListType& GetDicomDatabaseList()
137 /// Returns the list of DicomDatabase open (const)
138 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
142 ///Opens an existing database, or else, creates a local database.
143 virtual void OpenOrNewDatabase(bool open){ return; }
145 virtual void ShowHelp();
148 ///Gets the extension of the database
149 const std::string& GetDatabaseExtension() { return null; }
150 ///Sets the extension of the database
151 virtual void SetDatabaseExtension(const std::string& ext){ return; }
154 //====================================================================
155 // Preview Display Related
156 //====================================================================
159 ///Shows the image sent as a parameter
161 virtual void ShowImage(vtkImageData* image){ return; }
163 //====================================================================
165 //====================================================================
169 ///Loads or creates a favorites database
170 virtual void LoadOrCreateFavoritesDatabase(){ return; }
172 ///Creates the user settings directory
173 void CreateUserSettingsDirectory(){ return; }
174 ///Obtains the user settings directory
175 const std::string& GetUserSettingsDirectory(){ return null; }
177 //====================================================================
178 // Attribute Display Related
179 //====================================================================
182 ///Shows the Information regarding the node sent as a parameter
184 virtual void ShowInformation(DicomNode*){ return; }
186 //====================================================================
187 // Tree Display Related
188 //====================================================================
191 /// Completely rebuilds the view with
192 /// current DicomDatabaseList
193 virtual void RebuildView(){ return; }
194 /// Recursively updates the part of the view corresponding
195 /// to the DicomDatabase passed
196 /// i.e. creates items for the DicomNode which do not have
197 /// deletes obsolete items (whose DicomNode has been deleted)
198 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
199 /// Recursively updates the part of the view corresponding
200 /// to the DicomNode provided.
201 /// parent is its parent in the tree (where to insert / remove it)
202 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
205 ///Type definition of the data regarding the tree
206 typedef WxGimmickTreeItemData TreeItemData;
207 ///Gets the item data of the tree item passed as a parameter
208 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
209 ///Type definition of the data insid a node of the tree
210 typedef WxGimmickDicomNodeData NodeData;
213 //====================================================================
215 //====================================================================
219 int mSelectionMaxImageDimension;
220 int mCurrentSelectionImageSize[4];
222 ///Existent Database List
223 DicomDatabaseListType mDicomDatabaseList;
224 ///Favorites database
225 DicomDatabase* mFavoriteDatabase;
227 ///Path to the database list file
228 std::string mDatabaseListFile;
229 ///Extension of the database
230 std::string mDatabaseExtension;
234 int mFirstDicomDatabaseIconIndex;
237 vtkImageViewer2* mViewer;
239 int mx1,mx2,my1,my2,mz1,mz2;
240 double mspx,mspy,mspz;
243 // Multi-thread image reader
244 MultiThreadImageReader mReader;
245 // map of images name to node
246 std::map<std::string,DicomNode*> mImageFileNameToNode;
249 } // EO namespace creaImageIO
251 #endif // USE_WIDGETS