]> Creatis software - creaMaracasVisu.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 22 Jun 2009 07:49:06 +0000 (07:49 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Mon, 22 Jun 2009 07:49:06 +0000 (07:49 +0000)
CMakeLists.txt
install/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx

index 8259fa4a03f8ee1fc6f2d17cee7ec93878ad53ff..94121a3575f17f613182fdae13c0f6ab8b6a4c73 100644 (file)
@@ -43,10 +43,10 @@ MARK_AS_ADVANCED(
   LIBRARY_OUTPUT_PATH
   )
 
+SUBDIRS(install)
 #SUBDIRS(appli)
 SUBDIRS(lib)
 SUBDIRS(bbtk)
-SUBDIRS(install)
 
 INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/data/Icons )
 
index c6e829b40d3f5a2f24b3fa6bc6071250dc5addd9..6e0a1a88bc5a768ebd7f7f06b81e66ba53e08ffb 100644 (file)
@@ -49,7 +49,7 @@ ENDFOREACH(iLST)
 
 #ELSE (BUILD_BBTK_PACKAGE_creaMaracasVisu)
 
-  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CreaTools\\\\creaMaracasVisu-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CreaTools/creaMaracasVisu-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
   IF(WIN32)
     SET(CMAKE_INSTALL_PREFIX C:/CreaTools/creaMaracasVisu)
   ENDIF(WIN32)
index 8f98a10d2de04ce53a557b174bcff35d3d15333f..4d7c69ab42994432e4888a4dc47ad4ec64a1ee42 100644 (file)
@@ -69,6 +69,10 @@ void ContourExtractData::GetMinMaxPoint(int *minPoint,
                if (x>maxPoint[0]){ maxPoint[0]=(int)x; }
                if (y>maxPoint[1]){ maxPoint[1]=(int)y; }
        }
+       minPoint[0]--;
+       minPoint[1]--;
+       maxPoint[0]++;
+       maxPoint[1]++;
 //------------------------------------------------------------------------------------------------------
 }
 
@@ -91,6 +95,7 @@ int ContourExtractData::AnalisisContourInside(int x,
                                            manualContourModel *manualcontourmodel
                                            )
 {
+       bool inBorder=false;
        int result      = 0;
        int i;
        //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
@@ -98,8 +103,8 @@ int ContourExtractData::AnalisisContourInside(int x,
 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
        int nps = manualcontourmodel->GetNumberOfPointsSpline(); // number of points in the spline
-       //double x1,y1,z1,x2,y2,z2,t;
        double x1,y1,z1,x2,y2,z2;
+       double borderX, borderY;
        double xx1, yy1,xx2, yy2;
        //double delta=( double ) ( np  ) / ( double ) ( nps  );
        manualcontourmodel->UpdateSpline();
@@ -109,26 +114,55 @@ int ContourExtractData::AnalisisContourInside(int x,
 //     if (np>=2)
 //     {
 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
-               nps--;
+//             nps--;
                //manualcontourmodel->GetSplinePoint(0,x1,y1,z1);
                manualcontourmodel->GetSpline_i_Point(0,&x1,&y1,&z1);
+           x1=x1+0.5; y1=y1+0.5;
                for (i=1; i<=nps; i++)
                {
+                       borderX=x1;
+                       borderY=y1;
+                       
                        ok=false;
                        //t= delta * (double)(i%nps);
                        //manualcontourmodel->GetSplinePoint(t,x2,y2,z2);
                        manualcontourmodel->GetSpline_i_Point(i,&x2,&y2,&z2);
+                       x2=x2+0.5; y2=y2+0.5;
 //------------------------------------------------------------------------------------------------------
+                                                                       
                        //by triangle similarity
                        if ( ((y1<y2)&&(y>=y1)&&(y<y2)) || ((y1>y2)&&(y<=y1)&&(y>y2)) )
                        {
                                if (y1<y2) { xx1=x1; yy1=y1; xx2=x2; yy2=y2;} else { xx1=x2; yy1=y2; xx2=x1; yy2=y1; } 
                                d = ( fabs(xx2-xx1)*(y-yy1) ) / (yy2-yy1) ;
-                               if (  ((xx1<xx2)&&(x<(xx1+d)))  ||  ((xx1>xx2)&&(x<(xx1-d)))  ) { result++; }
-                       } // if
+                               if ( (xx1<xx2)&&(x<(xx1+d)) )   
+                               { 
+                                       result++; 
+                                       borderX=xx1+d;
+                                       borderY=y;
+                               } 
+                               if ( (xx1>xx2)&&(x<(xx1-d)) )  { 
+                                       result++; 
+                                       borderX=xx1-d;
+                                       borderY=y;
+                               } 
+                       } // if point inside contour 
+                       
+                       
+                       //Border verication
+                       if (   (x==(int)borderX) && (y==(int)borderY)   )  
+                       { 
+                               inBorder=true;
+                               i=nps;
+                       }// if point in border
+                       
                        x1=x2; y1=y2; z1=z2;
+                       
                } // for i
 //     } //if
+       
+       if (inBorder==true)     { result=1;     }
+       
        return result;
 }
 
@@ -311,9 +345,9 @@ void ContourExtractData::CalculateImageResult()
                maxPoint[1] = -999999;
 
                GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
-               for (j=minPoint[1]; j<maxPoint[1]; j++)
+               for (j=minPoint[1]; j<=maxPoint[1]; j++)
                {
-                       for (i=minPoint[0]; i<maxPoint[0]; i++)
+                       for (i=minPoint[0]; i<=maxPoint[0]; i++)
                        {
                                if (isInside(i,j,_typeOperation)==true)
                                {
@@ -360,9 +394,9 @@ void ContourExtractData::GetValuesInsideCrown(std::vector<double> *pLstValue,
        GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint);
 
 
-       for (j=minPoint[1]; j<maxPoint[1]; j++)
+       for (j=minPoint[1]; j<=maxPoint[1]; j++)
        {
-               for (i=minPoint[0]; i<maxPoint[0]; i++)
+               for (i=minPoint[0]; i<=maxPoint[0]; i++)
                {
                        if (isInside(i,j,_typeOperation)==true)
                        {
index 24c974bf7d91a7027627295cad099b41627d9559..5b610808e24e1b2dec9c3ffdc92bb726488b699a 100644 (file)
@@ -226,6 +226,7 @@ bool manualContourBaseControler::OnRightButtonDown()
 
                SetCompleteCreation( true );
                SetKeyBoardMoving( false );
+               this->GetManualContourModel()->SetCloseContour(true);
                MouseClickRight(X,Y);
        }
        return true;
index 1f7e3768678e72bbe768b65e664ec97d74cda82e..bd08c9298ec887897c26c0698aab9f26eb996dfc 100644 (file)
@@ -733,12 +733,12 @@ void manualViewBaseContour::TransfromCoordViewWorld(double &X, double &Y, double
 
 }
 // ----------------------------------------------------------------------------
-void manualViewBaseContour::SetRange(int range)
+void manualViewBaseContour::SetRange(double range)
 {
        _range=range;
 }
 // ----------------------------------------------------------------------------
-int    manualViewBaseContour::GetRange()
+double manualViewBaseContour::GetRange()
 {
        return _range;
 }
index 799f424729f8053d3b86ece892ab36914f1d9ca3..65a8b825c80b8f9b8dfc4db3bd4ff7fcc2f74c38 100644 (file)
@@ -111,8 +111,8 @@ public:
        virtual bool    ifTouchContour(int x,int y, int z);
        void    UpdateColorActor();
 
-       void    SetRange(int range);
-       int             GetRange();
+       void    SetRange(double range);
+       double          GetRange();
        void    SetZ(int z);
        int             GetZ();
 
@@ -159,7 +159,7 @@ public:
        virtual void                    ConstructVTKObjects();
 
 private:
-       int                                                             _range;
+       double                                                          _range;
 
        wxVtkBaseView                                   *_wxvtkbaseview;
        bool                                                    _selected;
index 875a817686739817aed67d49ed4792f6696e7768..dc98f557912409b647c4e9043269ffd8acc35c7a 100644 (file)
@@ -1,5 +1,5 @@
 #include "vtkImageViewer2_XYZ.h"
-
+#include "vtkRenderer.h"
 #include "vtkImageActor.h"
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
@@ -7,6 +7,9 @@
 vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
 {
        _vtkimageviewer2=  vtkImageViewer2::New();
+       _vtkimageviewer2->GetRenderer()->GradientBackgroundOn();
+       _vtkimageviewer2->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
+       _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
 }
 //-------------------------------------------------------------------
 vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
index 45c33dfda17deef7d4a9f499a8d0a93c14959031..4c82218a81b93af437b8d9dc1435f34583e9dd1f 100644 (file)
@@ -33,14 +33,15 @@ bool vtkInfoTextImageInteractor::OnMouseMove()
        /*JCP 14/05/2009
         * int z = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetVtkBaseData()->GetZ());*/
        
-       double xx,yy,zz;
+       double dxx,dyy,dzz;
+       double ixx,iyy,izz;
 
                int z = (int)((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetZ();
-               xx=X;
-               yy=Y;
-               zz=z;
+               dxx=X;
+               dyy=Y;
+               dzz=z;
        
-       _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransFromCoordScreenToWorld(xx,yy,zz,true);
+       _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransFromCoordScreenToWorld(dxx,dyy,dzz,true);
 
        
        GetVtkInfoTextImage()->PutWindowLevel();
@@ -49,10 +50,13 @@ bool vtkInfoTextImageInteractor::OnMouseMove()
        int tempext[6];
        ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData()->GetExtent(tempext);
 
-       if(tempext[0] <= xx && xx <= tempext[1] && tempext[2] <= yy && yy <= tempext[3]){
-
-               GetVtkInfoTextImage()->PutPosition( (int)xx , (int)yy , (int)zz );
-               GetVtkInfoTextImage()->PutPixelIntensity( (int)xx , (int)yy , (int)zz );
+       if(tempext[0] <= dxx && dxx <= tempext[1] && tempext[2] <= dyy && dyy <= tempext[3])
+       {
+               ixx=(int)(dxx+0.5);
+               iyy=(int)(dyy+0.5);
+               izz=(int)(dzz+0.0);
+               GetVtkInfoTextImage()->PutPosition( ixx , iyy , izz );
+               GetVtkInfoTextImage()->PutPixelIntensity( ixx , iyy , izz );
        }
 
        this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
index 4af3bfd28f614fc45f25784088748d0fe461d519..e601235c1bd8365c71b97f8b75ada2c789334f05 100644 (file)
@@ -51,7 +51,11 @@ void wxVtk3DBaseView::Configure()
                _renWin         = vtkRenderWindow::New();
                _renWin->AddRenderer(_aRenderer);
 
-
+               _aRenderer->GradientBackgroundOn();
+               _aRenderer->SetBackground( 0.33 , 0.33 , 0.33 );
+               _aRenderer->SetBackground2( 0.66 , 0.66 , 0.66 );
+               
+               
 //       _renWin->SetStereoCapableWindow(1);
 // //      //renderwindow->SetStereoTypeToCrystalEyes();  
 //       _renWin->SetStereoTypeToRedBlue();