if (x>maxPoint[0]){ maxPoint[0]=(int)x; }
if (y>maxPoint[1]){ maxPoint[1]=(int)y; }
}
+ minPoint[0]--;
+ minPoint[1]--;
+ maxPoint[0]++;
+ maxPoint[1]++;
//------------------------------------------------------------------------------------------------------
}
manualContourModel *manualcontourmodel
)
{
+ bool inBorder=false;
int result = 0;
int i;
//int np = manualcontourmodel->GetSizeLstPoints( ); // number of control points // JPRx
// 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();
// 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;
}
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)
{
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)
{
#include "vtkImageViewer2_XYZ.h"
-
+#include "vtkRenderer.h"
#include "vtkImageActor.h"
//-------------------------------------------------------------------
//-------------------------------------------------------------------
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()
/*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();
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();