From 7dc7a00ebd0e9a30d2c992c0e439c2f7f7408e0f Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 22 Jun 2009 07:49:06 +0000 Subject: [PATCH] no message --- CMakeLists.txt | 2 +- install/CMakeLists.txt | 2 +- .../wxWindows/Contour/ContourExtractData.cxx | 50 ++++++++++++++++--- .../manualContourBaseControler.cpp | 1 + .../manualContour/manualViewBaseContour.cpp | 4 +- .../manualContour/manualViewBaseContour.h | 6 +-- .../wxWindows/widgets/vtkImageViewer2_XYZ.cxx | 5 +- .../widgets/vtkInfoTextImageInteractor.cxx | 22 ++++---- .../wxWindows/widgets/wxVtk3DBaseView.cxx | 6 ++- 9 files changed, 72 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8259fa4..94121a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/install/CMakeLists.txt b/install/CMakeLists.txt index c6e829b..6e0a1a8 100644 --- a/install/CMakeLists.txt +++ b/install/CMakeLists.txt @@ -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) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx index 8f98a10..4d7c69a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx @@ -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=y1)&&(yy2)&&(y<=y1)&&(y>y2)) ) { if (y1xx2)&&(x<(xx1-d))) ) { result++; } - } // if + if ( (xx1xx2)&&(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 *pLstValue, GetMinMaxPoint_Of_LstManConMod(minPoint,maxPoint); - for (j=minPoint[1]; jGetManualContourModel()->SetCloseContour(true); MouseClickRight(X,Y); } return true; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp index 1f7e376..bd08c92 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp @@ -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; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h index 799f424..65a8b82 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx index 875a817..dc98f55 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx @@ -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() diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx index 45c33df..4c82218 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx @@ -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(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index 4af3bfd..e601235 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -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(); -- 2.45.1