1 #ifndef __creaImageIOGimmickView_h_INCLUDED__
2 #define __creaImageIOGimmickView_h_INCLUDED__
4 #include <creaImageIOGimmick.h>
5 #include <creaImageIOTreeView.h>
7 #include <vtkImageData.h>
9 #define GIMMICK_NO_IMAGE_SELECTION 0
10 #define GIMMICK_2D_IMAGE_SELECTION 2
11 #define GIMMICK_3D_IMAGE_SELECTION 3
12 #define GIMMICK_4D_IMAGE_SELECTION 4
20 //=====================================================================
22 //=====================================================================
23 ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
28 GimmickView(Gimmick* );
29 /// Virtual destructor
30 virtual ~GimmickView();
33 /// Initializes the view :
34 /// Creates the TreeViews for all the TreeHandler of the Controller
36 virtual void Initialize();
38 /// Type of map from View name to TreeView*
39 /// (This map is equivalent for Views of the TreeHandlerMap of Gimmick)
40 typedef std::map<std::string, TreeView*> TreeViewMapType;
42 /// Returns the TreeViewMap (ref)
43 TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
44 /// Returns the TreeViewMap (const ref)
45 const TreeViewMapType& GetTreeViewMap() const
46 { return mTreeViewMap; }
49 virtual void Finalize();
51 virtual void GetSelectedImages(std::vector<vtkImageData*>& s) {}
52 virtual void GetSelectedFiles(std::vector<std::string>& s) {}
55 /// Controller which manages the interaction with the model
58 TreeViewMapType mTreeViewMap;
61 // EO class GimmickView
62 //=====================================================================
74 //====================================================================
76 //====================================================================
78 /// Returns the size of the current selection
79 virtual int GetSelectionSize() { return 0; }
80 /// Returns true if there is a valid selection
81 virtual bool IsSelectionValid(){ return false; }
82 /// Returns the vector of full filenames of selected images
83 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
84 /// Returns the vector of images corresponding to selection
85 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
86 /// Returns the vector of DicomNode corresponding to selection
87 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
88 /// Returns the DicomNode corresponding to the tree item
89 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
92 /// Type of list of DicomDatabase
93 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
94 /// Returns the list of DicomDatabase open
95 virtual DicomDatabaseListType& GetDicomDatabaseList()
97 /// Returns the list of DicomDatabase open (const)
98 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
102 ///Opens an existing database, or else, creates a local database.
103 virtual void OpenOrNewDatabase(bool open){ return; }
105 virtual void ShowHelp();
108 ///Gets the extension of the database
109 const std::string& GetDatabaseExtension() { return null; }
110 ///Sets the extension of the database
111 virtual void SetDatabaseExtension(const std::string& ext){ return; }
114 //====================================================================
115 // Preview Display Related
116 //====================================================================
119 ///Shows the image sent as a parameter
121 virtual void ShowImage(vtkImageData* image){ return; }
123 //====================================================================
125 //====================================================================
129 ///Loads or creates a favorites database
130 virtual void LoadOrCreateFavoritesDatabase(){ return; }
132 ///Creates the user settings directory
133 void CreateUserSettingsDirectory(){ return; }
134 ///Obtains the user settings directory
135 const std::string& GetUserSettingsDirectory(){ return null; }
137 //====================================================================
138 // Attribute Display Related
139 //====================================================================
142 ///Shows the Information regarding the node sent as a parameter
144 virtual void ShowInformation(DicomNode*){ return; }
146 //====================================================================
147 // Tree Display Related
148 //====================================================================
151 /// Completely rebuilds the view with
152 /// current DicomDatabaseList
153 virtual void RebuildView(){ return; }
154 /// Recursively updates the part of the view corresponding
155 /// to the DicomDatabase passed
156 /// i.e. creates items for the DicomNode which do not have
157 /// deletes obsolete items (whose DicomNode has been deleted)
158 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
159 /// Recursively updates the part of the view corresponding
160 /// to the DicomNode provided.
161 /// parent is its parent in the tree (where to insert / remove it)
162 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
165 ///Type definition of the data regarding the tree
166 typedef WxGimmickTreeItemData TreeItemData;
167 ///Gets the item data of the tree item passed as a parameter
168 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
169 ///Type definition of the data insid a node of the tree
170 typedef WxGimmickDicomNodeData NodeData;
173 //====================================================================
175 //====================================================================
179 int mSelectionMaxImageDimension;
180 int mCurrentSelectionImageSize[4];
182 ///Existent Database List
183 DicomDatabaseListType mDicomDatabaseList;
184 ///Favorites database
185 DicomDatabase* mFavoriteDatabase;
187 ///Path to the database list file
188 std::string mDatabaseListFile;
189 ///Extension of the database
190 std::string mDatabaseExtension;
194 int mFirstDicomDatabaseIconIndex;
197 vtkImageViewer2* mViewer;
199 int mx1,mx2,my1,my2,mz1,mz2;
200 double mspx,mspy,mspz;
203 // Multi-thread image reader
204 MultiThreadImageReader mReader;
205 // map of images name to node
206 std::map<std::string,DicomNode*> mImageFileNameToNode;
209 } // EO namespace creaImageIO