本文整理汇总了C++中volume::in_bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ volume::in_bounds方法的具体用法?C++ volume::in_bounds怎么用?C++ volume::in_bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volume
的用法示例。
在下文中一共展示了volume::in_bounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: step_of_computation
double step_of_computation(const volume<float> & image, Mesh & m, const double bet_main_parameter, const int pass, const double increase_smoothing, const int iteration_number, double & l, const double t2, const double tm, const double t, const double E,const double F, const double zcog, const double radius, const double local_th=0., const int d1=7, const int d2=3){
double xdim = image.xdim();
double ydim = image.ydim();
double zdim = image.zdim();
if (iteration_number==50 || iteration_number%100 == 0 )
{
l = 0;
int counter = 0;
for (vector<Mpoint*>::iterator i = m._points.begin(); i!=m._points.end(); i++ )
{
counter++;
l += (*i)->medium_distance_of_neighbours();
}
l/=counter;
}
for (vector<Mpoint*>::iterator i = m._points.begin(); i!=m._points.end(); i++)
{
Vec sn, st, u1, u2, u3, u;
double f2, f3=0;
Vec n = (*i)->local_normal();
Vec dv = (*i)->difference_vector();
double tmp = dv|n;
sn = n * tmp;
st = dv - sn;
u1 = st*.5;
double rinv = (2 * fabs(sn|n))/(l*l);
f2 = (1+tanh(F*(rinv - E)))*0.5;
if (pass > 0)
if (tmp > 0) {
f2*=increase_smoothing;
f2 = Min(f2, 1.);
}
u2 = f2 * sn;
//main term of bet
{
double local_t = bet_main_parameter;
if (local_th != 0.0)
{
local_t = Min(1., Max(0., bet_main_parameter + local_th*((*i)->get_coord().Z - zcog)/radius));
}
double Imin = tm;
double Imax = t;
Pt p = (*i)->get_coord() + (-1)*n;
double iv = p.X/xdim + .5, jv = p.Y/ydim +.5, kv = p.Z/zdim +.5;
if (image.in_bounds((int)iv,(int) jv,(int) kv))
{
double im=image.value((int)iv,(int)jv,(int)kv);
Imin = Min(Imin, im);
Imax = Max(Imax,im);
double nxv=n.X/xdim, nyv=n.Y/ydim, nzv=n.Z/zdim;
int i2=(int)(iv-(d1-1)*nxv), j2 =(int) (jv-(d1-1)*nyv), k2 =(int)(kv-(d1-1)*nzv);
if (image.in_bounds(i2, j2, k2))
{
im=image.value(i2,j2,k2);
Imin = Min(Imin, im);
for (int gi=2; gi<d1; gi++)
{
// the following is a quick calc of Pt p = (*i)->get_coord() + (-gi)*n;
iv-=nxv; jv-=nyv; kv-=nzv;
im = image.value((int) (iv), (int) (jv), (int) (kv));
Imin = Min(Imin, im);
if (gi<d2)
Imax = Max(Imax,im);
}
Imin = Max (t2, Imin);
Imax = Min (tm, Imax);
const double tl = (Imax - t2) * local_t + t2;
if (Imax - t2 > 0)
f3=2*(Imin - tl)/(Imax - t2);
else f3=(Imin - tl)*2;
}
}
}
f3 *= (normal_max_update_fraction * lambda_fit * l);
u3 = f3 * n;
u = u1 + u2 + u3;
//cout<<"l "<<l<<"u1 "<<((u1*n).norm())<<"u2 "<<(u2|n)<<"u3 "<<(u3|n)<<endl;
//.........这里部分代码省略.........