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);
68 /// Callback for removing files
69 void OnRemove(wxCommandEvent& event);
70 /// Display a message box with the last addition statistics
71 void DisplayAddSummary();
74 /// AddProgress Gimmick callback
75 void OnAddProgress( Gimmick::AddProgress& );
77 wxProgressDialog* mProgressDialog;
80 wxString mCurrentDirectory;
84 // EO class WxGimmickView
85 //=====================================================================
97 //====================================================================
99 //====================================================================
101 /// Returns the size of the current selection
102 virtual int GetSelectionSize() { return 0; }
103 /// Returns true if there is a valid selection
104 virtual bool IsSelectionValid(){ return false; }
105 /// Returns the vector of full filenames of selected images
106 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
107 /// Returns the vector of images corresponding to selection
108 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
109 /// Returns the vector of DicomNode corresponding to selection
110 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
111 /// Returns the DicomNode corresponding to the tree item
112 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
115 /// Type of list of DicomDatabase
116 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
117 /// Returns the list of DicomDatabase open
118 virtual DicomDatabaseListType& GetDicomDatabaseList()
120 /// Returns the list of DicomDatabase open (const)
121 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
125 ///Opens an existing database, or else, creates a local database.
126 virtual void OpenOrNewDatabase(bool open){ return; }
128 virtual void ShowHelp();
131 ///Gets the extension of the database
132 const std::string& GetDatabaseExtension() { return null; }
133 ///Sets the extension of the database
134 virtual void SetDatabaseExtension(const std::string& ext){ return; }
137 //====================================================================
138 // Preview Display Related
139 //====================================================================
142 ///Shows the image sent as a parameter
144 virtual void ShowImage(vtkImageData* image){ return; }
146 //====================================================================
148 //====================================================================
152 ///Loads or creates a favorites database
153 virtual void LoadOrCreateFavoritesDatabase(){ return; }
155 ///Creates the user settings directory
156 void CreateUserSettingsDirectory(){ return; }
157 ///Obtains the user settings directory
158 const std::string& GetUserSettingsDirectory(){ return null; }
160 //====================================================================
161 // Attribute Display Related
162 //====================================================================
165 ///Shows the Information regarding the node sent as a parameter
167 virtual void ShowInformation(DicomNode*){ return; }
169 //====================================================================
170 // Tree Display Related
171 //====================================================================
174 /// Completely rebuilds the view with
175 /// current DicomDatabaseList
176 virtual void RebuildView(){ return; }
177 /// Recursively updates the part of the view corresponding
178 /// to the DicomDatabase passed
179 /// i.e. creates items for the DicomNode which do not have
180 /// deletes obsolete items (whose DicomNode has been deleted)
181 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
182 /// Recursively updates the part of the view corresponding
183 /// to the DicomNode provided.
184 /// parent is its parent in the tree (where to insert / remove it)
185 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
188 ///Type definition of the data regarding the tree
189 typedef WxGimmickTreeItemData TreeItemData;
190 ///Gets the item data of the tree item passed as a parameter
191 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
192 ///Type definition of the data insid a node of the tree
193 typedef WxGimmickDicomNodeData NodeData;
196 //====================================================================
198 //====================================================================
202 int mSelectionMaxImageDimension;
203 int mCurrentSelectionImageSize[4];
205 ///Existent Database List
206 DicomDatabaseListType mDicomDatabaseList;
207 ///Favorites database
208 DicomDatabase* mFavoriteDatabase;
210 ///Path to the database list file
211 std::string mDatabaseListFile;
212 ///Extension of the database
213 std::string mDatabaseExtension;
217 int mFirstDicomDatabaseIconIndex;
220 vtkImageViewer2* mViewer;
222 int mx1,mx2,my1,my2,mz1,mz2;
223 double mspx,mspy,mspz;
226 // Multi-thread image reader
227 MultiThreadImageReader mReader;
228 // map of images name to node
229 std::map<std::string,DicomNode*> mImageFileNameToNode;
232 } // EO namespace creaImageIO
234 #endif // USE_WIDGETS