]> Creatis software - creaImageIO.git/blob - src/OldcreaImageIOGimmickView.h
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / OldcreaImageIOGimmickView.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26 */
27
28 namespace creaImageIO
29 {
30         /**
31         * \ingroup View
32         */
33     //=====================================================================
34     
35     //=====================================================================
36     ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
37         class GimmickView
38     {
39     public:
40       /// Ctor
41       GimmickView();
42       /// Virtual destructor
43       virtual ~GimmickView();
44
45         //====================================================================
46         // General
47         //====================================================================
48
49     /// Returns the size of the current selection
50     virtual int GetSelectionSize() { return 0; } 
51     /// Returns true if there is a valid selection
52     virtual bool IsSelectionValid(){ return false; }
53     /// Returns the vector of full filenames of selected images
54     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
55     /// Returns the vector of images corresponding to selection
56     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
57     /// Returns the vector of DicomNode corresponding to selection
58     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
59    /// Returns the DicomNode corresponding to the tree item
60     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
61
62         
63         /// Type of list of DicomDatabase
64     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
65     /// Returns the list of DicomDatabase open
66     virtual DicomDatabaseListType& GetDicomDatabaseList() 
67     { return null; }
68     /// Returns the list of DicomDatabase open (const)
69     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
70     { return null; }
71
72         protected:
73         ///Opens an existing database, or else, creates a local database.
74     virtual void OpenOrNewDatabase(bool open){ return; }
75         ///Shows the help
76         virtual void ShowHelp();
77
78         private:
79         ///Gets the extension of the database
80         const std::string& GetDatabaseExtension() { return null; }
81         ///Sets the extension of the database
82     virtual void SetDatabaseExtension(const std::string& ext){ return; }
83
84
85         //====================================================================
86     // Preview Display Related
87         //====================================================================
88
89
90     ///Shows the image sent as a parameter
91         private:
92          virtual void ShowImage(vtkImageData* image){ return; }
93
94         //====================================================================
95     // Favorites Related
96         //====================================================================
97
98
99         public:
100         ///Loads or creates a favorites database
101     virtual void LoadOrCreateFavoritesDatabase(){ return; }
102         private:
103         ///Creates the user settings directory
104     void CreateUserSettingsDirectory(){ return; }
105         ///Obtains the user settings directory
106         const std::string& GetUserSettingsDirectory(){ return null; }
107
108         //====================================================================  
109         // Attribute Display Related
110         //====================================================================
111
112
113         ///Shows the Information regarding the node sent as a parameter
114         private:
115      virtual void ShowInformation(DicomNode*){ return; }
116    
117         //====================================================================
118     // Tree Display Related
119     //====================================================================
120
121         protected:
122     /// Completely rebuilds the view with 
123     /// current DicomDatabaseList
124     virtual void RebuildView(){ return; }
125         /// Recursively updates the part of the view corresponding 
126     /// to the DicomDatabase passed
127     /// i.e. creates items for the DicomNode which do not have
128     ///      deletes obsolete items (whose DicomNode has been deleted)
129     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
130     /// Recursively updates the part of the view corresponding 
131     /// to the DicomNode provided.
132     /// parent is its parent in the tree (where to insert / remove it)
133         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
134     
135         private:
136         ///Type definition of the data regarding the tree
137     typedef WxGimmickTreeItemData TreeItemData;
138         ///Gets the item data of the tree item passed as a parameter
139     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
140     ///Type definition of the data insid a node of the tree
141     typedef WxGimmickDicomNodeData NodeData;
142
143
144         //====================================================================
145     // Class Attributes
146     //====================================================================
147
148         
149         int mSelectionType;
150     int mSelectionMaxImageDimension;
151     int mCurrentSelectionImageSize[4];
152
153         ///Existent Database List
154     DicomDatabaseListType mDicomDatabaseList;
155         ///Favorites database
156     DicomDatabase* mFavoriteDatabase;
157
158         ///Path to the database list file
159     std::string mDatabaseListFile;
160         ///Extension of the database
161     std::string mDatabaseExtension;
162
163     bool mJustStarted;
164
165     int  mFirstDicomDatabaseIconIndex;
166
167    // Previewer
168     vtkImageViewer2* mViewer;
169     
170     int mx1,mx2,my1,my2,mz1,mz2;
171     double mspx,mspy,mspz;
172   
173     // Image preview :
174     // Multi-thread image reader
175     MultiThreadImageReader mReader;
176     // map of images name to node
177     std::map<std::string,DicomNode*> mImageFileNameToNode;
178   
179     //Controller which manages the interaction with the model
180         Gimmick* controller;
181
182     };
183     // EO class GimmickView
184     //=====================================================================
185   
186 } // EO namespace creaImageIO
187
188 // EOF
189 #endif