]> Creatis software - creaImageIO.git/blob - src2/creaImageIOGimmickView.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOGimmickView.h
1 #ifndef __creaImageIOGimmickView_h_INCLUDED__
2 #define __creaImageIOGimmickView_h_INCLUDED__
3
4 #include <creaImageIOGimmick.h>
5 #include <creaImageIOTreeView.h>
6 //#include <map>
7 #include <vtkImageData.h>
8
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
13
14
15 namespace creaImageIO
16 {
17         /**
18         * \ingroup View
19         */
20     //=====================================================================
21     
22     //=====================================================================
23     ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
24         class GimmickView
25     {
26     public:
27       /// Ctor
28       GimmickView(Gimmick* );
29       /// Virtual destructor
30       virtual ~GimmickView();
31
32
33       /// Initializes the view : 
34       /// Creates the TreeViews for all the TreeHandler of the Controller
35       /// 
36       virtual void Initialize();
37
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;
41       
42       /// Returns the TreeViewMap (ref)
43       TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
44       /// Returns the TreeViewMap (const ref)
45       const TreeViewMapType& GetTreeViewMap() const
46       { return mTreeViewMap; }
47
48       /// Finalize 
49       virtual void Finalize();
50       
51       virtual void GetSelectedImages(std::vector<vtkImageData*>& s) {}
52       virtual void GetSelectedFiles(std::vector<std::string>& s) {}
53
54     private:
55       /// Controller which manages the interaction with the model
56       Gimmick* mGimmick;
57       /// The views 
58       TreeViewMapType mTreeViewMap;
59       
60     };
61     // EO class GimmickView
62     //=====================================================================
63   
64
65   /*
66
67
68
69
70
71
72
73
74         //====================================================================
75         // General
76         //====================================================================
77
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);
90
91         
92         /// Type of list of DicomDatabase
93     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
94     /// Returns the list of DicomDatabase open
95     virtual DicomDatabaseListType& GetDicomDatabaseList() 
96     { return null; }
97     /// Returns the list of DicomDatabase open (const)
98     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
99     { return null; }
100
101         protected:
102         ///Opens an existing database, or else, creates a local database.
103     virtual void OpenOrNewDatabase(bool open){ return; }
104         ///Shows the help
105         virtual void ShowHelp();
106
107         private:
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; }
112
113
114         //====================================================================
115     // Preview Display Related
116         //====================================================================
117
118
119     ///Shows the image sent as a parameter
120         private:
121          virtual void ShowImage(vtkImageData* image){ return; }
122
123         //====================================================================
124     // Favorites Related
125         //====================================================================
126
127
128         public:
129         ///Loads or creates a favorites database
130     virtual void LoadOrCreateFavoritesDatabase(){ return; }
131         private:
132         ///Creates the user settings directory
133     void CreateUserSettingsDirectory(){ return; }
134         ///Obtains the user settings directory
135         const std::string& GetUserSettingsDirectory(){ return null; }
136
137         //====================================================================  
138         // Attribute Display Related
139         //====================================================================
140
141
142         ///Shows the Information regarding the node sent as a parameter
143         private:
144      virtual void ShowInformation(DicomNode*){ return; }
145    
146         //====================================================================
147     // Tree Display Related
148     //====================================================================
149
150         protected:
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; }
163     
164         private:
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;
171
172
173         //====================================================================
174     // Class Attributes
175     //====================================================================
176
177         
178         int mSelectionType;
179     int mSelectionMaxImageDimension;
180     int mCurrentSelectionImageSize[4];
181
182         ///Existent Database List
183     DicomDatabaseListType mDicomDatabaseList;
184         ///Favorites database
185     DicomDatabase* mFavoriteDatabase;
186
187         ///Path to the database list file
188     std::string mDatabaseListFile;
189         ///Extension of the database
190     std::string mDatabaseExtension;
191
192     bool mJustStarted;
193
194     int  mFirstDicomDatabaseIconIndex;
195
196    // Previewer
197     vtkImageViewer2* mViewer;
198     
199     int mx1,mx2,my1,my2,mz1,mz2;
200     double mspx,mspy,mspz;
201   
202     // Image preview :
203     // Multi-thread image reader
204     MultiThreadImageReader mReader;
205     // map of images name to node
206     std::map<std::string,DicomNode*> mImageFileNameToNode;
207   */
208  
209 } // EO namespace creaImageIO
210
211 // EOF
212 #endif