1 #ifndef __creaImageIOGimmickView_h_INCLUDED__
2 #define __creaImageIOGimmickView_h_INCLUDED__
4 #include <creaImageIOGimmick.h>
5 #include <creaImageIOTreeView.h>
6 #include <creaImageIOSystem.h>
9 #include <vtkImageData.h>
11 #define GIMMICK_NO_IMAGE_SELECTION 0
12 #define GIMMICK_2D_IMAGE_SELECTION 2
13 #define GIMMICK_3D_IMAGE_SELECTION 3
14 #define GIMMICK_4D_IMAGE_SELECTION 4
22 //=====================================================================
24 //=====================================================================
25 ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
30 GimmickView(Gimmick* );
31 /// Virtual destructor
32 virtual ~GimmickView();
35 /// Initializes the view :
36 /// Creates the TreeViews for all the TreeHandler of the Controller
38 virtual void Initialize();
40 /// Type of map from View name to TreeView*
41 /// (This map is equivalent for Views of the TreeHandlerMap of Gimmick)
42 typedef std::map<std::string, TreeView*> TreeViewMapType;
44 /// Returns the TreeViewMap (ref)
45 TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
46 /// Returns the TreeViewMap (const ref)
47 const TreeViewMapType& GetTreeViewMap() const
48 { return mTreeViewMap; }
51 virtual void Finalize();
52 ///Returns the selected Images and validates to see if they comply with the given parameter(<4D)
53 vtkImageData* GetSelectedImage(int dim);
54 ///Adds the selected Images to the given vector and validates to see if they comply with the given parameter (4D)
55 virtual void GetSelectedImages(std::vector<vtkImageData*>& s, int dim) {}
57 virtual void GetSelectedFiles(std::vector<std::string>& s) {}
59 /// Create the tree views
60 void CreateTreeViews();
62 /// Create the tree view for TreeHandler provided
63 virtual void CreateTreeView( TreeHandler*)
64 { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
66 /// Updates the TreeView of given name from level l to bottom
67 /// (calls the virtual method TreeView::UpdateLevel(l))
68 virtual void UpdateTreeViewLevel(const std::string&, int l);
71 /// Controller which manages the interaction with the model
74 TreeViewMapType mTreeViewMap;
77 // EO class GimmickView
78 //=====================================================================
90 //====================================================================
92 //====================================================================
94 /// Returns the size of the current selection
95 virtual int GetSelectionSize() { return 0; }
96 /// Returns true if there is a valid selection
97 virtual bool IsSelectionValid(){ return false; }
98 /// Returns the vector of full filenames of selected images
99 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
100 /// Returns the vector of images corresponding to selection
101 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
102 /// Returns the vector of DicomNode corresponding to selection
103 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
104 /// Returns the DicomNode corresponding to the tree item
105 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
108 /// Type of list of DicomDatabase
109 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
110 /// Returns the list of DicomDatabase open
111 virtual DicomDatabaseListType& GetDicomDatabaseList()
113 /// Returns the list of DicomDatabase open (const)
114 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
118 ///Opens an existing database, or else, creates a local database.
119 virtual void OpenOrNewDatabase(bool open){ return; }
121 virtual void ShowHelp();
124 ///Gets the extension of the database
125 const std::string& GetDatabaseExtension() { return null; }
126 ///Sets the extension of the database
127 virtual void SetDatabaseExtension(const std::string& ext){ return; }
130 //====================================================================
131 // Preview Display Related
132 //====================================================================
135 ///Shows the image sent as a parameter
137 virtual void ShowImage(vtkImageData* image){ return; }
139 //====================================================================
141 //====================================================================
145 ///Loads or creates a favorites database
146 virtual void LoadOrCreateFavoritesDatabase(){ return; }
148 ///Creates the user settings directory
149 void CreateUserSettingsDirectory(){ return; }
150 ///Obtains the user settings directory
151 const std::string& GetUserSettingsDirectory(){ return null; }
153 //====================================================================
154 // Attribute Display Related
155 //====================================================================
158 ///Shows the Information regarding the node sent as a parameter
160 virtual void ShowInformation(DicomNode*){ return; }
162 //====================================================================
163 // Tree Display Related
164 //====================================================================
167 /// Completely rebuilds the view with
168 /// current DicomDatabaseList
169 virtual void RebuildView(){ return; }
170 /// Recursively updates the part of the view corresponding
171 /// to the DicomDatabase passed
172 /// i.e. creates items for the DicomNode which do not have
173 /// deletes obsolete items (whose DicomNode has been deleted)
174 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
175 /// Recursively updates the part of the view corresponding
176 /// to the DicomNode provided.
177 /// parent is its parent in the tree (where to insert / remove it)
178 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
181 ///Type definition of the data regarding the tree
182 typedef WxGimmickTreeItemData TreeItemData;
183 ///Gets the item data of the tree item passed as a parameter
184 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
185 ///Type definition of the data insid a node of the tree
186 typedef WxGimmickDicomNodeData NodeData;
189 //====================================================================
191 //====================================================================
195 int mSelectionMaxImageDimension;
196 int mCurrentSelectionImageSize[4];
198 ///Existent Database List
199 DicomDatabaseListType mDicomDatabaseList;
200 ///Favorites database
201 DicomDatabase* mFavoriteDatabase;
203 ///Path to the database list file
204 std::string mDatabaseListFile;
205 ///Extension of the database
206 std::string mDatabaseExtension;
210 int mFirstDicomDatabaseIconIndex;
213 vtkImageViewer2* mViewer;
215 int mx1,mx2,my1,my2,mz1,mz2;
216 double mspx,mspy,mspz;
219 // Multi-thread image reader
220 MultiThreadImageReader mReader;
221 // map of images name to node
222 std::map<std::string,DicomNode*> mImageFileNameToNode;
225 } // EO namespace creaImageIO