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* h) { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
62 /// Controller which manages the interaction with the model
65 TreeViewMapType mTreeViewMap;
68 // EO class GimmickView
69 //=====================================================================
81 //====================================================================
83 //====================================================================
85 /// Returns the size of the current selection
86 virtual int GetSelectionSize() { return 0; }
87 /// Returns true if there is a valid selection
88 virtual bool IsSelectionValid(){ return false; }
89 /// Returns the vector of full filenames of selected images
90 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
91 /// Returns the vector of images corresponding to selection
92 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
93 /// Returns the vector of DicomNode corresponding to selection
94 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
95 /// Returns the DicomNode corresponding to the tree item
96 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
99 /// Type of list of DicomDatabase
100 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
101 /// Returns the list of DicomDatabase open
102 virtual DicomDatabaseListType& GetDicomDatabaseList()
104 /// Returns the list of DicomDatabase open (const)
105 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
109 ///Opens an existing database, or else, creates a local database.
110 virtual void OpenOrNewDatabase(bool open){ return; }
112 virtual void ShowHelp();
115 ///Gets the extension of the database
116 const std::string& GetDatabaseExtension() { return null; }
117 ///Sets the extension of the database
118 virtual void SetDatabaseExtension(const std::string& ext){ return; }
121 //====================================================================
122 // Preview Display Related
123 //====================================================================
126 ///Shows the image sent as a parameter
128 virtual void ShowImage(vtkImageData* image){ return; }
130 //====================================================================
132 //====================================================================
136 ///Loads or creates a favorites database
137 virtual void LoadOrCreateFavoritesDatabase(){ return; }
139 ///Creates the user settings directory
140 void CreateUserSettingsDirectory(){ return; }
141 ///Obtains the user settings directory
142 const std::string& GetUserSettingsDirectory(){ return null; }
144 //====================================================================
145 // Attribute Display Related
146 //====================================================================
149 ///Shows the Information regarding the node sent as a parameter
151 virtual void ShowInformation(DicomNode*){ return; }
153 //====================================================================
154 // Tree Display Related
155 //====================================================================
158 /// Completely rebuilds the view with
159 /// current DicomDatabaseList
160 virtual void RebuildView(){ return; }
161 /// Recursively updates the part of the view corresponding
162 /// to the DicomDatabase passed
163 /// i.e. creates items for the DicomNode which do not have
164 /// deletes obsolete items (whose DicomNode has been deleted)
165 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
166 /// Recursively updates the part of the view corresponding
167 /// to the DicomNode provided.
168 /// parent is its parent in the tree (where to insert / remove it)
169 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
172 ///Type definition of the data regarding the tree
173 typedef WxGimmickTreeItemData TreeItemData;
174 ///Gets the item data of the tree item passed as a parameter
175 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
176 ///Type definition of the data insid a node of the tree
177 typedef WxGimmickDicomNodeData NodeData;
180 //====================================================================
182 //====================================================================
186 int mSelectionMaxImageDimension;
187 int mCurrentSelectionImageSize[4];
189 ///Existent Database List
190 DicomDatabaseListType mDicomDatabaseList;
191 ///Favorites database
192 DicomDatabase* mFavoriteDatabase;
194 ///Path to the database list file
195 std::string mDatabaseListFile;
196 ///Extension of the database
197 std::string mDatabaseExtension;
201 int mFirstDicomDatabaseIconIndex;
204 vtkImageViewer2* mViewer;
206 int mx1,mx2,my1,my2,mz1,mz2;
207 double mspx,mspy,mspz;
210 // Multi-thread image reader
211 MultiThreadImageReader mReader;
212 // map of images name to node
213 std::map<std::string,DicomNode*> mImageFileNameToNode;
216 } // EO namespace creaImageIO