1 #include "manualRoiControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
7 // _state = 0 // ..nothing..
8 // _state = 5 // move point
9 // _state = 6 // move all
10 // _state = 7 // Empty mouse drag
12 manualRoiControler::manualRoiControler()
15 // ----------------------------------------------------------------------------
16 manualRoiControler::~manualRoiControler()
19 // ----------------------------------------------------------------------------
20 manualRoiControler * manualRoiControler :: Clone() // virtual
22 manualRoiControler * clone = new manualRoiControler();
23 CopyAttributesTo(clone);
27 // ---------------------------------------------------------------------------
28 void manualRoiControler::CopyAttributesTo( manualRoiControler * cloneObject)
31 manualContourBaseControler::CopyAttributesTo(cloneObject);
34 // ----------------------------------------------------------------------------
35 void manualRoiControler::Configure() //virtual
37 this->GetManualContourModel()->SetNumberOfPointsSpline(5);
40 // ----------------------------------------------------------------------------
42 void manualRoiControler::MouseClickLeft(int x, int y){
46 { // move control point
47 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
48 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
54 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
55 GetManualViewBaseContour()->InitMove(x,y,z);
59 // if the firs time create 4 control points and move one point
60 int size=GetManualViewBaseContour()->GetNumberOfPoints();
67 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
85 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
90 GetManualViewBaseContour()->Refresh();
93 // ----------------------------------------------------------------------------
94 void manualRoiControler::MouseMove(int x, int y) // virtual
98 // this->_vtkInteractorStyleBaseView->
101 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
102 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
105 if ( (GetState()==5) || (GetState()==1) ){
106 SetPoint( bakIdPoint , x , y ,z);
129 GetManualViewBaseContour()->MoveContour(x,y,z);
131 GetManualViewBaseContour()->Refresh();
133 // ----------------------------------------------------------------------------
134 void manualRoiControler::DeleteActualMousePoint(int x, int y) // virtual
137 // ----------------------------------------------------------------------------
138 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
143 if (GetManualContourModel()->GetSizeLstPoints() ==0)
152 double pp1=porcentage;
153 double pp2=1-porcentage;
155 mp = GetManualContourModel()->GetManualPoint(2);
157 mp->SetPoint(ww*pp1,hh*pp1,zz);
159 mp = GetManualContourModel()->GetManualPoint(1);
161 mp->SetPoint(ww*pp2,hh*pp1,zz);
163 mp = GetManualContourModel()->GetManualPoint(0);
165 mp->SetPoint(ww*pp2,hh*pp2,zz);
167 mp = GetManualContourModel()->GetManualPoint(3);
169 mp->SetPoint(ww*pp1,hh*pp2,zz);
171 GetManualViewBaseContour() ->UpdateViewPoint(0);
172 GetManualViewBaseContour() ->UpdateViewPoint(1);
173 GetManualViewBaseContour() ->UpdateViewPoint(2);
174 GetManualViewBaseContour() ->UpdateViewPoint(3);
177 GetManualViewBaseContour()->Refresh();
180 // ----------------------------------------------------------------------------
181 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
184 InitRoi( 0 , 0 , 0.2 );
185 mp = GetManualContourModel()->GetManualPoint(2);
189 mp = GetManualContourModel()->GetManualPoint(1);
193 mp = GetManualContourModel()->GetManualPoint(0);
197 mp = GetManualContourModel()->GetManualPoint(3);
201 GetManualViewBaseContour() ->UpdateViewPoint(0);
202 GetManualViewBaseContour() ->UpdateViewPoint(1);
203 GetManualViewBaseContour() ->UpdateViewPoint(2);
204 GetManualViewBaseContour() ->UpdateViewPoint(3);