]> Creatis software - creaImageIO.git/blob - src2/creaImageIOGimmickView.h
f17fcb48e4cc6a53d6b23a6e987ab2018c2d0b1c
[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 <creaImageIOSystem.h>
7 //#include <map>
8 #include <vtkImageData.h>
9
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
14
15
16 namespace creaImageIO
17 {
18         /**
19         * \ingroup View
20         */
21     //=====================================================================
22     
23     //=====================================================================
24     ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
25         class GimmickView
26     {
27     public:
28       /// Ctor
29       GimmickView(Gimmick* );
30       /// Virtual destructor
31       virtual ~GimmickView();
32
33
34       /// Initializes the view : 
35       /// Creates the TreeViews for all the TreeHandler of the Controller
36       /// 
37       virtual void Initialize();
38
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;
42       
43       /// Returns the TreeViewMap (ref)
44       TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; }
45       /// Returns the TreeViewMap (const ref)
46       const TreeViewMapType& GetTreeViewMap() const
47       { return mTreeViewMap; }
48
49       /// Finalize 
50       virtual void Finalize();
51       
52       virtual void GetSelectedImages(std::vector<vtkImageData*>& s) {}
53       virtual void GetSelectedFiles(std::vector<std::string>& s) {}
54
55       /// Create the tree views 
56       void CreateTreeViews();
57
58       /// Create the tree view for TreeHandler provided
59       virtual void CreateTreeView( TreeHandler*) 
60       { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
61
62       /// Updates the TreeView of given name from level l to bottom
63       /// (calls the virtual method TreeView::UpdateLevel(l))
64       virtual void UpdateTreeViewLevel(const std::string&, int l);
65
66     private:
67       /// Controller which manages the interaction with the model
68       Gimmick* mGimmick;
69       /// The views 
70       TreeViewMapType mTreeViewMap;
71       
72     };
73     // EO class GimmickView
74     //=====================================================================
75   
76
77   /*
78
79
80
81
82
83
84
85
86         //====================================================================
87         // General
88         //====================================================================
89
90     /// Returns the size of the current selection
91     virtual int GetSelectionSize() { return 0; } 
92     /// Returns true if there is a valid selection
93     virtual bool IsSelectionValid(){ return false; }
94     /// Returns the vector of full filenames of selected images
95     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
96     /// Returns the vector of images corresponding to selection
97     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
98     /// Returns the vector of DicomNode corresponding to selection
99     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
100    /// Returns the DicomNode corresponding to the tree item
101     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
102
103         
104         /// Type of list of DicomDatabase
105     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
106     /// Returns the list of DicomDatabase open
107     virtual DicomDatabaseListType& GetDicomDatabaseList() 
108     { return null; }
109     /// Returns the list of DicomDatabase open (const)
110     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
111     { return null; }
112
113         protected:
114         ///Opens an existing database, or else, creates a local database.
115     virtual void OpenOrNewDatabase(bool open){ return; }
116         ///Shows the help
117         virtual void ShowHelp();
118
119         private:
120         ///Gets the extension of the database
121         const std::string& GetDatabaseExtension() { return null; }
122         ///Sets the extension of the database
123     virtual void SetDatabaseExtension(const std::string& ext){ return; }
124
125
126         //====================================================================
127     // Preview Display Related
128         //====================================================================
129
130
131     ///Shows the image sent as a parameter
132         private:
133          virtual void ShowImage(vtkImageData* image){ return; }
134
135         //====================================================================
136     // Favorites Related
137         //====================================================================
138
139
140         public:
141         ///Loads or creates a favorites database
142     virtual void LoadOrCreateFavoritesDatabase(){ return; }
143         private:
144         ///Creates the user settings directory
145     void CreateUserSettingsDirectory(){ return; }
146         ///Obtains the user settings directory
147         const std::string& GetUserSettingsDirectory(){ return null; }
148
149         //====================================================================  
150         // Attribute Display Related
151         //====================================================================
152
153
154         ///Shows the Information regarding the node sent as a parameter
155         private:
156      virtual void ShowInformation(DicomNode*){ return; }
157    
158         //====================================================================
159     // Tree Display Related
160     //====================================================================
161
162         protected:
163     /// Completely rebuilds the view with 
164     /// current DicomDatabaseList
165     virtual void RebuildView(){ return; }
166         /// Recursively updates the part of the view corresponding 
167     /// to the DicomDatabase passed
168     /// i.e. creates items for the DicomNode which do not have
169     ///      deletes obsolete items (whose DicomNode has been deleted)
170     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
171     /// Recursively updates the part of the view corresponding 
172     /// to the DicomNode provided.
173     /// parent is its parent in the tree (where to insert / remove it)
174         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
175     
176         private:
177         ///Type definition of the data regarding the tree
178     typedef WxGimmickTreeItemData TreeItemData;
179         ///Gets the item data of the tree item passed as a parameter
180     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
181     ///Type definition of the data insid a node of the tree
182     typedef WxGimmickDicomNodeData NodeData;
183
184
185         //====================================================================
186     // Class Attributes
187     //====================================================================
188
189         
190         int mSelectionType;
191     int mSelectionMaxImageDimension;
192     int mCurrentSelectionImageSize[4];
193
194         ///Existent Database List
195     DicomDatabaseListType mDicomDatabaseList;
196         ///Favorites database
197     DicomDatabase* mFavoriteDatabase;
198
199         ///Path to the database list file
200     std::string mDatabaseListFile;
201         ///Extension of the database
202     std::string mDatabaseExtension;
203
204     bool mJustStarted;
205
206     int  mFirstDicomDatabaseIconIndex;
207
208    // Previewer
209     vtkImageViewer2* mViewer;
210     
211     int mx1,mx2,my1,my2,mz1,mz2;
212     double mspx,mspy,mspz;
213   
214     // Image preview :
215     // Multi-thread image reader
216     MultiThreadImageReader mReader;
217     // map of images name to node
218     std::map<std::string,DicomNode*> mImageFileNameToNode;
219   */
220  
221 } // EO namespace creaImageIO
222
223 // EOF
224 #endif