creaContours_lib
KernelManagerContour.h
Go to the documentation of this file.
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 # pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
15 #
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
20 # liability.
21 #
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25 
26 #ifndef __KERNELMANAGERCONTOUR__
27 #define __KERNELMANAGERCONTOUR__
28 
29 
30 
31 //------------------------------------------------------------------------------------------------------------
32 // Includes
33 //------------------------------------------------------------------------------------------------------------
34 //#include "ImageSourceThing.h"
35 //#include "ImageSectionThing.h"
36 //#include "AxeThing.h"
37 //#include "ContourThing.h"
38 #include "OutlineModelManager.h"
39 #include "OutlineModelBuilder.h"
40 #include "time.h"
41 #ifdef ParserOsirix_BUILD
42 #include "OsirixParser.h"
43 #endif
44 #include "ContourPropagation.h"
45 
46 #include "manualContourModel.h"
47 #include "manualContourModelCircle.h"
48 #include "manualContourModelLine.h"
49 #include "manualContourModelRoi.h"
50 #include "manualContourModelPolygon.h"
51 
52 #include <vtkImageChangeInformation.h>
53 
55 
56 //------------------------------------------------------------------------------------------------------------
57 // Constructors & Destructors
58 //------------------------------------------------------------------------------------------------------------
59 public:
60 
69  KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir);
71 
72  std::vector<vtkImageData*> getVectImages();
73  void setVectImages(std::vector<vtkImageData*> vectimg);
74 
75  void GetSpacing(double *vecspc, int iImage);
76 
77 
81  vtkImageData* getSourceImage();
82 
83 
84 
85  void initializeEnvironment(std::string datadir);
86 
87 
92  std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
94 
95  std::string intToString(int num);
96 
97  std::vector<std::string> GetLstNameThingsStatic();
98 
99  void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
100 
101  std::vector<std::string> GetLstNameThings();
102 
103  bool IsPartOfStaticList(std::string keyName );
104 
105  void deleteCModel(std::string theKeyName);
106 
107  void removeAllOutlines();
108 
109  //void setInstance(theInstant);
110 
111  std::vector<NameWrapper *> getActualInstantOutlines();
112 
113  int getNamesWrappingSize();
114 
115  std::string getNameWrapping(int i);
116 
117  void setInstant(Instant* theInstant);
118  void setInstant(std::vector<int> vectInstant);
119  std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
120 
121  Instant * getCurrentInstant();
122 
123  manualBaseModel* getOutlineByKeyName(std::string cloneName);
124 
125  bool onRedo(std::string& filename);
126 
127  bool onUndo(std::string& filename);
128 
129  bool onUndoSaveFile(std::string& filename);
130 
131  std::string saveState();
132 
133  void changeContourOfManager(std::string keyName, Instant *instant);
134 
135  void resetAppend();
136 
137  std::string onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants);
138 
139  void getMaxMinZ(double *minZ,double *maxZ);
140 
141  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);
142 
143  //
144  // Method which creates the model associated with the type in parameter. The possible contour types are:
145  // 0-spline
146  // 1-spline
147  // 2-rectangle
148  // 3-circle
149  // 4-BullEye
150  // 5-BullEyeSector
151  // 6-Line
152  // 7-Points
153  // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
154  // @param typeContour - int
155  // @return manualBaseModel - Model created based on the type
156  manualBaseModel* factoryManualContourModel(int typeContour);
157 
159 
160  std::vector<std::string> getOutlinesNameAtInstant(std::vector<int> tempvector);
161 
162  std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
163 
164  std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
165 
166 
167  void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
168 
169  vtkImageData* getImageAtInstant(std::vector<int> inst);
170 
171 //------------------------------------------------------------------------------------------------------------
172 // Constants
173 //------------------------------------------------------------------------------------------------------------
174 
175  void setCurrentFileName(std::string filenam);
176  std::string getCurrentFileName();
177 
178  std::string parseOsirixFile(std::string filename);
179 private:
180 //------------------------------------------------------------------------------------------------------------
181 // Attributes
182 //------------------------------------------------------------------------------------------------------------
183  std::vector<vtkImageData*> vectimages;
184  std::vector<std::vector<double> > vectimagesSpacing;
185 
187 
188  //Instant * _actualInstant;
189 //Temporary attribute should be removed
191 
192  std::string filename;
193 
194  int inredo;
195  int inundo;
197  std::string stundoredo;
198  std::string _datadir;
199 
200  ContourPropagation *_contourPropagation;
201 
203 };
204 #endif