]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h
Parser Osirix
[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         /**
51         **      This method returns the source of the image data selected by the user.
52         */
53         vtkImageData* getSourceImage();
54
55         
56
57         void initializeEnvironment(std::string datadir);
58
59
60         /**
61         **      This methods connect the event in the class interfNewContourMenu with the world of the appli
62         **/     
63
64         std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
65         /////////////////////////////////
66
67         std::string intToString(int num);
68
69         std::vector<std::string> GetLstNameThingsStatic();
70
71         void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
72
73         std::vector<std::string> GetLstNameThings();
74
75         bool IsPartOfStaticList(std::string keyName );
76
77         void deleteCModel(std::string theKeyName);
78
79         void removeAllOutlines();
80
81         //void setInstance(theInstant);
82
83         std::vector<NameWrapper *> getActualInstantOutlines();
84
85         int getNamesWrappingSize();
86
87         std::string getNameWrapping(int i);
88
89         void setInstant(Instant* theInstant);
90         void setInstant(std::vector<int> vectInstant);
91         std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
92         
93         Instant * getCurrentInstant();
94
95         manualBaseModel* getOutlineByKeyName(std::string cloneName);
96
97         bool onRedo(std::string& filename);
98
99         bool onUndo(std::string& filename);
100
101         bool onUndoSaveFile(std::string& filename);
102
103         std::string saveState();
104
105         void changeContourOfManager(std::string keyName, Instant *instant);
106
107         void resetAppend();
108
109         std::string onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants);
110
111         void getMaxMinZ(double *minZ,double *maxZ);
112
113         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);
114
115         //
116         // Method which creates the model associated with the type in parameter. The possible contour types are:
117         // 0-spline
118         // 1-spline
119         // 2-rectangle
120         // 3-circle
121         // 4-BullEye
122         // 5-BullEyeSector
123         // 6-Line
124         // 7-Points
125         // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
126         // @param typeContour - int
127         // @return manualBaseModel - Model created based on the type
128         manualBaseModel* factoryManualContourModel(int typeContour);
129
130         void CalculeSplinePropagation();
131
132         std::vector<std::string> getOutlinesNameAtInstant(std::vector<int> tempvector);
133
134         std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
135
136         std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
137
138         
139         void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
140
141         vtkImageData* getImageAtInstant(std::vector<int> inst);
142         
143 //------------------------------------------------------------------------------------------------------------
144 // Constants
145 //------------------------------------------------------------------------------------------------------------
146
147         void setCurrentFileName(std::string filenam);
148         std::string getCurrentFileName();
149
150         std::string parseOsirixFile(std::string filename);
151 private:        
152 //------------------------------------------------------------------------------------------------------------
153 // Attributes
154 //------------------------------------------------------------------------------------------------------------
155         std::vector<vtkImageData*> vectimages;
156
157         ImageSourceThing                * imageSource;
158
159         //Instant * _actualInstant;
160 //Temporary attribute should be removed
161         OutlineModelManager             * modelManager;
162
163         std::string filename;
164
165         int inredo;
166         int inundo;
167         int _currentIndex;
168         std::string     stundoredo;
169         std::string _datadir;
170
171         ContourPropagation* _contourPropagation;
172
173         bool isInitContourPropagation();
174
175         OutlineModelManager* getOutlineModelManager();
176 };
177 #endif