void gmx_rmpbc(gmx_rmpbc_t gpbc,int natoms,matrix box,rvec x[]) { int ePBC; t_graph *gr; ePBC = gmx_rmpbc_ePBC(gpbc,box); gr = gmx_rmpbc_get_graph(gpbc,ePBC,natoms); if (gr != NULL) { mk_mshift(stdout,gr,ePBC,box,x); shift_x(gr,box,x,x); } }
void gmx_rmpbc_trxfr(gmx_rmpbc_t gpbc,t_trxframe *fr) { int ePBC; t_graph *gr; if (fr->bX && fr->bBox) { ePBC = gmx_rmpbc_ePBC(gpbc,fr->box); gr = gmx_rmpbc_get_graph(gpbc,ePBC,fr->natoms); if (gr != NULL) { mk_mshift(stdout,gr,ePBC,fr->box,fr->x); shift_x(gr,fr->box,fr->x,fr->x); } } }
void gmx_rmpbc_copy(gmx_rmpbc_t gpbc, int natoms, matrix box, rvec x[], rvec x_s[]) { int ePBC; t_graph *gr; int i; ePBC = gmx_rmpbc_ePBC(gpbc, box); gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms); if (gr != NULL) { mk_mshift(stdout, gr, ePBC, box, x); shift_x(gr, box, x, x_s); } else { for (i = 0; i < natoms; i++) { copy_rvec(x[i], x_s[i]); } } }
void ObjectDetDeformationRule::dt(ScorePyramid pyr) { m_optimum_shift_x_pyramid.shallowcopy(pyr); m_optimum_shift_y_pyramid.shallowcopy(pyr); int levels=pyr.levels(); for (int index=0;index<levels;++index) { if (pyr.flags(index)) { //judge whether the current level is valid Matrix<float> score_img=pyr[index]; int rows=score_img.rows(); int cols=score_img.cols(); Matrix<int> shift_x(rows,cols); Matrix<int> shift_y(rows,cols); //find the optimum shift along "row" direction Matrix<float> intermidinate_score_img(rows,cols); float* inter_score_img_data=NULL; float* score_img_data=NULL; for (int i=0;i<rows;++i) { score_img_data=score_img.row(i); int* ix_data=shift_x.row(i); inter_score_img_data=intermidinate_score_img.row(i); dt1d(score_img_data,inter_score_img_data,ix_data,1,cols,m_def_w_x0,m_def_w_x1); } //find the optimum shift along "col" direction inter_score_img_data=intermidinate_score_img.row(0); score_img_data=score_img.row(0); int* iy_data=shift_y.row(0); for (int i=0;i<cols;++i) { dt1d(inter_score_img_data+i,score_img_data+i,iy_data+i,cols,rows,m_def_w_y0,m_def_w_y1); } Matrix<int> optimum_shift_img_x(rows,cols); Matrix<int> optimum_shift_img_y(rows,cols); int* optimum_shift_img_x_data=optimum_shift_img_x.row(0); int* optimum_shift_img_y_data=optimum_shift_img_y.row(0); int* shift_x_data=shift_x.row(0); int* shift_y_data=shift_y.row(0); for (int i=0;i<rows;++i) { for (int j=0;j<cols;++j) { int p=i*cols+j; optimum_shift_img_y_data[p]=shift_y_data[p]; optimum_shift_img_x_data[p]=shift_x_data[shift_y_data[p]*cols+j]; } } m_optimum_shift_x_pyramid[index]=optimum_shift_img_x; m_optimum_shift_y_pyramid[index]=optimum_shift_img_y; } } }