16 #ifndef __DISP_MAP_HPP__
17 #define __DISP_MAP_HPP__
42 ifstream in(
fIle.c_str());
45 "file with data points not found");
49 typedef boost::tokenizer<boost::escaped_list_separator<char>> Tokenizer;
54 while (getline(in, line)) {
57 for (Tokenizer::iterator it(tok.begin()), end(tok.end()); it != end;
59 vec.push_back(atof(it->c_str()));
70 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Get parameters",
"none");
73 CHKERR PetscOptionsScalar(
"-cube_size",
"get cube size for the averaging",
78 "-scale",
"scale the distance between voxels (eg. from mm to m)",
"",
81 ierr = PetscOptionsEnd();
104 vector<double> vec_data;
105 vector<double> vec_dist;
110 int ix = ceil(x /
sCale);
111 int iy = ceil(y /
sCale);
113 vec_ix.resize(2 * nx);
114 vec_iy.resize(2 * ny);
117 for (
int i = 0;
i < 2 * nx;
i++) {
118 int idx = ix - nx +
i;
119 if (idx >= size_x / 2 || idx < -size_x / 2)
125 for (
int i = 0;
i < 2 * ny;
i++) {
126 int idx = iy - ny +
i;
127 if (idx >= size_y / 2 || idx < -size_y / 2)
134 vec_data.resize(vec_iy.size() * vec_ix.size());
135 vec_dist.resize(vec_iy.size() * vec_ix.size());
137 for (vector<int>::iterator it_iy = vec_iy.begin(); it_iy != vec_iy.end();
139 for (vector<int>::iterator it_ix = vec_ix.begin(); it_ix != vec_ix.end();
142 main_vector[*it_iy + size_y / 2][*it_ix + size_x / 2];
143 vec_dist[ii] = ((*it_iy *
sCale - y) * (*it_iy *
sCale - y) +
151 vector<double> kernel;
152 kernel.resize(vec_data.size());
156 const double m = (1 / sqrt(M_PI * 2 * sigma * sigma));
157 for (
int ii = 0; ii < vec_dist.size(); ii++) {
158 kernel[
i] =
m * exp(-(vec_dist[ii]) /
159 (2 * sigma * sigma));
163 for (vector<double>::iterator vec_itr = vec_data.begin();
164 vec_itr != vec_data.end(); vec_itr++) {
166 data += (*vec_itr) * kernel[ii++];
187 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"",
"none");
190 CHKERR PetscOptionsScalar(
"-lambda",
"lambda parameter",
"", 1, &
lAmbda,
192 ierr = PetscOptionsEnd();
220 int nb_rows = row_data.getIndices().size();
221 int nb_cols = col_data.getIndices().size();
230 int nb_gauss_pts = row_data.getN().size1();
231 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
239 area * outer_prod(row_base_function, col_base_function);
240 MatrixAdaptor row_diff_base_function = row_data.getDiffN(gg);
241 MatrixAdaptor col_diff_base_function = col_data.getDiffN(gg);
247 prod(row_diff_base_function, trans(col_diff_base_function));
250 &row_data.getIndices()[0], col_data.getIndices().size(),
255 if (row_side != col_side || row_type != col_type) {
261 &col_data.getIndices()[0], row_data.getIndices().size(),
285 if (row_type != MBVERTEX)
288 int nb_rows = row_data.getIndices().size();
297 const int nb_gauss_pts = row_data.getN().size1();
299 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
325 int nb_rows = row_data.getIndices().size();
331 int nb_gauss_pts = row_data.getN().size1();
332 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
349 #endif //__DISP_MAP_HPP__