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