1 #ifndef __creaImageIOGimmickView_h_INCLUDED__
2 #define __creaImageIOGimmickView_h_INCLUDED__
4 #include <creaImageIOGimmick.h>
5 #include <creaImageIOTreeView.h>
6 #include <creaImageIOSystem.h>
8 #include <vtkImageData.h>
10 #define GIMMICK_NO_IMAGE_SELECTION 0
11 #define GIMMICK_2D_IMAGE_SELECTION 2
12 #define GIMMICK_3D_IMAGE_SELECTION 3
13 #define GIMMICK_4D_IMAGE_SELECTION 4
21 //=====================================================================
23 //=====================================================================
24 ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
29 GimmickView(Gimmick* );
30 /// Virtual destructor
31 virtual ~GimmickView();
34 /// Initializes the view :
35 /// Creates the TreeViews for all the TreeHandler of the Controller
37 virtual void Initialize();
39 /// Type of map from View name to TreeView*
40 /// (This map is equivalent for Views of the TreeHandlerMap of Gimmick)
41 typedef std::map<std::string, TreeView*> TreeViewMapType;
43 /// Returns the TreeViewMap (ref)
44 TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
45 /// Returns the TreeViewMap (const ref)
46 const TreeViewMapType& GetTreeViewMap() const
47 { return mTreeViewMap; }
50 virtual void Finalize();
52 virtual void GetSelectedImages(std::vector<vtkImageData*>& s) {}
53 virtual void GetSelectedFiles(std::vector<std::string>& s) {}
55 /// Create the tree views
56 void CreateTreeViews();
58 /// Create the tree view for TreeHandler provided
59 virtual void CreateTreeView( TreeHandler*)
60 { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
62 /// Updates the TreeView of given name from level l to bottom
63 /// (calls the virtual method TreeView::UpdateLevel(l))
64 virtual void UpdateTreeViewLevel(const std::string&, int l);
67 /// Controller which manages the interaction with the model
70 TreeViewMapType mTreeViewMap;
73 // EO class GimmickView
74 //=====================================================================
86 //====================================================================
88 //====================================================================
90 /// Returns the size of the current selection
91 virtual int GetSelectionSize() { return 0; }
92 /// Returns true if there is a valid selection
93 virtual bool IsSelectionValid(){ return false; }
94 /// Returns the vector of full filenames of selected images
95 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
96 /// Returns the vector of images corresponding to selection
97 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
98 /// Returns the vector of DicomNode corresponding to selection
99 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
100 /// Returns the DicomNode corresponding to the tree item
101 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
104 /// Type of list of DicomDatabase
105 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
106 /// Returns the list of DicomDatabase open
107 virtual DicomDatabaseListType& GetDicomDatabaseList()
109 /// Returns the list of DicomDatabase open (const)
110 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
114 ///Opens an existing database, or else, creates a local database.
115 virtual void OpenOrNewDatabase(bool open){ return; }
117 virtual void ShowHelp();
120 ///Gets the extension of the database
121 const std::string& GetDatabaseExtension() { return null; }
122 ///Sets the extension of the database
123 virtual void SetDatabaseExtension(const std::string& ext){ return; }
126 //====================================================================
127 // Preview Display Related
128 //====================================================================
131 ///Shows the image sent as a parameter
133 virtual void ShowImage(vtkImageData* image){ return; }
135 //====================================================================
137 //====================================================================
141 ///Loads or creates a favorites database
142 virtual void LoadOrCreateFavoritesDatabase(){ return; }
144 ///Creates the user settings directory
145 void CreateUserSettingsDirectory(){ return; }
146 ///Obtains the user settings directory
147 const std::string& GetUserSettingsDirectory(){ return null; }
149 //====================================================================
150 // Attribute Display Related
151 //====================================================================
154 ///Shows the Information regarding the node sent as a parameter
156 virtual void ShowInformation(DicomNode*){ return; }
158 //====================================================================
159 // Tree Display Related
160 //====================================================================
163 /// Completely rebuilds the view with
164 /// current DicomDatabaseList
165 virtual void RebuildView(){ return; }
166 /// Recursively updates the part of the view corresponding
167 /// to the DicomDatabase passed
168 /// i.e. creates items for the DicomNode which do not have
169 /// deletes obsolete items (whose DicomNode has been deleted)
170 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
171 /// Recursively updates the part of the view corresponding
172 /// to the DicomNode provided.
173 /// parent is its parent in the tree (where to insert / remove it)
174 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
177 ///Type definition of the data regarding the tree
178 typedef WxGimmickTreeItemData TreeItemData;
179 ///Gets the item data of the tree item passed as a parameter
180 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
181 ///Type definition of the data insid a node of the tree
182 typedef WxGimmickDicomNodeData NodeData;
185 //====================================================================
187 //====================================================================
191 int mSelectionMaxImageDimension;
192 int mCurrentSelectionImageSize[4];
194 ///Existent Database List
195 DicomDatabaseListType mDicomDatabaseList;
196 ///Favorites database
197 DicomDatabase* mFavoriteDatabase;
199 ///Path to the database list file
200 std::string mDatabaseListFile;
201 ///Extension of the database
202 std::string mDatabaseExtension;
206 int mFirstDicomDatabaseIconIndex;
209 vtkImageViewer2* mViewer;
211 int mx1,mx2,my1,my2,mz1,mz2;
212 double mspx,mspy,mspz;
215 // Multi-thread image reader
216 MultiThreadImageReader mReader;
217 // map of images name to node
218 std::map<std::string,DicomNode*> mImageFileNameToNode;
221 } // EO namespace creaImageIO