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 "manualRotationToolControler.h"
28 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 // _state = 0 // ..nothing..
33 // _state = 5 // move point
34 // _state = 6 // move all
35 // _state = 7 // Empty mouse drag
37 manualRotationToolControler::manualRotationToolControler()
42 // ----------------------------------------------------------------------------
43 manualRotationToolControler::~manualRotationToolControler()
48 // ----------------------------------------------------------------------------
49 manualRotationToolControler * manualRotationToolControler :: Clone() // virtual
51 manualRotationToolControler * clone = new manualRotationToolControler();
52 CopyAttributesTo(clone);
56 // ---------------------------------------------------------------------------
57 void manualRotationToolControler::CopyAttributesTo( manualRotationToolControler * cloneObject)
60 manualContourBaseControler::CopyAttributesTo(cloneObject);
63 // ----------------------------------------------------------------------------
64 void manualRotationToolControler::Configure() //virtual
69 // ----------------------------------------------------------------------------
70 void manualRotationToolControler::MouseClickLeft(int x, int y)
75 { // move control point
76 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
77 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
83 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
84 GetManualViewBaseContour()->InitMove(x,y,z);
88 // firstime create 3 control points and move one control point
89 int size=GetManualViewBaseContour()->GetNumberOfPoints();
94 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
100 GetManualViewBaseContour()->Refresh();
103 // ----------------------------------------------------------------------------
104 void manualRotationToolControler::MouseMove(int x, int y) // virtual
108 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
109 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
111 if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
112 if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
115 GetManualViewBaseContour()->MoveContour(x,y,z);
117 GetManualViewBaseContour()->Refresh();
120 // ----------------------------------------------------------------------------
121 void manualRotationToolControler::DeleteActualMousePoint(int x, int y) // virtual
125 // ----------------------------------------------------------------------------
126 void manualRotationToolControler::InitRoi(int ww, int hh, double porcentage)
131 if (GetManualContourModel()->GetSizeLstPoints() ==0)
139 double pp1=porcentage;
140 double pp2=1-porcentage;
142 mp = GetManualContourModel()->GetManualPoint(2);
144 mp->SetPoint(ww*pp1,hh*pp1,zz);
146 mp = GetManualContourModel()->GetManualPoint(1);
148 cout << ww*pp2 <<hh*pp1 << zz<<endl;
149 mp->SetPoint(ww*pp2,hh*pp1,zz);
151 mp = GetManualContourModel()->GetManualPoint(0);
153 cout << ww*pp2 <<hh*pp2 << zz<<endl;
154 mp->SetPoint(ww*pp2,hh*pp2,zz);
156 GetManualViewBaseContour() ->UpdateViewPoint(0);
157 GetManualViewBaseContour() ->UpdateViewPoint(1);
158 GetManualViewBaseContour() ->UpdateViewPoint(2);
161 GetManualViewBaseContour()->Refresh();