]> Creatis software - creaMaracasVisu.git/commitdiff
BUG manaualROIControler
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 23 Apr 2009 10:15:49 +0000 (10:15 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 23 Apr 2009 10:15:49 +0000 (10:15 +0000)
bbtk/src/bbmaracasvisuContourToControlPoints.cxx
bbtk/src/bbmaracasvisuViewerNV.cxx
lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx
lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/manualContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx

index 8fc411d68f7b0f0c4f33b73f85455b9d9884e48f..e75ffee08c1b4ff0c4a09a3efc6749ec60d51bda 100644 (file)
@@ -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()));
                        }
                }
 
index adb946ace3d3d3179c528b2d9f7c236ce1373496..9076438a2bc68c5c5e87969e7ca8724537ba73a9 100644 (file)
@@ -156,7 +156,7 @@ bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> 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;
                        }
index c17c1c5a2d0ac25939cb472ed0d3d6a79b443141..35936e10d1683b3bedefa39c0dce8fbdacc5f2ea 100644 (file)
@@ -322,7 +322,7 @@ void AutoControlPoints::InterCircle(std::vector<double>*InX, std::vector<double>
                _circleY.push_back(tempY[i]);
                m1 = Slope(tempX[i],tempY[i],cx,cy);//slope of the radius
                min = 9999;
-               for(j=0; j<InX->size(); 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
index 75fcb055afe354a62fed67924cf8ca971317bb15..bf826b1e92e54d599f558f44d0f27cf51003b645 100644 (file)
@@ -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; i<tempS.size(); i++)
+               for(i=0; i<(int)(tempS.size()); i++)
                {
                        _InS.push_back(tempS[i]);
                }
index 1e211963c23697acf53f6bcb3ce1864e2a152d7f..7b424d2ad1660517757fc1e1661c14432f2db2f1 100644 (file)
@@ -1494,7 +1494,6 @@ void manualViewContour::RefreshContour() // virtual
     nps = _manContModel->GetNumberOfPointsSpline();
        //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; id<size; id++)
@@ -4164,12 +4159,11 @@ void manualContourControler::MouseClickLeft(int x, int y){
                        _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(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){
index f4b62dc8bcdbb2850c20a0a4cd527c8c591a0829..af5237eef693c168ea20adfc319ba9be67822f60 100644 (file)
@@ -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();
index b118cc36adaa38c9d2353d58efdd24f81729a423..806b3d9c3762e3f514b8c2459dd19d1d76815484 100644 (file)
@@ -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);