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 printf("JPReyes %p creaContoursFactory::getContourControler pasando por el Contour 12 \n",this);
118 manContourControl = new manualContour3V3DControler();
121 return manContourControl;
125 manualContourBaseControler* creaContoursFactory::getContourControler(std::string typeContour)
127 manualContourBaseControler *manContourControl = NULL;
128 if (typeContour.compare("spline")==0)
130 manContourControl = getContourControler(1);
133 if (typeContour.compare("rectangle")==0)
135 manContourControl = getContourControler(2);
138 if (typeContour.compare("circle")==0)
140 manContourControl = getContourControler(3);
143 if (typeContour.compare("bullEye")==0)
145 manContourControl = getContourControler(4);
148 if (typeContour.compare("line")==0)
150 manContourControl = getContourControler(6);
153 if (typeContour.compare("points")==0)
155 manContourControl = getContourControler(7);
158 if (typeContour.compare("rotationTool")==0)
160 manContourControl = getContourControler(8);
163 if (typeContour.compare("polygon")==0)
165 manContourControl = getContourControler(10);
170 if(typeContour.compare("spline3D")==0)
172 manContourControl = getContourControler(12);
174 return manContourControl;
177 manualViewBaseContour* creaContoursFactory::getCountourView (int typeContour)
180 manualViewBaseContour *manViewerContour = NULL;
184 manViewerContour = new manualViewContour();
190 manViewerContour = new manualViewRoi();
196 manViewerContour = new manualViewCircle();
202 manViewerContour = new manualViewBullEye();
208 manViewerContour = new manualViewLine();
214 manViewerContour = new manualViewPoints();
220 manViewerContour = new manualViewRotationTool();
226 manViewerContour = new manualViewContour();
233 manViewerContour = new manualView3DContour();
235 return manViewerContour;
238 manualViewBaseContour* creaContoursFactory::getCountourView (std::string typeContour)
241 manualViewBaseContour *manViewerContour = NULL;
243 if (typeContour.compare("spline")==0)
245 manViewerContour = getCountourView(1);
248 if (typeContour.compare("rectangle")==0)
250 manViewerContour = getCountourView(2);
253 if (typeContour.compare("circle")==0)
255 manViewerContour = getCountourView(3);
258 if (typeContour.compare("bullEye")==0)
260 manViewerContour = getCountourView(4);
263 if (typeContour.compare("line")==0)
265 manViewerContour = getCountourView(6);
268 if (typeContour.compare("points")==0)
270 manViewerContour = getCountourView(7);
273 if (typeContour.compare("rotationTool")==0)
275 manViewerContour = getCountourView(8);
278 if (typeContour.compare("polygon")==0)
280 manViewerContour = getCountourView(10);
285 if (typeContour.compare("spline3D")==0)
287 manViewerContour = getCountourView(12);
290 return manViewerContour;
294 manualBaseModel* creaContoursFactory::getContourModel(int typeContour)
296 manualBaseModel *manModelContour=NULL;
301 manModelContour = new manualContourModel();
307 manModelContour = new manualContourModelRoi();
313 manModelContour = new manualContourModelCircle();
319 //Here we create a bullEye with 3 crowns and 5 sectors.
320 manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
322 int iCrown,sizeCrowns,iSector,sizeSectors;
323 double radioA,radioB,ang,angDelta,radioA2,radioB2 ;
329 for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
333 if (iCrown==sizeCrowns-1)
341 radioA2=radioA/100.0;
342 radioB2=radioB/100.0;
344 for ( iSector=0 ; iSector<sizeSectors ; iSector++ )
347 manModelContourBullEye->AddSector(radioA2,radioB2,ang,angDelta);
350 manModelContour = manModelContourBullEye;
356 manModelContour = new manualContourModelLine();
362 manModelContour = new manualBaseModel();
368 manModelContour = new manualContourModelRotationTool();
374 manModelContour = new manualContourModelPolygon();
382 manModelContour = new manualContourModel();
385 return manModelContour;
389 manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
391 manualBaseModel *manModelContour=NULL;
393 if (typeContour.compare("spline")==0)
395 manModelContour = getContourModel(1);
398 if (typeContour.compare("rectangle")==0)
400 manModelContour = getContourModel(2);
403 if (typeContour.compare("circle")==0)
405 manModelContour = getContourModel(3);
408 if (typeContour.compare("bullEye")==0)
410 manModelContour = getContourModel(4);
414 if (typeContour.compare("line")==0)
416 manModelContour = getContourModel(6);
419 if (typeContour.compare("points")==0)
421 manModelContour = getContourModel(7);
424 if (typeContour.compare("rotationTool")==0)
426 manModelContour = getContourModel(8);
429 if (typeContour.compare("polygon")==0)
431 manModelContour = getContourModel(10);
437 if (typeContour.compare("spline3D")==0)
439 manModelContour = getContourModel(12);
442 return manModelContour;