IMP  2.2.1
The Integrative Modeling Platform
IMP::em2d::CenteredMat Class Reference

#include <IMP/em2d/CenteredMat.h>

Public Member Functions

 CenteredMat (cv::Mat &m)
 
 CenteredMat (cv::Mat &m, int center_row, int center_col)
 
void do_show (std::ostream &out) const
 
int get_end (int i) const
 
bool get_is_in_range (int i, int j) const
 
int get_start (int i) const
 
double & operator() (int i, int j)
 
void show (std::ostream &out=std::cout) const
 

Protected Member Functions

void set_starts_and_ends ()
 

Protected Attributes

int center_col_
 
int center_row_
 
cv::Mat centered_
 
int end_ [2]
 
int start_ [2]
 

Detailed Description

Decorator for a cv::Mat to use coordinates respect to a point Almost always that point is the center

Definition at line 21 of file CenteredMat.h.

Constructor & Destructor Documentation

IMP::em2d::CenteredMat::CenteredMat ( cv::Mat &  m)

Creates and CenteredMat for the matrx

Parameters
mThe matrix
Note
The center pixel is not provided. It is assumed to be the center of the matrix

Definition at line 30 of file CenteredMat.h.

IMP::em2d::CenteredMat::CenteredMat ( cv::Mat &  m,
int  center_row,
int  center_col 
)

Creates a CenteredMat for the matrx

Parameters
mThe matrix
center_row- The row for the point used as center of CenteredMat
center_col- The column for the point used as center of CenteredMat
Returns

Definition at line 48 of file CenteredMat.h.

Member Function Documentation

void IMP::em2d::CenteredMat::do_show ( std::ostream &  out) const

Shows information about the class

Parameters
outStream used to show the information

Definition at line 109 of file CenteredMat.h.

int IMP::em2d::CenteredMat::get_end ( int  i) const

See get_start() function help. In the example of the 5x5 matrix, the end values would be (2,2)

Parameters
iThe dimension to use (0 - rows, 1 - columns)
Returns
The end point in the given dimension

Definition at line 75 of file CenteredMat.h.

bool IMP::em2d::CenteredMat::get_is_in_range ( int  i,
int  j 
) const

Returns true if the indices are in the matrix. Remember that the indices are those respect to the center of CenteredMat

Parameters
iRow
jColumn
Returns
True of False

Definition at line 84 of file CenteredMat.h.

int IMP::em2d::CenteredMat::get_start ( int  i) const

get the starting value for a dimension. ! For example, in a matrix of 5x5 centered at the origin (2,2), the ! starting point will be (-2,2)

Parameters
iThe dimension to use (0 - rows, 1 - columns)
Returns
The starting point in the given dimension

Definition at line 67 of file CenteredMat.h.

double& IMP::em2d::CenteredMat::operator() ( int  i,
int  j 
)

Returns the element (i,j) RELATIVE to the center. Remember then that the indices can be negative. For performance the indices out of range are NOT checked

Parameters
irow
jcolumn
Returns
the value of the matrix at row i and column j

Definition at line 98 of file CenteredMat.h.

void IMP::em2d::CenteredMat::set_starts_and_ends ( )
protected

Sets the starting and ending points for the object. See get_start() and get_end() for more help

Definition at line 123 of file CenteredMat.h.


The documentation for this class was generated from the following file: