#include <geometry.h>
Collaboration diagram for EMAN::Region:
Public Member Functions | |
Region () | |
Construct a null region with its origin at coordinate origins and its sizes to be 0. | |
Region (int x, int xsize) | |
Construct a 1D integer region. | |
Region (int x, int y, int xsize, int ysize) | |
Construct a 2D integer region. | |
Region (int x, int y, int z, int xsize, int ysize, int zsize) | |
Construct a 3D integer region. | |
Region (float x, float xsize) | |
Construct a 1D floating-number region. | |
Region (float x, float y, float xsize, float ysize) | |
Construct a 2D floating-number region. | |
Region (float x, float y, float z, float xsize, float ysize, float zsize) | |
Construct a 3D floating-number region. | |
Region (double x, double xsize) | |
Construct a 1D floating-number region. | |
Region (double x, double y, double xsize, double ysize) | |
Construct a 2D floating-number region. | |
Region (double x, double y, double z, double xsize, double ysize, double zsize) | |
Construct a 3D floating-number region. | |
Region (const FloatPoint &o, const FloatSize &s) | |
Construct a region given's orginal point and edge sizes. | |
Region (const Region &r) | |
~Region () | |
bool | inside_region () const |
to check whether a point is inside this region | |
bool | inside_region (const FloatPoint &p) const |
bool | inside_region (float x) const |
bool | inside_region (float x, float y) const |
bool | inside_region (float x, float y, float z) const |
float | get_width () const |
get the width | |
float | get_height () const |
get the height | |
float | get_depth () const |
get the depth | |
void | set_width (const float &v) |
set the width | |
void | set_height (const float &v) |
set the height | |
void | set_depth (const float &v) |
set the depth | |
float | x_origin () const |
get the x element of the origin | |
float | y_origin () const |
get the y element of the origin | |
float | z_origin () const |
get the z element of the origin | |
vector< float > | get_size () const |
get the size of each dimension as a vector | |
vector< float > | get_origin () const |
get the origin as a vector | |
void | set_origin (const vector< float > &v) |
set the origin using a vector | |
bool | is_region_in_box (const FloatSize &box) const |
To check whether 'this' region is inside a given box assuming the box's origins are (0,0,0). | |
int | get_ndim () const |
Get the region's dimension. | |
string | get_string () const |
Get the description of this region in a string. | |
Public Attributes | |
FloatPoint | origin |
FloatSize | size |
The coordinates and edge sizes can be integer or floating numbers.
Definition at line 500 of file geometry.h.
EMAN::Region::Region | ( | ) | [inline] |
EMAN::Region::Region | ( | int | x, | |
int | xsize | |||
) | [inline] |
EMAN::Region::Region | ( | int | x, | |
int | y, | |||
int | xsize, | |||
int | ysize | |||
) | [inline] |
EMAN::Region::Region | ( | int | x, | |
int | y, | |||
int | z, | |||
int | xsize, | |||
int | ysize, | |||
int | zsize | |||
) | [inline] |
EMAN::Region::Region | ( | float | x, | |
float | xsize | |||
) | [inline] |
EMAN::Region::Region | ( | float | x, | |
float | y, | |||
float | xsize, | |||
float | ysize | |||
) | [inline] |
EMAN::Region::Region | ( | float | x, | |
float | y, | |||
float | z, | |||
float | xsize, | |||
float | ysize, | |||
float | zsize | |||
) | [inline] |
EMAN::Region::Region | ( | double | x, | |
double | xsize | |||
) | [inline] |
EMAN::Region::Region | ( | double | x, | |
double | y, | |||
double | xsize, | |||
double | ysize | |||
) | [inline] |
EMAN::Region::Region | ( | double | x, | |
double | y, | |||
double | z, | |||
double | xsize, | |||
double | ysize, | |||
double | zsize | |||
) | [inline] |
EMAN::Region::Region | ( | const FloatPoint & | o, | |
const FloatSize & | s | |||
) | [inline] |
EMAN::Region::Region | ( | const Region & | r | ) | [inline] |
EMAN::Region::~Region | ( | ) | [inline] |
float EMAN::Region::get_depth | ( | ) | const [inline] |
get the depth
Definition at line 614 of file geometry.h.
References size.
Referenced by EMAN::EMData::extract_box().
00614 { return size[2]; }
float EMAN::Region::get_height | ( | ) | const [inline] |
get the height
Definition at line 612 of file geometry.h.
References size.
Referenced by EMAN::EMData::extract_box().
00612 { return size[1]; }
int EMAN::Region::get_ndim | ( | ) | const [inline] |
Get the region's dimension.
Definition at line 648 of file geometry.h.
References EMAN::FloatPoint::get_ndim(), and origin.
Referenced by EMAN::ImageIO::check_region(), EMAN::EMData::get_clip(), EMAN::EMUtil::get_region_dims(), EMAN::EMUtil::get_region_origins(), EMAN::EMUtil::process_region_io(), and EMAN::MrcIO::read_mrc_header().
00649 { 00650 return origin.get_ndim(); 00651 }
vector<float> EMAN::Region::get_origin | ( | ) | const [inline] |
get the origin as a vector
Definition at line 633 of file geometry.h.
References origin.
Referenced by EMAN::EMUtil::process_region_io().
00633 { return origin; }
vector<float> EMAN::Region::get_size | ( | ) | const [inline] |
get the size of each dimension as a vector
Definition at line 631 of file geometry.h.
References size.
Referenced by EMAN::EMUtil::get_region_dims(), and EMAN::EMUtil::process_region_io().
00631 { return size; }
string Region::get_string | ( | ) | const |
Get the description of this region in a string.
Definition at line 142 of file geometry.cpp.
References EMAN::FloatPoint::get_ndim(), origin, and size.
Referenced by EMAN::ImageIO::check_region().
00143 { 00144 char str[1028]; 00145 int ndim = origin.get_ndim(); 00146 00147 if (ndim == 2) { 00148 sprintf(str, "(%2.1f, %2.1f; %2.1f, %2.1f)", 00149 origin[0], origin[1], size[0], size[1]); 00150 } 00151 else if (ndim == 3) { 00152 sprintf(str, "(%2.1f, %2.1f, %2.1f; %2.1f, %2.1f, %2.1f)", 00153 origin[0], origin[1], origin[2], size[0], size[1], size[2]); 00154 } 00155 00156 return string(str); 00157 }
float EMAN::Region::get_width | ( | ) | const [inline] |
get the width
Definition at line 610 of file geometry.h.
References size.
Referenced by EMAN::EMData::extract_box().
00610 { return size[0]; }
bool Region::inside_region | ( | float | x, | |
float | y, | |||
float | z | |||
) | const |
Definition at line 115 of file geometry.cpp.
00116 { 00117 if (size[0] >= 0 && size[1] >= 0 && size[2] >= 0 && 00118 origin[0] <= x && origin[1] <= y && origin[2] <= z && 00119 (origin[0] + size[0]) > x && 00120 (origin[1] + size[1]) > y && (origin[2] + size[2]) > z) { 00121 return true; 00122 } 00123 return false; 00124 }
bool Region::inside_region | ( | float | x, | |
float | y | |||
) | const |
bool Region::inside_region | ( | float | x | ) | const |
bool Region::inside_region | ( | const FloatPoint & | p | ) | const |
Definition at line 77 of file geometry.cpp.
References EMAN::FloatPoint::get_ndim(), and inside_region().
00078 { 00079 if (p.get_ndim() == 1) { 00080 return inside_region(p[0]); 00081 } 00082 00083 00084 if (p.get_ndim() == 2) { 00085 return inside_region(p[0], p[1]); 00086 } 00087 00088 return inside_region(p[0], p[1], p[2]); 00089 }
bool Region::inside_region | ( | ) | const |
to check whether a point is inside this region
Definition at line 68 of file geometry.cpp.
References size.
Referenced by inside_region().
00069 { 00070 if (size[0] >= 0 && size[1] >= 0 && size[2] >= 0) { 00071 return true; 00072 } 00073 00074 return false; 00075 }
bool Region::is_region_in_box | ( | const FloatSize & | box | ) | const |
To check whether 'this' region is inside a given box assuming the box's origins are (0,0,0).
box | The nD rectangular box. |
Definition at line 127 of file geometry.cpp.
Referenced by EMAN::ImageIO::check_region().
00128 { 00129 if (size[0] >= 0 && size[1] >= 0 && size[2] >= 0 && 00130 origin[0] >= 0 && origin[1] >= 0 && origin[2] >= 0 && 00131 (origin[0] + size[0]) <= box[0] && 00132 (origin[1] + size[1]) <= box[1] && 00133 (origin[2] + size[2]) <= box[2]) { 00134 return true; 00135 } 00136 00137 return false; 00138 }
void EMAN::Region::set_depth | ( | const float & | v | ) | [inline] |
void EMAN::Region::set_height | ( | const float & | v | ) | [inline] |
void EMAN::Region::set_origin | ( | const vector< float > & | v | ) | [inline] |
void EMAN::Region::set_width | ( | const float & | v | ) | [inline] |
float EMAN::Region::x_origin | ( | ) | const [inline] |
get the x element of the origin
Definition at line 624 of file geometry.h.
References origin.
Referenced by EMAN::EMData::extract_box().
00624 { return origin[0]; }
float EMAN::Region::y_origin | ( | ) | const [inline] |
get the y element of the origin
Definition at line 626 of file geometry.h.
References origin.
Referenced by EMAN::EMData::extract_box().
00626 { return origin[1]; }
float EMAN::Region::z_origin | ( | ) | const [inline] |
get the z element of the origin
Definition at line 628 of file geometry.h.
References origin.
Referenced by EMAN::EMData::extract_box().
00628 { return origin[2]; }
Definition at line 658 of file geometry.h.
Referenced by EMAN::EMData::clip_inplace(), EMAN::EMData::get_clip(), get_ndim(), get_origin(), EMAN::EMUtil::get_region_origins(), get_string(), EMAN::EMData::insert_clip(), EMAN::TestTomoImage::insert_rectangle(), inside_region(), is_region_in_box(), EMAN::EMUtil::process_ascii_region_io(), EMAN::MrcIO::read_mrc_header(), Region(), set_origin(), x_origin(), y_origin(), and z_origin().
Definition at line 659 of file geometry.h.
Referenced by EMAN::EMData::clip_inplace(), EMAN::EMData::get_clip(), get_depth(), get_height(), get_size(), get_string(), get_width(), EMAN::EMData::insert_clip(), EMAN::TestTomoImage::insert_rectangle(), inside_region(), is_region_in_box(), Region(), set_depth(), set_height(), and set_width().