7 #ifndef IMPEM2D_CENTERED_MAT_H
8 #define IMPEM2D_CENTERED_MAT_H
10 #include "IMP/em2d/em2d_config.h"
17 IMPEM2D_BEGIN_NAMESPACE
34 "CenteredMat: Matrix passed is empty");
36 center_row_ =
static_cast<int>(0.5*m.rows);
37 center_col_ =
static_cast<int>(0.5*m.cols);
38 set_starts_and_ends();
50 if(center_row >= 0 && center_row < m.rows && center_col >=0 &&
51 center_col < m.cols) {
52 center_row_ = center_row;
53 center_col_ = center_col;
55 IMP_THROW(
"CenteredMat: Center index out of range ",ValueException);
57 set_starts_and_ends();
64 * @param i The dimension to use (0 - rows, 1 - columns)
65 * @return The starting point in the given dimension
89 if(i < get_start(0) || i > get_end(0))
return false;
90 if(j < get_start(1) || j > get_end(1))
return false;
106 return centered_.at<
double>(center_row_+i,center_col_+j);
114 out <<
"Matrix of size: (" << centered_.rows <<
","<< centered_.cols
115 <<
") centered mat at: (" << center_row_ <<
","<< center_col_ <<
") start ("
116 << start_[0] <<
","<< start_[1] <<
") end (" << end_[0] <<
","<< end_[1]
129 start_[0] = -center_row_;
130 start_[1] = -center_col_;
131 end_[0]=centered_.rows - 1 - center_row_;
132 end_[1]=centered_.cols - 1 - center_col_;
136 int center_row_,center_col_;
139 int start_[2],end_[2];
142 IMPEM2D_END_NAMESPACE