]> 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 <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* h) { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
60
61     private:
62       /// Controller which manages the interaction with the model
63       Gimmick* mGimmick;
64       /// The views 
65       TreeViewMapType mTreeViewMap;
66       
67     };
68     // EO class GimmickView
69     //=====================================================================
70   
71
72   /*
73
74
75
76
77
78
79
80
81         //====================================================================
82         // General
83         //====================================================================
84
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);
97
98         
99         /// Type of list of DicomDatabase
100     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
101     /// Returns the list of DicomDatabase open
102     virtual DicomDatabaseListType& GetDicomDatabaseList() 
103     { return null; }
104     /// Returns the list of DicomDatabase open (const)
105     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
106     { return null; }
107
108         protected:
109         ///Opens an existing database, or else, creates a local database.
110     virtual void OpenOrNewDatabase(bool open){ return; }
111         ///Shows the help
112         virtual void ShowHelp();
113
114         private:
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; }
119
120
121         //====================================================================
122     // Preview Display Related
123         //====================================================================
124
125
126     ///Shows the image sent as a parameter
127         private:
128          virtual void ShowImage(vtkImageData* image){ return; }
129
130         //====================================================================
131     // Favorites Related
132         //====================================================================
133
134
135         public:
136         ///Loads or creates a favorites database
137     virtual void LoadOrCreateFavoritesDatabase(){ return; }
138         private:
139         ///Creates the user settings directory
140     void CreateUserSettingsDirectory(){ return; }
141         ///Obtains the user settings directory
142         const std::string& GetUserSettingsDirectory(){ return null; }
143
144         //====================================================================  
145         // Attribute Display Related
146         //====================================================================
147
148
149         ///Shows the Information regarding the node sent as a parameter
150         private:
151      virtual void ShowInformation(DicomNode*){ return; }
152    
153         //====================================================================
154     // Tree Display Related
155     //====================================================================
156
157         protected:
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; }
170     
171         private:
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;
178
179
180         //====================================================================
181     // Class Attributes
182     //====================================================================
183
184         
185         int mSelectionType;
186     int mSelectionMaxImageDimension;
187     int mCurrentSelectionImageSize[4];
188
189         ///Existent Database List
190     DicomDatabaseListType mDicomDatabaseList;
191         ///Favorites database
192     DicomDatabase* mFavoriteDatabase;
193
194         ///Path to the database list file
195     std::string mDatabaseListFile;
196         ///Extension of the database
197     std::string mDatabaseExtension;
198
199     bool mJustStarted;
200
201     int  mFirstDicomDatabaseIconIndex;
202
203    // Previewer
204     vtkImageViewer2* mViewer;
205     
206     int mx1,mx2,my1,my2,mz1,mz2;
207     double mspx,mspy,mspz;
208   
209     // Image preview :
210     // Multi-thread image reader
211     MultiThreadImageReader mReader;
212     // map of images name to node
213     std::map<std::string,DicomNode*> mImageFileNameToNode;
214   */
215  
216 } // EO namespace creaImageIO
217
218 // EOF
219 #endif