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 a file
65 void OnAddFile(wxCommandEvent& event);
70 // EO class WxGimmickView
71 //=====================================================================
83 //====================================================================
85 //====================================================================
87 /// Returns the size of the current selection
88 virtual int GetSelectionSize() { return 0; }
89 /// Returns true if there is a valid selection
90 virtual bool IsSelectionValid(){ return false; }
91 /// Returns the vector of full filenames of selected images
92 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
93 /// Returns the vector of images corresponding to selection
94 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
95 /// Returns the vector of DicomNode corresponding to selection
96 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
97 /// Returns the DicomNode corresponding to the tree item
98 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
101 /// Type of list of DicomDatabase
102 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
103 /// Returns the list of DicomDatabase open
104 virtual DicomDatabaseListType& GetDicomDatabaseList()
106 /// Returns the list of DicomDatabase open (const)
107 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
111 ///Opens an existing database, or else, creates a local database.
112 virtual void OpenOrNewDatabase(bool open){ return; }
114 virtual void ShowHelp();
117 ///Gets the extension of the database
118 const std::string& GetDatabaseExtension() { return null; }
119 ///Sets the extension of the database
120 virtual void SetDatabaseExtension(const std::string& ext){ return; }
123 //====================================================================
124 // Preview Display Related
125 //====================================================================
128 ///Shows the image sent as a parameter
130 virtual void ShowImage(vtkImageData* image){ return; }
132 //====================================================================
134 //====================================================================
138 ///Loads or creates a favorites database
139 virtual void LoadOrCreateFavoritesDatabase(){ return; }
141 ///Creates the user settings directory
142 void CreateUserSettingsDirectory(){ return; }
143 ///Obtains the user settings directory
144 const std::string& GetUserSettingsDirectory(){ return null; }
146 //====================================================================
147 // Attribute Display Related
148 //====================================================================
151 ///Shows the Information regarding the node sent as a parameter
153 virtual void ShowInformation(DicomNode*){ return; }
155 //====================================================================
156 // Tree Display Related
157 //====================================================================
160 /// Completely rebuilds the view with
161 /// current DicomDatabaseList
162 virtual void RebuildView(){ return; }
163 /// Recursively updates the part of the view corresponding
164 /// to the DicomDatabase passed
165 /// i.e. creates items for the DicomNode which do not have
166 /// deletes obsolete items (whose DicomNode has been deleted)
167 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
168 /// Recursively updates the part of the view corresponding
169 /// to the DicomNode provided.
170 /// parent is its parent in the tree (where to insert / remove it)
171 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
174 ///Type definition of the data regarding the tree
175 typedef WxGimmickTreeItemData TreeItemData;
176 ///Gets the item data of the tree item passed as a parameter
177 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
178 ///Type definition of the data insid a node of the tree
179 typedef WxGimmickDicomNodeData NodeData;
182 //====================================================================
184 //====================================================================
188 int mSelectionMaxImageDimension;
189 int mCurrentSelectionImageSize[4];
191 ///Existent Database List
192 DicomDatabaseListType mDicomDatabaseList;
193 ///Favorites database
194 DicomDatabase* mFavoriteDatabase;
196 ///Path to the database list file
197 std::string mDatabaseListFile;
198 ///Extension of the database
199 std::string mDatabaseExtension;
203 int mFirstDicomDatabaseIconIndex;
206 vtkImageViewer2* mViewer;
208 int mx1,mx2,my1,my2,mz1,mz2;
209 double mspx,mspy,mspz;
212 // Multi-thread image reader
213 MultiThreadImageReader mReader;
214 // map of images name to node
215 std::map<std::string,DicomNode*> mImageFileNameToNode;
218 } // EO namespace creaImageIO
220 #endif // USE_WIDGETS