}
//------------------------------------------------------------------------
-std::vector<int> ModelShowNPoints::GetLstPointsX()
+std::vector<double> ModelShowNPoints::GetLstPointsX()
{
return lstPointsX;
}
//------------------------------------------------------------------------
-std::vector<int> ModelShowNPoints::GetLstPointsY()
+std::vector<double> ModelShowNPoints::GetLstPointsY()
{
return lstPointsY;
}
//------------------------------------------------------------------------
-std::vector<int> ModelShowNPoints::GetLstPointsZ()
+std::vector<double> ModelShowNPoints::GetLstPointsZ()
{
return lstPointsZ;
}
}
//------------------------------------------------------------------------
-void ModelShowNPoints::SetReferencePoint(std::vector<int> ppoint)
+void ModelShowNPoints::SetReferencePoint(std::vector<double> ppoint)
{
mReferencePoint = ppoint;
}
//------------------------------------------------------------------------
-std::vector<int> ModelShowNPoints::GetReferencePoint()
+std::vector<double> ModelShowNPoints::GetReferencePoint()
{
return mReferencePoint;
}
}
//------------------------------------------------------------------------
-void ModelShowNPoints::GetIdPoint(int id, int *x, int *y, int *z)
+void ModelShowNPoints::GetIdPoint(int id, double *x, double *y, double *z)
{
*x = lstPointsX[id];
*y = lstPointsY[id];
}
//------------------------------------------------------------------------
-void ModelShowNPoints::AddPoint(int x, int y, int z, std::string label)
+void ModelShowNPoints::AddPoint(double x, double y, double z, std::string label)
{
lstPointsX.push_back( x );
lstPointsY.push_back( y );
}
//------------------------------------------------------------------------
-int ModelShowNPoints::InsertPoint(int x, int y, int z, std::string label)
+int ModelShowNPoints::InsertPoint(double x, double y, double z, std::string label)
{
if(lstPointsX.size()>1)
{
- std::vector<int> dTotal;
+ std::vector<double> dTotal;
int pos = 1;
double a,b,c,res;
int i,j;
dTotal.push_back (res);
}
//Gets the smallest distance
- int smallTMP = dTotal[0];
+ double smallTMP = dTotal[0];
for (j = 0; j < (int) dTotal.size(); j++)
{
if(dTotal[j]<smallTMP)
// *************** Open contour case End *******************
- std::vector<int>::iterator it;
+ std::vector<double>::iterator it;
//Insert the point in the list of points
it = lstPointsX.begin();
lstPointsX.insert( it+pos, x );
int i , size = (int) (lstPointsX.size());
fprintf(ff,"NumberOfPoints %d \n",size);
fprintf(ff," X\tY\tZ\tvalue\tLabel\n");
- int x, y, z;
+ double x, y, z;
double value;
for (i=0; i<size; i++)
{
x = lstPointsX[i];
y = lstPointsY[i];
z = lstPointsZ[i];
- value = mimage->GetScalarComponentAsDouble(x,y,z,0);
+ value = mimage->GetScalarComponentAsDouble(std::round(x),std::round(y),std::round(z),0);
if (lstLabels[i]!="")
{
tmpLabel=lstLabels[i];
} else{
tmpLabel="<_VOID_>";
}
- fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , tmpLabel.c_str());
+ fprintf(ff,"%f\t%f\t%f\t%f\t%s\n", x , y , z , value , tmpLabel.c_str());
} // for
}
fscanf(ff," %s %s %s %s %s",chartmp, chartmp,chartmp,chartmp,chartmp );
float value;
- int x,y,z;
+ double x,y,z;
for (i=0; i<size; i++)
{
- fscanf(ff,"%d%d%d%f%s",&x,&y,&z,&value,chartmp ); // x,y,z,value,label
+ fscanf(ff,"%lf%lf%lf%f%s",&x,&y,&z,&value,chartmp ); // x,y,z,value,label
if (strcmp(chartmp,"<_VOID_>")==0) { strcpy(chartmp,""); }
+ cout << x << " " << y << " " << z << " " << value << endl;
AddPoint(x,y,z, chartmp );
}
return size;