1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #include "creaContoursFactory.h"
28 #include "manualContourControler.h"
29 #include "manualCircleControler.h"
30 #include "manualContourModelCircle.h"
31 #include "manualViewCircle.h"
32 #include "manualLineControler.h"
33 #include "manualContourModelLine.h"
34 #include "manualViewLine.h"
35 #include "manualRoiControler.h"
36 #include "manualViewRoi.h"
37 #include "manualContourModelRoi.h"
38 #include "manualViewBullEye.h"
39 #include "manualContourModelBullEye.h"
40 #include "manualViewPoints.h"
41 #include "manualRotationToolControler.h"
42 #include "manualContourModelRotationTool.h"
43 #include "manualViewRotationTool.h"
44 #include "manualContourModelPolygon.h"
45 #include "manualView3DContour.h"
46 #include "manualContour3DControler.h"
47 #include "manualContour3V3DControler.h"
50 creaContoursFactory::creaContoursFactory()
56 creaContoursFactory::~creaContoursFactory()
61 manualContourBaseControler* creaContoursFactory::getContourControler(int typeContour)
63 manualContourBaseControler *manContourControl = NULL;
67 manContourControl = new manualContourControler();
73 manContourControl = new manualRoiControler();
79 manContourControl = new manualCircleControler();
85 manContourControl = new manualRoiControler();
91 manContourControl = new manualLineControler();
97 manContourControl = new manualContourControler();
103 manContourControl = new manualRotationToolControler();
109 manContourControl = new manualContourControler();
117 manContourControl = new manualContour3V3DControler();
120 return manContourControl;
124 manualContourBaseControler* creaContoursFactory::getContourControler(std::string typeContour)
126 manualContourBaseControler *manContourControl = NULL;
127 if (typeContour.compare("spline")==0)
129 manContourControl = getContourControler(1);
132 if (typeContour.compare("rectangle")==0)
134 manContourControl = getContourControler(2);
137 if (typeContour.compare("circle")==0)
139 manContourControl = getContourControler(3);
142 if (typeContour.compare("bullEye")==0)
144 manContourControl = getContourControler(4);
147 if (typeContour.compare("line")==0)
149 manContourControl = getContourControler(6);
152 if (typeContour.compare("points")==0)
154 manContourControl = getContourControler(7);
157 if (typeContour.compare("rotationTool")==0)
159 manContourControl = getContourControler(8);
162 if (typeContour.compare("polygon")==0)
164 manContourControl = getContourControler(10);
169 if(typeContour.compare("spline3D")==0)
171 manContourControl = getContourControler(12);
173 return manContourControl;
176 manualViewBaseContour* creaContoursFactory::getCountourView (int typeContour)
179 manualViewBaseContour *manViewerContour = NULL;
183 manViewerContour = new manualViewContour();
189 manViewerContour = new manualViewRoi();
195 manViewerContour = new manualViewCircle();
201 manViewerContour = new manualViewBullEye();
207 manViewerContour = new manualViewLine();
213 manViewerContour = new manualViewPoints();
219 manViewerContour = new manualViewRotationTool();
225 manViewerContour = new manualViewContour();
232 manViewerContour = new manualView3DContour();
234 return manViewerContour;
237 manualViewBaseContour* creaContoursFactory::getCountourView (std::string typeContour)
240 manualViewBaseContour *manViewerContour = NULL;
242 if (typeContour.compare("spline")==0)
244 manViewerContour = getCountourView(1);
247 if (typeContour.compare("rectangle")==0)
249 manViewerContour = getCountourView(2);
252 if (typeContour.compare("circle")==0)
254 manViewerContour = getCountourView(3);
257 if (typeContour.compare("bullEye")==0)
259 manViewerContour = getCountourView(4);
262 if (typeContour.compare("line")==0)
264 manViewerContour = getCountourView(6);
267 if (typeContour.compare("points")==0)
269 manViewerContour = getCountourView(7);
272 if (typeContour.compare("rotationTool")==0)
274 manViewerContour = getCountourView(8);
277 if (typeContour.compare("polygon")==0)
279 manViewerContour = getCountourView(10);
284 if (typeContour.compare("spline3D")==0)
286 manViewerContour = getCountourView(12);
289 return manViewerContour;
293 manualBaseModel* creaContoursFactory::getContourModel(int typeContour)
295 manualBaseModel *manModelContour=NULL;
300 manModelContour = new manualContourModel();
306 manModelContour = new manualContourModelRoi();
312 manModelContour = new manualContourModelCircle();
318 //Here we create a bullEye with 3 crowns and 5 sectors.
319 manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
321 int iCrown,sizeCrowns,iSector,sizeSectors;
322 double radioA,radioB,ang,angDelta,radioA2,radioB2 ;
328 for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
332 if (iCrown==sizeCrowns-1)
340 radioA2=radioA/100.0;
341 radioB2=radioB/100.0;
343 for ( iSector=0 ; iSector<sizeSectors ; iSector++ )
346 manModelContourBullEye->AddSector(radioA2,radioB2,ang,angDelta);
349 manModelContour = manModelContourBullEye;
355 manModelContour = new manualContourModelLine();
361 manModelContour = new manualBaseModel();
367 manModelContour = new manualContourModelRotationTool();
373 manModelContour = new manualContourModelPolygon();
381 manModelContour = new manualContourModel();
384 return manModelContour;
388 manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
390 manualBaseModel *manModelContour=NULL;
392 if (typeContour.compare("spline")==0)
394 manModelContour = getContourModel(1);
397 if (typeContour.compare("rectangle")==0)
399 manModelContour = getContourModel(2);
402 if (typeContour.compare("circle")==0)
404 manModelContour = getContourModel(3);
407 if (typeContour.compare("bullEye")==0)
409 manModelContour = getContourModel(4);
413 if (typeContour.compare("line")==0)
415 manModelContour = getContourModel(6);
418 if (typeContour.compare("points")==0)
420 manModelContour = getContourModel(7);
423 if (typeContour.compare("rotationTool")==0)
425 manModelContour = getContourModel(8);
428 if (typeContour.compare("polygon")==0)
430 manModelContour = getContourModel(10);
436 if (typeContour.compare("spline3D")==0)
438 manModelContour = getContourModel(12);
441 return manModelContour;