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,
36 int number_of_threads = 0);
37 /// Virtual destructor
38 virtual ~WxGimmickView();
40 /// Returns the selected Images so that they comply with the given parameter(<4D)
41 ///(overloaded from GimmickView)
42 vtkImageData* GetSelectedImage(int dim);
43 /// Returns the selected Images so that they comply with the given parameter(4D)
44 //(overloaded from GimmickView)
45 void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
48 /// Creates the tool bar
51 /// Create the tree view for TreeHandler provided
52 /// (overloaded from GimmickView)
53 void CreateTreeView( TreeHandler* );
57 /// The ToolBar and the tools
59 wxToolBarToolBase* mToolAddFile;
60 wxToolBarToolBase* mToolAddDir;
61 wxToolBarToolBase* mToolRemove;
62 wxToolBarToolBase* mToolAddDatabase;
63 wxToolBarToolBase* mToolHelp;
65 wxSplitterWindow* mSplitter;
66 wxPanel* mBottomPanel;
67 wxNotebook* mNotebook;
71 void CreateIconList();
74 /// Callback for adding files
75 void OnAddFiles(wxCommandEvent& event);
76 /// Callback for adding dir
77 void OnAddDir(wxCommandEvent& event);
78 /// Callback for removing files
79 void OnRemove(wxCommandEvent& event);
80 /// Display a message box with the last addition statistics
81 void DisplayAddSummary();
84 /// AddProgress Gimmick callback
85 void OnAddProgress( Gimmick::AddProgress& );
87 wxProgressDialog* mProgressDialog;
88 //The selection's maximum dimension
89 int mSelectionMaxDimension;
90 //The selection's minimum dimension
91 int mSelectionMinDimension;
92 //The user desired output dimension
96 wxString mCurrentDirectory;
100 // EO class WxGimmickView
101 //=====================================================================
113 //====================================================================
115 //====================================================================
117 /// Returns the size of the current selection
118 virtual int GetSelectionSize() { return 0; }
119 /// Returns true if there is a valid selection
120 virtual bool IsSelectionValid(){ return false; }
121 /// Returns the vector of full filenames of selected images
122 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
123 /// Returns the vector of images corresponding to selection
124 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
125 /// Returns the vector of DicomNode corresponding to selection
126 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
127 /// Returns the DicomNode corresponding to the tree item
128 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
131 /// Type of list of DicomDatabase
132 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
133 /// Returns the list of DicomDatabase open
134 virtual DicomDatabaseListType& GetDicomDatabaseList()
136 /// Returns the list of DicomDatabase open (const)
137 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
141 ///Opens an existing database, or else, creates a local database.
142 virtual void OpenOrNewDatabase(bool open){ return; }
144 virtual void ShowHelp();
147 ///Gets the extension of the database
148 const std::string& GetDatabaseExtension() { return null; }
149 ///Sets the extension of the database
150 virtual void SetDatabaseExtension(const std::string& ext){ return; }
153 //====================================================================
154 // Preview Display Related
155 //====================================================================
158 ///Shows the image sent as a parameter
160 virtual void ShowImage(vtkImageData* image){ return; }
162 //====================================================================
164 //====================================================================
168 ///Loads or creates a favorites database
169 virtual void LoadOrCreateFavoritesDatabase(){ return; }
171 ///Creates the user settings directory
172 void CreateUserSettingsDirectory(){ return; }
173 ///Obtains the user settings directory
174 const std::string& GetUserSettingsDirectory(){ return null; }
176 //====================================================================
177 // Attribute Display Related
178 //====================================================================
181 ///Shows the Information regarding the node sent as a parameter
183 virtual void ShowInformation(DicomNode*){ return; }
185 //====================================================================
186 // Tree Display Related
187 //====================================================================
190 /// Completely rebuilds the view with
191 /// current DicomDatabaseList
192 virtual void RebuildView(){ return; }
193 /// Recursively updates the part of the view corresponding
194 /// to the DicomDatabase passed
195 /// i.e. creates items for the DicomNode which do not have
196 /// deletes obsolete items (whose DicomNode has been deleted)
197 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
198 /// Recursively updates the part of the view corresponding
199 /// to the DicomNode provided.
200 /// parent is its parent in the tree (where to insert / remove it)
201 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
204 ///Type definition of the data regarding the tree
205 typedef WxGimmickTreeItemData TreeItemData;
206 ///Gets the item data of the tree item passed as a parameter
207 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
208 ///Type definition of the data insid a node of the tree
209 typedef WxGimmickDicomNodeData NodeData;
212 //====================================================================
214 //====================================================================
218 int mSelectionMaxImageDimension;
219 int mCurrentSelectionImageSize[4];
221 ///Existent Database List
222 DicomDatabaseListType mDicomDatabaseList;
223 ///Favorites database
224 DicomDatabase* mFavoriteDatabase;
226 ///Path to the database list file
227 std::string mDatabaseListFile;
228 ///Extension of the database
229 std::string mDatabaseExtension;
233 int mFirstDicomDatabaseIconIndex;
236 vtkImageViewer2* mViewer;
238 int mx1,mx2,my1,my2,mz1,mz2;
239 double mspx,mspy,mspz;
242 // Multi-thread image reader
243 MultiThreadImageReader mReader;
244 // map of images name to node
245 std::map<std::string,DicomNode*> mImageFileNameToNode;
248 } // EO namespace creaImageIO
250 #endif // USE_WIDGETS