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 // EO class WxGimmickView
65 //=====================================================================
77 //====================================================================
79 //====================================================================
81 /// Returns the size of the current selection
82 virtual int GetSelectionSize() { return 0; }
83 /// Returns true if there is a valid selection
84 virtual bool IsSelectionValid(){ return false; }
85 /// Returns the vector of full filenames of selected images
86 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
87 /// Returns the vector of images corresponding to selection
88 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
89 /// Returns the vector of DicomNode corresponding to selection
90 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
91 /// Returns the DicomNode corresponding to the tree item
92 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
95 /// Type of list of DicomDatabase
96 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
97 /// Returns the list of DicomDatabase open
98 virtual DicomDatabaseListType& GetDicomDatabaseList()
100 /// Returns the list of DicomDatabase open (const)
101 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
105 ///Opens an existing database, or else, creates a local database.
106 virtual void OpenOrNewDatabase(bool open){ return; }
108 virtual void ShowHelp();
111 ///Gets the extension of the database
112 const std::string& GetDatabaseExtension() { return null; }
113 ///Sets the extension of the database
114 virtual void SetDatabaseExtension(const std::string& ext){ return; }
117 //====================================================================
118 // Preview Display Related
119 //====================================================================
122 ///Shows the image sent as a parameter
124 virtual void ShowImage(vtkImageData* image){ return; }
126 //====================================================================
128 //====================================================================
132 ///Loads or creates a favorites database
133 virtual void LoadOrCreateFavoritesDatabase(){ return; }
135 ///Creates the user settings directory
136 void CreateUserSettingsDirectory(){ return; }
137 ///Obtains the user settings directory
138 const std::string& GetUserSettingsDirectory(){ return null; }
140 //====================================================================
141 // Attribute Display Related
142 //====================================================================
145 ///Shows the Information regarding the node sent as a parameter
147 virtual void ShowInformation(DicomNode*){ return; }
149 //====================================================================
150 // Tree Display Related
151 //====================================================================
154 /// Completely rebuilds the view with
155 /// current DicomDatabaseList
156 virtual void RebuildView(){ return; }
157 /// Recursively updates the part of the view corresponding
158 /// to the DicomDatabase passed
159 /// i.e. creates items for the DicomNode which do not have
160 /// deletes obsolete items (whose DicomNode has been deleted)
161 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
162 /// Recursively updates the part of the view corresponding
163 /// to the DicomNode provided.
164 /// parent is its parent in the tree (where to insert / remove it)
165 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
168 ///Type definition of the data regarding the tree
169 typedef WxGimmickTreeItemData TreeItemData;
170 ///Gets the item data of the tree item passed as a parameter
171 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
172 ///Type definition of the data insid a node of the tree
173 typedef WxGimmickDicomNodeData NodeData;
176 //====================================================================
178 //====================================================================
182 int mSelectionMaxImageDimension;
183 int mCurrentSelectionImageSize[4];
185 ///Existent Database List
186 DicomDatabaseListType mDicomDatabaseList;
187 ///Favorites database
188 DicomDatabase* mFavoriteDatabase;
190 ///Path to the database list file
191 std::string mDatabaseListFile;
192 ///Extension of the database
193 std::string mDatabaseExtension;
197 int mFirstDicomDatabaseIconIndex;
200 vtkImageViewer2* mViewer;
202 int mx1,mx2,my1,my2,mz1,mz2;
203 double mspx,mspy,mspz;
206 // Multi-thread image reader
207 MultiThreadImageReader mReader;
208 // map of images name to node
209 std::map<std::string,DicomNode*> mImageFileNameToNode;
212 } // EO namespace creaImageIO
214 #endif // USE_WIDGETS