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);
70 /// AddProgress Gimmick callback
71 void OnAddProgress( Gimmick::AddProgress& );
73 wxProgressDialog* mProgressDialog;
76 wxString mCurrentDirectory;
80 // EO class WxGimmickView
81 //=====================================================================
93 //====================================================================
95 //====================================================================
97 /// Returns the size of the current selection
98 virtual int GetSelectionSize() { return 0; }
99 /// Returns true if there is a valid selection
100 virtual bool IsSelectionValid(){ return false; }
101 /// Returns the vector of full filenames of selected images
102 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
103 /// Returns the vector of images corresponding to selection
104 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
105 /// Returns the vector of DicomNode corresponding to selection
106 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
107 /// Returns the DicomNode corresponding to the tree item
108 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
111 /// Type of list of DicomDatabase
112 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
113 /// Returns the list of DicomDatabase open
114 virtual DicomDatabaseListType& GetDicomDatabaseList()
116 /// Returns the list of DicomDatabase open (const)
117 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
121 ///Opens an existing database, or else, creates a local database.
122 virtual void OpenOrNewDatabase(bool open){ return; }
124 virtual void ShowHelp();
127 ///Gets the extension of the database
128 const std::string& GetDatabaseExtension() { return null; }
129 ///Sets the extension of the database
130 virtual void SetDatabaseExtension(const std::string& ext){ return; }
133 //====================================================================
134 // Preview Display Related
135 //====================================================================
138 ///Shows the image sent as a parameter
140 virtual void ShowImage(vtkImageData* image){ return; }
142 //====================================================================
144 //====================================================================
148 ///Loads or creates a favorites database
149 virtual void LoadOrCreateFavoritesDatabase(){ return; }
151 ///Creates the user settings directory
152 void CreateUserSettingsDirectory(){ return; }
153 ///Obtains the user settings directory
154 const std::string& GetUserSettingsDirectory(){ return null; }
156 //====================================================================
157 // Attribute Display Related
158 //====================================================================
161 ///Shows the Information regarding the node sent as a parameter
163 virtual void ShowInformation(DicomNode*){ return; }
165 //====================================================================
166 // Tree Display Related
167 //====================================================================
170 /// Completely rebuilds the view with
171 /// current DicomDatabaseList
172 virtual void RebuildView(){ return; }
173 /// Recursively updates the part of the view corresponding
174 /// to the DicomDatabase passed
175 /// i.e. creates items for the DicomNode which do not have
176 /// deletes obsolete items (whose DicomNode has been deleted)
177 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
178 /// Recursively updates the part of the view corresponding
179 /// to the DicomNode provided.
180 /// parent is its parent in the tree (where to insert / remove it)
181 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
184 ///Type definition of the data regarding the tree
185 typedef WxGimmickTreeItemData TreeItemData;
186 ///Gets the item data of the tree item passed as a parameter
187 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
188 ///Type definition of the data insid a node of the tree
189 typedef WxGimmickDicomNodeData NodeData;
192 //====================================================================
194 //====================================================================
198 int mSelectionMaxImageDimension;
199 int mCurrentSelectionImageSize[4];
201 ///Existent Database List
202 DicomDatabaseListType mDicomDatabaseList;
203 ///Favorites database
204 DicomDatabase* mFavoriteDatabase;
206 ///Path to the database list file
207 std::string mDatabaseListFile;
208 ///Extension of the database
209 std::string mDatabaseExtension;
213 int mFirstDicomDatabaseIconIndex;
216 vtkImageViewer2* mViewer;
218 int mx1,mx2,my1,my2,mz1,mz2;
219 double mspx,mspy,mspz;
222 // Multi-thread image reader
223 MultiThreadImageReader mReader;
224 // map of images name to node
225 std::map<std::string,DicomNode*> mImageFileNameToNode;
228 } // EO namespace creaImageIO
230 #endif // USE_WIDGETS