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
26 //=====================================================================
28 //=====================================================================
29 ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
34 GimmickView(Gimmick* );
35 /// Virtual destructor
36 virtual ~GimmickView();
39 /// Initializes the view :
40 /// Creates the TreeViews for all the TreeHandler of the Controller
42 virtual void Initialize();
44 /// Type of map from View name to TreeView*
45 /// (This map is equivalent for Views of the TreeHandlerMap of Gimmick)
46 typedef std::map<std::string, TreeView*> TreeViewMapType;
48 /// Returns the TreeViewMap (ref)
49 TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
50 /// Returns the TreeViewMap (const ref)
51 const TreeViewMapType& GetTreeViewMap() const
52 { return mTreeViewMap; }
55 virtual void Finalize();
56 ///Returns the selected Images and validates to see if they comply with the given parameter(<4D)
57 vtkImageData* GetSelectedImage(int dim);
58 ///Adds the selected Images to the given vector and validates to see if they comply with the given parameter (4D)
59 virtual void GetSelectedImages(std::vector<vtkImageData*>& s, int dim) {}
61 virtual void GetSelectedFiles(std::vector<std::string>& s) {}
63 /// Create the tree views
64 void CreateTreeViews();
66 /// Create the tree view for TreeHandler provided
67 virtual void CreateTreeView( TreeHandler*)
68 { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
70 /// Updates the TreeView of given name from level l to bottom
71 /// (calls the virtual method TreeView::UpdateLevel(l))
72 virtual void UpdateTreeViewLevel(const std::string&, int l);
75 /// Controller which manages the interaction with the model
78 TreeViewMapType mTreeViewMap;
81 // EO class GimmickView
82 //=====================================================================
94 //====================================================================
96 //====================================================================
98 /// Returns the size of the current selection
99 virtual int GetSelectionSize() { return 0; }
100 /// Returns true if there is a valid selection
101 virtual bool IsSelectionValid(){ return false; }
102 /// Returns the vector of full filenames of selected images
103 virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
104 /// Returns the vector of images corresponding to selection
105 virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
106 /// Returns the vector of DicomNode corresponding to selection
107 virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
108 /// Returns the DicomNode corresponding to the tree item
109 virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
112 /// Type of list of DicomDatabase
113 typedef std::vector<DicomDatabase*> DicomDatabaseListType;
114 /// Returns the list of DicomDatabase open
115 virtual DicomDatabaseListType& GetDicomDatabaseList()
117 /// Returns the list of DicomDatabase open (const)
118 virtual const DicomDatabaseListType& GetDicomDatabaseList() const
122 ///Opens an existing database, or else, creates a local database.
123 virtual void OpenOrNewDatabase(bool open){ return; }
125 virtual void ShowHelp();
128 ///Gets the extension of the database
129 const std::string& GetDatabaseExtension() { return null; }
130 ///Sets the extension of the database
131 virtual void SetDatabaseExtension(const std::string& ext){ return; }
134 //====================================================================
135 // Preview Display Related
136 //====================================================================
139 ///Shows the image sent as a parameter
141 virtual void ShowImage(vtkImageData* image){ return; }
143 //====================================================================
145 //====================================================================
149 ///Loads or creates a favorites database
150 virtual void LoadOrCreateFavoritesDatabase(){ return; }
152 ///Creates the user settings directory
153 void CreateUserSettingsDirectory(){ return; }
154 ///Obtains the user settings directory
155 const std::string& GetUserSettingsDirectory(){ return null; }
157 //====================================================================
158 // Attribute Display Related
159 //====================================================================
162 ///Shows the Information regarding the node sent as a parameter
164 virtual void ShowInformation(DicomNode*){ return; }
166 //====================================================================
167 // Tree Display Related
168 //====================================================================
171 /// Completely rebuilds the view with
172 /// current DicomDatabaseList
173 virtual void RebuildView(){ return; }
174 /// Recursively updates the part of the view corresponding
175 /// to the DicomDatabase passed
176 /// i.e. creates items for the DicomNode which do not have
177 /// deletes obsolete items (whose DicomNode has been deleted)
178 virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
179 /// Recursively updates the part of the view corresponding
180 /// to the DicomNode provided.
181 /// parent is its parent in the tree (where to insert / remove it)
182 virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
185 ///Type definition of the data regarding the tree
186 typedef WxGimmickTreeItemData TreeItemData;
187 ///Gets the item data of the tree item passed as a parameter
188 TreeItemData* GetItemData(const TreeItemId& id){ return null; }
189 ///Type definition of the data insid a node of the tree
190 typedef WxGimmickDicomNodeData NodeData;
193 //====================================================================
195 //====================================================================
199 int mSelectionMaxImageDimension;
200 int mCurrentSelectionImageSize[4];
202 ///Existent Database List
203 DicomDatabaseListType mDicomDatabaseList;
204 ///Favorites database
205 DicomDatabase* mFavoriteDatabase;
207 ///Path to the database list file
208 std::string mDatabaseListFile;
209 ///Extension of the database
210 std::string mDatabaseExtension;
214 int mFirstDicomDatabaseIconIndex;
217 vtkImageViewer2* mViewer;
219 int mx1,mx2,my1,my2,mz1,mz2;
220 double mspx,mspy,mspz;
223 // Multi-thread image reader
224 MultiThreadImageReader mReader;
225 // map of images name to node
226 std::map<std::string,DicomNode*> mImageFileNameToNode;
229 } // EO namespace creaImageIO