//std::ofstream file1;
//file1.open( "Temp.txt" );
- for(i=0; i<tempX.size(); i++)
+ for(i=0; i<(int)(tempX.size()); i++)
{
// fprintf(fd,"\n Para X = %f, Y = %f",tempX[i],tempY[i]);
_circleX.push_back(tempX[i]);
tempDD.push_back(_interbewteencircleDist[i]);
// fprintf(fdata,"\n%f %f %f",_interbewteencircleDist[j],_interbewteencircleX[j],_interbewteencircleY[j]);
}
- for(i=_interbewteencirclePos[0]; i<_intercircleX.size(); i++)
+ for(i=_interbewteencirclePos[0]; i<(int)(_intercircleX.size()); i++)
{
tempXX.push_back(_intercircleX[i]);
tempYY.push_back(_intercircleY[i]);
std::ofstream file1;
file1.open( "1_Intersection.txt" );
- for(int i = 0; i < _intercircleX.size(); i++){
+ for(int i = 0; i < (int)(_intercircleX.size()); i++){
file1<<"X= "<<_intercircleX[i] << "\tY= "<<_intercircleY[i] << "\tDist= "<<_intercircleDist[i]<<std::endl;
}
file1.close();
//JCP 26 - 09 - 08 This change was du to the posibility of having a maximum or a minimum value in the limits of
//JCP 26 - 09 - 08 the array
double lastdist, currentdist, nextdist;
- for(i=0; i < _intercircleDist.size(); i++)
+ for(i=0; i < (int)(_intercircleDist.size()); i++)
{
//FOR MAXIMUM LOCAL
//JCP 26-09-08
if(i == 0){
lastdist = _intercircleDist[_intercircleDist.size()-1];
nextdist = _intercircleDist[i+1];
- }else if (i == _intercircleDist.size()-1){
+ }else if (i == (int)(_intercircleDist.size())-1){
lastdist = _intercircleDist[i-1];
nextdist = _intercircleDist[0];
}else{
vecf->copyVector(&_minlocalX,&_controlpointsX);
vecf->copyVector(&_minlocalY,&_controlpointsY);
- for(i=0; i<_minlocalX.size(); i++)
+ for(i=0; i<(int)(_minlocalX.size()); i++)
{
tempZ.push_back(_controlpointsZ[0]);
}
std::ofstream file1;
file1.open( "2_MaxMin.txt" );
- for(int i = 0; i < _controlpointsX.size(); i++){
+ for(int i = 0; i < (int)(_controlpointsX.size()); i++){
file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
}
file1.close();
std::ofstream file1;
file1.open( "3_PointsFixed.txt" );
- for(int i = 0; i < _controlpointsX.size(); i++){
+ for(int i = 0; i < (int)(_controlpointsX.size()); i++){
file1<<"X= "<<_controlpointsX[i] << "\tY= "<<_controlpointsY[i] << "\tZ= "<<_controlpointsZ[i]<<std::endl;
}
file1.close();
//EED 22 Sep 2008
// FILE *fd;
// fd = fopen("C:/bbtk_JS/data/interBetweenContours.txt","w");
- for(i=0; i<_chargecontrolpointsX.size(); i++)
+ for(i=0; i<(int)(_chargecontrolpointsX.size()); i++)
{
ii = (i+1)%(_chargecontrolpointsX.size());
vecX->set_var(_chargecontrolpointsX[i]);
vecY->set_var(_chargecontrolpointsY[i]);
- 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]);
printf("\n\n There is an invalid intersection: Must see AutoControlPoints::IntersectionPoints() method");
}
JCP 30-08-09 */
- for(i=0; i<_intervectorX.size(); i++){
+ for(i=0; i<(int)(_intervectorX.size()); i++){
min = 9999;
posj = -1;
for(j=0; j<_intervectorX[i].getsize_vec(); j++) {
// FILE *fd;
// fd = fopen("C:/bbtk_JS/data/interErrorData.txt","w");
- for(i=0; i<_interpointsX.size(); i++)
+ for(i=0; i<(int)(_interpointsX.size()); i++)
{
_errorvector.push_back( (sqrt( pow( _interpointsX[i]-_intervectorX[i].get_var(),2 ) + pow( _interpointsY[i]-_intervectorY[i].get_var(),2 ) )/_pathsize)*100 );
// fprintf(fd,"\n%d %f",i,_errorvector[i]);
}
// fclose(fd);
double max = -1;
- for(i=0; i<_errorvector.size(); i++)
+ for(i=0; i<(int)(_errorvector.size()); i++)
{
if(_interpointsX[i] != -1)
{
for(i=(int)_errorpos; findA!=true; i++)
{
ii = i%_errorvector.size();
- for(j=0; j<_controlpointsX.size(); j++)
+ for(j=0; j<(int)(_controlpointsX.size()); j++)
{
if( ((float)_controlpointsX[j]-1.5<=(float)_intervectorX[ii].get_var()) && ((float)_intervectorX[ii].get_var()<=(float)_controlpointsX[j]+1.5) &&
((float)_controlpointsY[j]-1.5<=(float)_intervectorY[ii].get_var()) && ((float)_intervectorY[ii].get_var()<=(float)_controlpointsY[j]+1.5) )
{
i = _errorvector.size();
}
- for(j=0; j<_controlpointsX.size(); j++)
+ for(j=0; j<(int)(_controlpointsX.size()); j++)
{
if( ((float)_controlpointsX[j]-1.5<=(float)_intervectorX[i].get_var()) && ((float)_intervectorX[i].get_var()<=(float)_controlpointsX[j]+1.5) &&
((float)_controlpointsY[j]-1.5<=(float)_intervectorY[i].get_var()) && ((float)_intervectorY[i].get_var()<=(float)_controlpointsY[j]+1.5) )
if(posA<posB)
{
posA = posB+1;
- if(posB = _controlpointsX.size()-1) // ?!? // JPRx
+ if(posB = _controlpointsX.size()-1) // ?!? // JPRx // ?!? EED
{
posA = 0;
}
std::vector<double> tempX;
std::vector<double> tempY;
std::vector<double> tempZ;
- for(i=0; i<_controlpointsX.size(); i++)
+ for(i=0; i<(int)(_controlpointsX.size()); i++)
{
if(i == id)
{
// FILE *fd;
// fd = fopen("C:/bbtk_JS/data/InterBetweenControl.txt","w");
- for(i=0; i<_chargecontrolpointsX.size()-1; i++)
+ for(i=0; i<(int)(_chargecontrolpointsX.size())-1; i++)
{
ii = (i+1)%(_chargecontrolpointsX.size());
m1 = Slope(_chargecontrolpointsX[i],_chargecontrolpointsY[i],_chargecontrolpointsX[ii],_chargecontrolpointsY[ii]);
vecX->set_var(_chargecontrolpointsX[i]);
vecY->set_var(_chargecontrolpointsY[i]);
- for(j=0; j<_chargecontrolpointsX.size(); j++)
+ for(j=0; j<(int)(_chargecontrolpointsX.size()); j++)
{
jj = (j+1)%(_chargecontrolpointsX.size());
m2 = Slope(_chargecontrolpointsX[j],_chargecontrolpointsY[j],_chargecontrolpointsX[jj],_chargecontrolpointsY[jj]);
float vecx,vecy,varx,vary;
// FILE *fd;
// fd = fopen("C:/bbtk_JS/data/InterBetweenControlFix.txt","w");
- for(i=0; i<_intervecXX.size(); i++)
+ for(i=0; i<(int)(_intervecXX.size()); i++)
{
Vector *vx = new Vector();
Vector *vy = new Vector();
if(_intervectorX.size() != 0)
{
// fd = fopen("C:/bbtk_JS/data/InterPossibleIntersections.txt","w");
- for(i=0; i<_intervectorX.size(); i++)
+ for(i=0; i<(int)(_intervectorX.size()); i++)
{
// fprintf(fd,"\n Para X = %f, Y = %f",_intervectorX[i].get_var(),_intervectorY[i].get_var());
if(_intervectorX[i].getsize_vec() > 1)
ity = arrY.begin();
itxx = arrX.begin()+1;
ityy = arrY.begin()+1;
- for(j=0; j<arrX.size()-1; j++)
+ for(j=0; j<(int)(arrX.size())-1; j++)
{
// I
if( (*itx > _intervectorX[i].get_var()) && (*ity < _intervectorY[i].get_var()) &&
_intervectorX[i].resetVec();
_intervectorY[i].resetVec();
//printf("\n _intervector(%d) Size = %d",i,_intervectorX[i].getsize_vec());
- for(k=0; k<arrX.size(); k++)
+ for(k=0; k<(int)(arrX.size()); k++)
{
//printf("\n arr(%d) X = %f, Y = %f",k,arrX[k],arrY[k]);
// fprintf(fd,"\n => x_int = %f, y_int = %f",arrX[k],arrY[k]);
_contIncontpos.clear();
bool find = false;
double range = 2;
- for(i=0; i<_controlpointsX.size(); i++)
+ for(i=0; i<(int)(_controlpointsX.size()); i++)
{
find = false;
- for(j=0; (j<InX->size()) && (find!=true); j++)
+ for(j=0; (j<(int)(InX->size())) && (find!=true); j++)
{
if( ((*InX)[j]-range<=_controlpointsX[i]) && (_controlpointsX[i]<=(*InX)[j]+range) && ((*InY)[j]-range<=_controlpointsY[i]) && (_controlpointsY[i]<=(*InY)[j]+range) )
{
_controlpointsY.clear();
_controlpointsZ.clear();
- for(i=0; i<tempX.size(); i++)
+ for(i=0; i<(int)(tempX.size()); i++)
{
if(i==_posn)
{
for(i=0; promactual > prom; i++)
{
prom = promactual;
- for(i=0; i<tempX.size(); i++)
+ for(i=0; i<(int)(tempX.size()); i++)
{
if(i==_posn)
{
ity = _controlpointsY.begin();
for(i=_contIncontpos[h],j=_contIncontpos[h]; (i>_contIncontpos[hh]) && (promactual1>prom1); i--)
{
- if(j == InX->size())
+ if(j == (int)(InX->size()))
{
j = 0;
}
_controlpointsZ.clear();
vf->copyVector(&_minmaxlocalX,&_controlpointsX);
vf->copyVector(&_minmaxlocalY,&_controlpointsY);
- for(int i=0; i<_minmaxlocalX.size(); i++)
+ for(int i=0; i<(int)(_minmaxlocalX.size()); i++)
{
_controlpointsZ.push_back( (*InZ)[0] );
}
if(inicontrolpoints<10)
{
int points = (int)((inipercentage*3*InX->size())/100);
- for (int i=0; i<InX->size(); i++, h++)
+ for (int i=0; i<(int)(InX->size()); i++, h++)
{
if( h == points )
{
if(inicontrolpoints>=10)
{
int points = (int)((inipercentage*2*InX->size())/100);
- for (int i=0; i<InX->size(); i++, h++)
+ for (int i=0; i<(int)(InX->size()); i++, h++)
{
if( h == points )
{
_controlpointsZ.clear();
vf->copyVector(&_minmaxlocalX,&_controlpointsX);
vf->copyVector(&_minmaxlocalY,&_controlpointsY);
- for(int i=0; i<_minmaxlocalX.size(); i++)
+ for(int i=0; i<(int)(_minmaxlocalX.size()); i++)
{
_controlpointsZ.push_back( (*InZ)[0] );
}
{
while(!feof(fd))
{
- fscanf(fd,""); // ?? JPRx
- //fscanf(fd," %s %d",&firstline,&size); // JPRx
+// //fscanf(fd," %s %d",&firstline,&size); // JPRx
fscanf(fd," %s %d",firstline,&size);
_SizesC.push_back(size);
if(fd!=NULL)
{
int cont = 0;
- for(i=0; i<_SizesC.size(); i++)
+ for(i=0; i<(int)(_SizesC.size()); i++)
{
fprintf(fd,"\nNumberOfPoints %d", _SizesC[i] );
for(j=0; j<_SizesC[i]; j++)
if(fd!=NULL)
{
int cont = 0;
- for(i=0; i<_SizesC.size(); i++)
+ for(i=0; i<(int)(_SizesC.size()); i++)
{
fprintf(fd,"\nNumberOfControlPoints %d", _SizesC[i] );
for(j=0; j<_SizesC[i]; j++)
int h = 1;
//int j=0; // JPRx
int points = (int)(_InX.size()/_numsampling);
- for (int i=0; i<_InX.size(); i++, h++)
+ for (int i=0; i<(int)(_InX.size()); i++, h++)
{
if( h == points )
{
if( vec1->size() != 0 )
{
vec2->clear();
- for(i=0; i<vec1->size(); i++)
+ for(i=0; i<(int)(vec1->size()); i++)
{
Vector *temp = new Vector();
temp->set_var( (*vec1)[i].get_var() );
void Vector::printVector(std::vector<Vector>*vec1)
{
int i,j;
- for(i=0; i<vec1->size(); i++)
+ for(i=0; i<(int)(vec1->size()); i++)
{
printf("\n Pos (%d) => var = %f",i,(*vec1)[i].get_var());
for(j=0; j<(*vec1)[i].getsize_vec(); j++)
//------------------------------------------------------------------------------------------------------------------------------------------
double Vector::get_x(int id)
{
- if( (-1<id) && (id<_vecX.size()) )
+ if( (-1<id) && (id<(int)(_vecX.size()) ) )
{
return _vecX[id];
}
//------------------------------------------------------------------------------------------------------------------------------------------
double Vector::get_y(int id)
{
- if( (-1<id) && (id<_vecY.size()) )
+ if( (-1<id) && (id<(int)(_vecY.size())) )
{
return _vecY[id];
}
//------------------------------------------------------------------------------------------------------------------------------------------
double Vector::get_z(int id)
{
- if( (-1<id) && (id<_vecZ.size()) )
+ if( (-1<id) && (id<(int)(_vecZ.size())) )
{
return _vecZ[id];
}
}
_KeyContourSizes.insert( _KeyContourSizes.begin() + idKeyContourSizes , InX->size() );
- for(i=0; i<InX->size(); i++)
+ for(i=0; i<(int)(InX->size()); i++)
{
_KeyContourX.insert( _KeyContourX.begin() + idKeyContour, (*InX)[i] );
_KeyContourY.insert( _KeyContourY.begin() + idKeyContour, (*InY)[i] );
{
return method_Spline(&_KeyContourX,&_KeyContourY,&_KeyContourZ,&_KeyContourSizes);
}
+ return NULL;
}
//---------------------------------------------------------------------------------------------------
void PropContour::GetKeyContours(std::vector<double>*KeyX, std::vector<double>*KeyY, std::vector<double>*KeyZ, std::vector<int>*KeyS)
KeyZ->clear();
KeyS->clear();
- for(i=0; i<_KeyContourSizes.size(); i++)
+ for(i=0; i<(int)(_KeyContourSizes.size()); i++)
{
KeyS->push_back( _KeyContourSizes[i] );
}
- for(i=0; i<_KeyContourX.size(); i++)
+ for(i=0; i<(int)(_KeyContourX.size()); i++)
{
KeyX->push_back( _KeyContourX[i] );
KeyY->push_back( _KeyContourY[i] );
{
int i,j;
planevec->clear();
- for(i=0; i<_planevector.size(); i++)
+ for(i=0; i<(int)(_planevector.size()); i++)
{
Vector *temp = new Vector();
temp->set_plane( _planevector[i].get_plane() );
manualContourModelLine::manualContourModelLine()
: manualContourModel()
{
- SetNumberOfPointsSpline(2);
- SetNumberOfPointsSpline(2);
+printf("EED manualContourModelLine::manualContourModelLine \n");
+ // SetNumberOfPointsSpline(2);
+ SetNumberOfPointsSpline(100);
}
manualContourModelLine::~manualContourModelLine()
return 6;
}
+
//----------------------------------------------------------------
-void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+/*
+void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
{
int np = GetSizeLstPoints();
if (np==0)
*z = mp->GetZ();
}
-/*
- manualPoint *mp;
- double difX,difY;
- int np = GetSizeLstPoints( );
- int nps = GetNumberOfPointsSpline();
-// _deltaAngle=(3.14159265*2)/(nps-1);
- _deltaAngle = 100/nps;
-
- if (np==2){
-
- if (i==0){
- mp = GetManualPoint(0);
- } else {
- mp = GetManualPoint(1);
- }
-
- *x = mp->GetX();
- *y = mp->GetY();
- *z = mp->GetZ();
-
- }else {
- *x=-1;
- *y=-1;
- *z=-1;
- }
-*/
}
-
+*/
// ----------------------------------------------------------------------------
*x = _ww*radio*angcos + _cx;
*y = _hh*radio*angsin + _cy;
- *z= -900;
+ *z= 900;
}
//----------------------------------------------------------------
//ED
//printf("\n Number of points %d ",nps_t);
+ printf("EED %p manualViewContour::ifTouchContour >>>> nps_t=%d nps=%d x=%f y=%f z=%f \n", this , nps_t, nps, xx, yy, zz );
+
for( i = 0; i < nps_t; i++ )
{
_pts->GetPoint(i%nps, ppA);
d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2]));
- //ED
- //printf("\n Dist1 %f Dist2 %f Dist3 %f PT %d", d1,d2,d3,i);
+ //EED
+printf("%f %f %f - ", ppB[0], ppB[1], ppB[2] );
if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
{
i=nps;
}
}
+
+if (result==true)
+{
+ printf("EED %p manualViewContour::ifTouchContour true \n", this );
+} else {
+ printf("EED %p manualViewContour::ifTouchContour false \n", this );
+}
return result;
}
_manViewBaseCont = NULL;
_manContModel = NULL;
_state = 0;
- _z = -900;
+ _z = 900;
_editable = true;
_posibleToMove = true;
_moving = false;
virtual ~manualContourModelLine();
virtual manualContourModelLine *Clone();
void CopyAttributesTo( manualContourModelLine *cloneObject);
- virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+// virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
private:
virtual int GetTypeModel();
};
Program: wxMaracas
Module: $RCSfile: wxMPRWidget.cxx,v $
Language: C++
- Date: $Date: 2009/04/01 08:41:35 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2009/04/20 07:39:30 $
+ Version: $Revision: 1.8 $
Copyright: (c) 2002, 2003
License:
GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _interactorstyleplane2D );
vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+
camera->SetViewUp ( 0 , 1 , 0 );
- camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 );
camera->SetPosition ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 10000 );
+
+ camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 );
camera->SetClippingRange(0.01, 100000);
camera->ComputeViewPlaneNormal();
camera->SetParallelScale( _sizeIma/3.0 );
vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+
+//EED 17Avril2009
+/*
if (_direction==0) {
camera->SetViewUp ( 0 , -1 , 0 );
camera->SetPosition ( -10000,(y1+y2)/2 , (z1+z2)/2 );
camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
camera->SetParallelScale( (x2-x1)/3.0 );
}
-
+ */
+
+ if (_direction==0) {
+ camera->SetViewUp ( 0 , 1 , 0 );
+ camera->SetPosition ( 10000,(y1+y2)/2 , (z1+z2)/2 );
+ camera->SetFocalPoint ( 0 , (y1+y2)/2 , (z1+z2)/2 );
+ camera->SetParallelScale( (z2-z1)/3.0 );
+ }
+
+ if (_direction==1) {
+ camera->SetViewUp ( 0 , 0 , -1 );
+ camera->SetPosition ((x1+x2)/2 , 10000 , (z1+z2)/2 );
+ camera->SetFocalPoint ((x1+x2)/2 , 0 , (z1+z2)/2 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+
+ if (_direction==2) {
+ camera->SetViewUp ( 0 , 1 , 0 );
+ camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , 10000);
+ camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+
+
+
}
// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume;
double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume;
infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
- infoSuVo.Printf(_T("%d") , totalSubVolume);
+ infoSuVo.Printf(_T("%ld") , totalSubVolume);
infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
- infoPixLe.Printf(_T("%d pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
- infoPixHi.Printf(_T("%d pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
+ infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
+ infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
_infoToVo->SetLabel(infoToVo);
_infoSuVo->SetLabel(infoSuVo);
vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2();
vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
+
+//EED 17Avril2009
+/*
camera->SetViewUp ( spx*0 , -spy*1 , spz*0 );
camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 );
camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+*/
+ camera->SetViewUp ( spx*0 , spy*1 , spz*0 );
+ camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 );
+ camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+
+
camera->SetClippingRange( 0.01 , 1000000 );
camera->ComputeViewPlaneNormal();
camera->SetParallelScale( spx*(x2-x1)/3.0 );
// (ResetCamera() method) this vector is used to position the camera
// to look at the data in this direction.
_aCamera = vtkCamera::New();
+//EED 17Avril2009
+/*
_aCamera->SetViewUp (0, 0, -1);
_aCamera->SetPosition (0, 1, 0);
+ */
+ _aCamera->SetViewUp (0, 1, 0);
+ _aCamera->SetPosition (0, 0, 1);
+
_aCamera->SetFocalPoint (0, 0, 0);
_aCamera->ComputeViewPlaneNormal();
}