From 056a8fc3fb4917c574fda1495388bc8d04be3318 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Thu, 23 Apr 2009 10:15:49 +0000 Subject: [PATCH] BUG manaualROIControler --- .../bbmaracasvisuContourToControlPoints.cxx | 2 +- bbtk/src/bbmaracasvisuViewerNV.cxx | 2 +- .../wxWindows/Contour/AutoControlPoints.cxx | 2 +- .../wxWindows/Contour/ContourPropagation.cxx | 8 +- .../src/interface/wxWindows/manualContour.cpp | 90 +++++++++---------- .../src/interface/wxWindows/manualContour.h | 10 +-- .../wxWindows/widgets/wxMPRWidget.cxx | 6 +- 7 files changed, 52 insertions(+), 68 deletions(-) diff --git a/bbtk/src/bbmaracasvisuContourToControlPoints.cxx b/bbtk/src/bbmaracasvisuContourToControlPoints.cxx index 8fc411d..e75ffee 100644 --- a/bbtk/src/bbmaracasvisuContourToControlPoints.cxx +++ b/bbtk/src/bbmaracasvisuContourToControlPoints.cxx @@ -104,7 +104,7 @@ void ContourToControlPoints::Process() _contprop->appendContour(&KeyContourX,&KeyContourY,&KeyContourZ); //_contprop->GetContour(bbGetInputSlice(),&OutContourX,&OutContourY,&OutContourZ); _contprop->GetControlPoints(bbGetInputSlice(),&OutContourX,&OutContourY,&OutContourZ); - printf("\n Size OutContourX = %d",OutContourX.size()); + printf("\n Size OutContourX = %d",(int)(OutContourX.size())); } } diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index adb946a..9076438 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -156,7 +156,7 @@ bool ViewerNV::compareVectors(std::vector type,std::vector currenttype bool ret = true; if(type.size()==currenttype.size()){ - for(int i = 0; i < type.size() && ret; i++){ + for(int i = 0; i < (int)(type.size()) && ret; i++){ if(type[i]!=currenttype[i]){ ret = false; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx index c17c1c5..35936e1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx @@ -322,7 +322,7 @@ void AutoControlPoints::InterCircle(std::vector*InX, std::vector _circleY.push_back(tempY[i]); m1 = Slope(tempX[i],tempY[i],cx,cy);//slope of the radius min = 9999; - for(j=0; jsize(); j++) + for(j=0; j<(int)(InX->size()); j++) { jj = (j+1)%(InX->size()); m2 = Slope((*InX)[j],(*InY)[j],(*InX)[jj],(*InY)[jj]);//Slope of the vector between the adjacent points diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx index 75fcb05..bf826b1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx @@ -119,7 +119,7 @@ bool ContourPropagation::mustOrderAppend() { //ASCENDING j=0; - for(i=0; i<_InS.size()-1; i++) + for(i=0; i<(int)(_InS.size())-1; i++) { if(_InZ[j]>_InZ[j+_InS[i]]) { @@ -131,7 +131,7 @@ bool ContourPropagation::mustOrderAppend() if(orderA == false) { j=0; - for(i=0; i<_InS.size()-1; i++) + for(i=0; i<(int)(_InS.size())-1; i++) { if(_InZ[j]<_InZ[j+_InS[i]]) { @@ -175,7 +175,7 @@ void ContourPropagation::orderAppend() tempZ.clear(); tempS.clear(); cont = 0; - for(i=0; i<_InS.size()-1; i++) + for(i=0; i<(int)(_InS.size())-1; i++) { if(_InZ[cont]<_InZ[cont+_InS[i]]) { @@ -221,7 +221,7 @@ void ContourPropagation::orderAppend() vf->copyVector(&tempY,&_InY); vf->copyVector(&tempZ,&_InZ); delete vf; - for(i=0; iGetNumberOfPointsSpline(); //delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08 -//printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps); if ( _pts!=NULL ) { @@ -1510,10 +1509,6 @@ void manualViewContour::RefreshContour() // virtual // EED 27 sep 2006 // _pts->SetPoint(i, x,y,z ); _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] ); -//if (i%15==0) -//{ -// printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z); -//} }// for @@ -2258,7 +2253,7 @@ bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual { result=true; } - + return result; } @@ -2790,7 +2785,7 @@ void manualViewBaseContour :: RemoveControlPoints() SetIfViewControlPoints( false ); } // ---------------------------------------------------------------------------- -void manualViewBaseContour :: AddControlPoints() +void manualViewBaseContour::AddControlPoints() { vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer(); SetIfViewControlPoints( true ); @@ -2935,7 +2930,7 @@ void manualViewBaseContour::UpdateViewPoint(int id) // virtual } // ---------------------------------------------------------------------------- -void manualViewBaseContour :: UpdateViewPoints() +void manualViewBaseContour::UpdateViewPoints() { int id, size = _lstViewPoints.size(); for( id=0; idGetIdPoint(x,y,z); SetState(7); } - } - else - { + }else{ SetPosibleToMove( true ); GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() ); - } + } // IsEditable + if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() ) { SetMoving( true ); @@ -4439,16 +4433,22 @@ void manualRoiControler::Configure() //virtual void manualRoiControler::MouseClickLeft(int x, int y){ int z = GetZ(); - if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ - bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); - SetState(5); - } + + if( IsEditable() ) + { // move control point + if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ + bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); + SetState(5); + } + } // IsEditable + + // Move contour if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) { GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } - + // if the firs time create 4 control points and move one point int size=GetManualViewBaseContour()->GetNumberOfPoints(); if (GetState()==0) { if (size==0){ @@ -4489,6 +4489,7 @@ void manualRoiControler::MouseMove(int x, int y) // virtual // this->_vtkInteractorStyleBaseView-> + GetManualViewBaseContour()->SelectPosibleContour(x,y,z); GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); @@ -4637,14 +4638,22 @@ void manualCircleControler::Configure() //virtual // ---------------------------------------------------------------------------- void manualCircleControler::MouseClickLeft(int x, int y){ int z = GetZ(); - if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ - bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); - SetState(5); - } + + if( IsEditable() ) + { // move control point + if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ + bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); + SetState(5); + } + }// IsEditable + + // move contour if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) { GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } + + // firstime create 2 control points and move one control point int size=GetManualViewBaseContour()->GetNumberOfPoints(); if (GetState()==0) { if (size==0){ @@ -4676,7 +4685,6 @@ void manualCircleControler::MouseClickLeft(int x, int y){ void manualCircleControler::MouseMove(int x, int y) // virtual { int z=GetZ(); - // this->_vtkInteractorStyleBaseView-> GetManualViewBaseContour()->SelectPosibleContour(x,y,z); @@ -4684,29 +4692,6 @@ void manualCircleControler::MouseMove(int x, int y) // virtual if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); -/* - if (bakIdPoint==0) - { - SetPointX( 1 , x ); - SetPointY( 3 , y ); - } - if (bakIdPoint==1) - { - SetPointX( 0 , x ); - SetPointY( 2 , y ); - } - - if (bakIdPoint==2) - { - SetPointX( 3 , x ); - SetPointY( 1 , y ); - } - if (bakIdPoint==3) - { - SetPointX( 2 , x ); - SetPointY( 0 , y ); - } -*/ } if (GetState()==6){ GetManualViewBaseContour()->MoveContour(x,y,z); @@ -4830,15 +4815,22 @@ void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject) // ---------------------------------------------------------------------------- void manualLineControler::MouseClickLeft(int x, int y){ int z = GetZ(); - if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ - bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); - SetState(5); - } + + if( IsEditable() ) + { // move control point + if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){ + bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); + SetState(5); + } + } //IsEditable + + // move contour if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) { GetManualViewBaseContour()->InitMove(x,y,z); SetState(6); } + // fist time create 2 control points and move a control point int size=GetManualViewBaseContour()->GetNumberOfPoints(); if (GetState()==0) { if (size==0){ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/manualContour.h b/lib/maracasVisuLib/src/interface/wxWindows/manualContour.h index f4b62dc..af5237e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/manualContour.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/manualContour.h @@ -651,8 +651,6 @@ public: virtual manualViewCircle * Clone(); void CopyAttributesTo( manualViewCircle *cloneObject ); -// void RefreshContour(); -// virtual bool ifTouchContour(int x,int y, int z); virtual void InitMove(int x, int y, int z); virtual void MoveContour(int x, int y, int z); void GetMinMax(double &minX,double &minY, double &maxX, double &maxY); @@ -660,8 +658,6 @@ public: private: double _dp0[3]; double _dp1[3]; -// double _dp2[3]; -// double _dp3[3]; }; @@ -680,16 +676,12 @@ public: virtual manualViewLine * Clone(); void CopyAttributesTo( manualViewLine *cloneObject ); -// void RefreshContour(); -// virtual bool ifTouchContour(int x,int y, int z); virtual void InitMove(int x, int y, int z); virtual void MoveContour(int x, int y, int z); private: double _dp0[3]; double _dp1[3]; -// double _dp2[3]; -// double _dp3[3]; }; @@ -970,7 +962,7 @@ protected: // ---------------------------------------------------------------------------- -class creaMaracasVisu_EXPORT manualRoiControler: public manualContourBaseControler +class creaMaracasVisu_EXPORT manualRoiControler: public manualContourControler { public: manualRoiControler(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx index b118cc3..806b3d9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMPRWidget.cxx,v $ Language: C++ - Date: $Date: 2009/04/20 09:03:30 $ - Version: $Revision: 1.9 $ + Date: $Date: 2009/04/23 10:15:56 $ + Version: $Revision: 1.10 $ Copyright: (c) 2002, 2003 License: @@ -2166,7 +2166,7 @@ void wxVtkMPR2DView::Refresh() } if (_direction==1) { _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); - _ptsA->SetPoint(0, x1 , y2 , z ); + _ptsA->SetPoint(0, x1 , y2 , z ); _ptsA->SetPoint(1, x2 , y2 , z ); _ptsB->SetPoint(0, x , y2 , z1); _ptsB->SetPoint(1, x , y2 , z2); -- 2.46.2