]> Creatis software - creaImageIO.git/blob - src/OldcreaImageIOGimmickView.h
3aa98acf92f9a58ff285c71543722b5f53b83808
[creaImageIO.git] / src / OldcreaImageIOGimmickView.h
1 namespace creaImageIO
2 {
3         /**
4         * \ingroup View
5         */
6     //=====================================================================
7     
8     //=====================================================================
9     ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
10         class GimmickView
11     {
12     public:
13       /// Ctor
14       GimmickView();
15       /// Virtual destructor
16       virtual ~GimmickView();
17
18         //====================================================================
19         // General
20         //====================================================================
21
22     /// Returns the size of the current selection
23     virtual int GetSelectionSize() { return 0; } 
24     /// Returns true if there is a valid selection
25     virtual bool IsSelectionValid(){ return false; }
26     /// Returns the vector of full filenames of selected images
27     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
28     /// Returns the vector of images corresponding to selection
29     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
30     /// Returns the vector of DicomNode corresponding to selection
31     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
32    /// Returns the DicomNode corresponding to the tree item
33     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
34
35         
36         /// Type of list of DicomDatabase
37     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
38     /// Returns the list of DicomDatabase open
39     virtual DicomDatabaseListType& GetDicomDatabaseList() 
40     { return null; }
41     /// Returns the list of DicomDatabase open (const)
42     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
43     { return null; }
44
45         protected:
46         ///Opens an existing database, or else, creates a local database.
47     virtual void OpenOrNewDatabase(bool open){ return; }
48         ///Shows the help
49         virtual void ShowHelp();
50
51         private:
52         ///Gets the extension of the database
53         const std::string& GetDatabaseExtension() { return null; }
54         ///Sets the extension of the database
55     virtual void SetDatabaseExtension(const std::string& ext){ return; }
56
57
58         //====================================================================
59     // Preview Display Related
60         //====================================================================
61
62
63     ///Shows the image sent as a parameter
64         private:
65          virtual void ShowImage(vtkImageData* image){ return; }
66
67         //====================================================================
68     // Favorites Related
69         //====================================================================
70
71
72         public:
73         ///Loads or creates a favorites database
74     virtual void LoadOrCreateFavoritesDatabase(){ return; }
75         private:
76         ///Creates the user settings directory
77     void CreateUserSettingsDirectory(){ return; }
78         ///Obtains the user settings directory
79         const std::string& GetUserSettingsDirectory(){ return null; }
80
81         //====================================================================  
82         // Attribute Display Related
83         //====================================================================
84
85
86         ///Shows the Information regarding the node sent as a parameter
87         private:
88      virtual void ShowInformation(DicomNode*){ return; }
89    
90         //====================================================================
91     // Tree Display Related
92     //====================================================================
93
94         protected:
95     /// Completely rebuilds the view with 
96     /// current DicomDatabaseList
97     virtual void RebuildView(){ return; }
98         /// Recursively updates the part of the view corresponding 
99     /// to the DicomDatabase passed
100     /// i.e. creates items for the DicomNode which do not have
101     ///      deletes obsolete items (whose DicomNode has been deleted)
102     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
103     /// Recursively updates the part of the view corresponding 
104     /// to the DicomNode provided.
105     /// parent is its parent in the tree (where to insert / remove it)
106         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
107     
108         private:
109         ///Type definition of the data regarding the tree
110     typedef WxGimmickTreeItemData TreeItemData;
111         ///Gets the item data of the tree item passed as a parameter
112     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
113     ///Type definition of the data insid a node of the tree
114     typedef WxGimmickDicomNodeData NodeData;
115
116
117         //====================================================================
118     // Class Attributes
119     //====================================================================
120
121         
122         int mSelectionType;
123     int mSelectionMaxImageDimension;
124     int mCurrentSelectionImageSize[4];
125
126         ///Existent Database List
127     DicomDatabaseListType mDicomDatabaseList;
128         ///Favorites database
129     DicomDatabase* mFavoriteDatabase;
130
131         ///Path to the database list file
132     std::string mDatabaseListFile;
133         ///Extension of the database
134     std::string mDatabaseExtension;
135
136     bool mJustStarted;
137
138     int  mFirstDicomDatabaseIconIndex;
139
140    // Previewer
141     vtkImageViewer2* mViewer;
142     
143     int mx1,mx2,my1,my2,mz1,mz2;
144     double mspx,mspy,mspz;
145   
146     // Image preview :
147     // Multi-thread image reader
148     MultiThreadImageReader mReader;
149     // map of images name to node
150     std::map<std::string,DicomNode*> mImageFileNameToNode;
151   
152     //Controller which manages the interaction with the model
153         Gimmick* controller;
154
155     };
156     // EO class GimmickView
157     //=====================================================================
158   
159 } // EO namespace creaImageIO
160
161 // EOF
162 #endif