]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h
RaC Changes that includes a Polygon contour in creaMaracasVisu and creaContours
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / KernelManagerContour.h
1 #ifndef __KERNELMANAGERCONTOUR__
2 #define __KERNELMANAGERCONTOUR__
3
4
5
6 //------------------------------------------------------------------------------------------------------------
7 // Includes
8 //------------------------------------------------------------------------------------------------------------
9 //#include "ImageSourceThing.h"
10 //#include "ImageSectionThing.h"
11 //#include "AxeThing.h"
12 //#include "ContourThing.h"
13 #include "OutlineModelManager.h"
14 #include "OutlineModelBuilder.h"
15 #include "time.h"
16
17 #include "ContourPropagation.h"
18
19 #include "manualContourModel.h"
20 #include "manualContourModelCircle.h"
21 #include "manualContourModelLine.h"
22 #include "manualContourModelRoi.h"
23 #include "manualContourModelPolygon.h"
24
25 #include <vtkImageChangeInformation.h>
26
27 class KernelManagerContour{
28
29 //------------------------------------------------------------------------------------------------------------
30 // Constructors & Destructors
31 //------------------------------------------------------------------------------------------------------------
32 public:
33
34         /**
35         ** With this constructor the setVectImages and initialize environment must be called
36         **/
37         KernelManagerContour();
38         /**
39         **      If images are available before the construction of the kernelManager this method should be used
40         **      it sets the vector images and initializes the environment
41         **/
42         KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir);
43         ~KernelManagerContour();
44
45         std::vector<vtkImageData*> getVectImages();
46         void setVectImages(std::vector<vtkImageData*> vectimg);
47
48         /**
49         **      This method returns the source of the image data selected by the user.
50         */
51         vtkImageData* getSourceImage();
52
53         
54
55         void initializeEnvironment(std::string datadir);
56
57
58         /**
59         **      This methods connect the event in the class interfNewContourMenu with the world of the appli
60         **/     
61
62         std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
63         /////////////////////////////////
64
65         std::string intToString(int num);
66
67         std::vector<std::string> GetLstNameThingsStatic();
68
69         void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
70
71         std::vector<std::string> GetLstNameThings();
72
73         bool IsPartOfStaticList(std::string keyName );
74
75         void deleteCModel(std::string theKeyName);
76
77         void removeAllOutlines();
78
79         //void setInstance(theInstant);
80
81         std::vector<NameWrapper *> getActualInstantOutlines();
82
83         int getNamesWrappingSize();
84
85         std::string getNameWrapping(int i);
86
87         void setInstant(Instant* theInstant);
88         void setInstant(std::vector<int> vectInstant);
89         std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
90         
91         Instant * getCurrentInstant();
92
93         manualBaseModel* getOutlineByKeyName(std::string cloneName);
94
95         bool onRedo(std::string& filename);
96
97         bool onUndo(std::string& filename);
98
99         bool onUndoSaveFile(std::string& filename);
100
101         std::string saveState();
102
103         void changeContourOfManager(std::string keyName, Instant *instant);
104
105         void resetAppend();
106
107         std::string onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants);
108
109         void getMaxMinZ(double *minZ,double *maxZ);
110
111         manualBaseModel* GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector);
112
113         //
114         // Method which creates the model associated with the type in parameter. The possible contour types are:
115         // 0-spline
116         // 1-spline
117         // 2-rectangle
118         // 3-circle
119         // 4-BullEye
120         // 5-BullEyeSector
121         // 6-Line
122         // 7-Points
123         // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
124         // @param typeContour - int
125         // @return manualBaseModel - Model created based on the type
126         manualBaseModel* factoryManualContourModel(int typeContour);
127
128         void CalculeSplinePropagation();
129
130         std::vector<std::string> getOutlinesNameAtInstant(std::vector<int> tempvector);
131
132         std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
133
134         std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
135
136         
137         void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
138
139         vtkImageData* getImageAtInstant(std::vector<int> inst);
140         
141 //------------------------------------------------------------------------------------------------------------
142 // Constants
143 //------------------------------------------------------------------------------------------------------------
144
145         void setCurrentFileName(std::string filenam);
146         std::string getCurrentFileName();
147 private:        
148 //------------------------------------------------------------------------------------------------------------
149 // Attributes
150 //------------------------------------------------------------------------------------------------------------
151         std::vector<vtkImageData*> vectimages;
152
153         ImageSourceThing                * imageSource;
154
155         //Instant * _actualInstant;
156 //Temporary attribute should be removed
157         OutlineModelManager             * modelManager;
158
159         std::string filename;
160
161         int inredo;
162         int inundo;
163         int _currentIndex;
164         std::string     stundoredo;
165
166         ContourPropagation* _contourPropagation;
167
168         bool isInitContourPropagation();
169
170         OutlineModelManager* getOutlineModelManager();
171 };
172 #endif