#include <vdgl_digital_region.h>
Public Types | |
enum | vsol_spatial_object_2d_type |
enum | vsol_region_2d_type |
Public Member Functions | |
vdgl_digital_region () | |
vdgl_digital_region (int npts, const float *xp, const float *yp, const unsigned short *pix) | |
vdgl_digital_region (vdgl_digital_region const &r) | |
~vdgl_digital_region () | |
void | ResetPixelData () |
Initialize the region for accepting a stream of pixels through repeated calls to ::IncrementMeans(..) | |
void | IncrementMeans (float x, float y, unsigned short pix) |
Used to scan through a set of pixels and acquire mean values for coordinates and intensity. | |
void | InitPixelArrays () |
Now we have the number of pixels so we can create the storage arrays. | |
void | InsertInPixelArrays (float x, float y, unsigned short pix) |
Insert pixel data into the face arrays. | |
float const * | Xj () const |
The region pixel coordinates and intensities. | |
float const * | Yj () const |
unsigned short const * | Ij () const |
unsigned int | Npix () const |
void | set_pixel_size (float pixel_size) |
The size of a region pixel in image pixel units. | |
float | get_pixel_size () const |
float | get_min () const |
float | get_max () const |
void | reset () const |
reset the iterator for accessing region pixels. | |
bool | next () const |
increment to next pixel and check if iterator is finished. | |
float | X () const |
The x pixel coordinate. | |
float | Y () const |
The y pixel coordinate. | |
unsigned short | I () const |
The pixel intensity. | |
void | set_X (float x) |
change x pixel coordinate | |
void | set_Y (float y) |
change y pixel coordinate | |
void | set_I (unsigned short I) |
change pixel intensity | |
float | Xo () const |
The mean X value of the region. | |
float | Yo () const |
The mean Y value of the region. | |
float | Io () const |
The mean intensity value of the region. | |
float | Io_sd () const |
The intensity standard deviation value of the region. | |
float | ComputeIntensityStdev () |
Compute the intensity stdev for the region. | |
double | X2 () const |
The second order X moment of the region. | |
double | Y2 () const |
The second order Y moment of the region. | |
double | XY () const |
The second order X,Y moment of the region. | |
double | I2 () const |
The second order intensity moment of the region. | |
double | XI () const |
The second order X,intensity moment of the region. | |
double | YI () const |
The second order Y,intensity moment of the region. | |
float | Diameter () const |
Compute the diameter from the scatter matrix. | |
float | AspectRatio () const |
Compute the aspect ratio from the scatter matrix. | |
virtual double | area () const |
virtual vsol_point_2d_sptr | centroid () const |
The centroid of the pointset. | |
bool | transform (vnl_float_3x3 const &t) |
transform this region using the given 3x3 projective transformation matrix. | |
vcl_vector< unsigned int > | histogram (int nbins) |
Compute the intensity histogram. | |
vcl_vector< unsigned int > | residual_histogram (int nbins, float *min=0, float *max=0) |
Compute the residual intensity histogram. | |
virtual bool | is_convex () const |
Return true if this region is convex. | |
void | PrincipalOrientation (vnl_float_2 &major_axis) |
Compute the principal orientation of the region. | |
double | Ix () const |
First derivative of intensity wrt x. | |
double | Iy () const |
First derivative of intensity wrt y. | |
double | Var () const |
The plane fitting error. | |
float | Ir () const |
The pixel intensity with the plane subtracted. | |
void | DoPlaneFit () const |
Fit a plane to the region intensities. | |
void | PrintFit () const |
virtual vsol_spatial_object_2d * | clone () const |
vcl_string | is_a () const |
Return a platform independent string identifying the class. | |
vsol_spatial_object_2d_type | spatial_type (void) const |
virtual vsol_region_2d * | cast_to_region (void) |
virtual vsol_region_2d const * | cast_to_region (void) const |
virtual vsol_polygon_2d * | cast_to_polygon (void) |
virtual vsol_polygon_2d const * | cast_to_polygon (void) const |
virtual vsol_poly_set_2d * | cast_to_poly_set (void) |
virtual vsol_poly_set_2d const * | cast_to_poly_set (void) const |
virtual bool | is_class (const vcl_string &cls) const |
const char * | get_name () const |
void | un_protect () |
short | version () const |
virtual void | b_write (vsl_b_ostream &os) const |
virtual void | b_read (vsl_b_istream &is) |
virtual void | print (vcl_ostream &strm=vcl_cout) const |
virtual void | describe (vcl_ostream &=vcl_cout, int=0) const |
virtual bool | operator== (vsol_spatial_object_2d const &obj) const |
bool | operator!= (vsol_spatial_object_2d const &obj) |
vsol_box_2d_sptr | get_bounding_box () const |
double | get_min_x () const |
double | get_max_x () const |
double | get_min_y () const |
double | get_max_y () const |
virtual vsol_spatial_object_2d * | cast_to_spatial_object () |
virtual vsol_spatial_object_2d const * | cast_to_spatial_object () const |
virtual vtol_topology_object * | cast_to_topology_object () |
virtual vtol_topology_object const * | cast_to_topology_object () const |
virtual vsol_spatial_object_2d * | cast_to_vsol_spatial_object () |
virtual vsol_spatial_object_2d const * | cast_to_vsol_spatial_object () const |
virtual vsol_point_2d * | cast_to_point () |
virtual vsol_point_2d const * | cast_to_point () const |
virtual vsol_curve_2d * | cast_to_curve () |
virtual vsol_curve_2d const * | cast_to_curve () const |
virtual vsol_group_2d * | cast_to_group () |
virtual vsol_group_2d const * | cast_to_group () const |
int | get_id () const |
void | set_id (int i) |
void | set_user_flag (unsigned int flag) |
bool | get_user_flag (unsigned int flag) |
void | unset_user_flag (unsigned int flag) |
void | set_tagged_union_flag () |
bool | get_tagged_union_flag () |
void | unset_tagged_union_flag () |
int | get_tag_id () |
void | set_tag_id (int id) |
void | touch () |
unsigned long | get_time_stamp () const |
bool | older (vul_timestamp const &t) const |
bool | older (vul_timestamp const *t) const |
void | ref () |
void | unref () |
int | get_references () const |
bool | is_referenced () const |
Public Attributes | |
SPATIAL_NO_TYPE | |
TOPOLOGYOBJECT | |
POINT | |
CURVE | |
REGION | |
SPATIALGROUP | |
VOLUME | |
NUM_SPATIALOBJECT_TYPES | |
REGION_NO_TYPE | |
POLYGON | |
POLYGON_SET | |
NUM_REGION_TYPES | |
Static Public Attributes | |
static const char * | SpatialTypes [] |
static const float | eps |
Protected Member Functions | |
void | ComputeScatterMatrix () const |
The scatter matrix (upper 3x3) is transformed to the origin by subtracting off the means. | |
void | IncrByXYI (double x, double y, int intens) const |
Update the scatter matrix elements. | |
double | ComputeSampleResidual () const |
Computes the squared deviation from the sample mean. | |
virtual vsol_region_2d_type | region_type (void) const |
void | not_applicable (vcl_string const &message) const |
void | empty_bounding_box () const |
void | set_bounding_box (vsol_box_2d_sptr const &box) const |
void | set_bounding_box (double x, double y) const |
void | add_to_bounding_box (double x, double y) const |
void | add_to_bounding_box (vsol_box_2d_sptr const &box) const |
void | grow_minmax_bounds (vsol_box_2d_sptr const &b) const |
virtual void | compute_bounding_box () const |
void | check_update_bounding_box () const |
Protected Attributes | |
unsigned int | npts_ |
Number of pixels in the region. | |
float | pixel_size_ |
Image pixel size in fractions of a pixel. | |
float * | xp_ |
float * | yp_ |
The location of each pixel. | |
unsigned short * | pix_ |
The pixel intensities. | |
float | max_ |
float | min_ |
Upper and lower bounds. | |
float | xo_ |
float | yo_ |
float | io_ |
Mean Values. | |
float | io_stdev_ |
Intensity standard deviation for region. | |
int | pix_index_ |
Index in pixel array (iterator) | |
bool | fit_valid_ |
Has a plane fit been done? | |
bool | scatter_matrix_valid_ |
Is the scatter matrix current? | |
double | Ix_ |
dI/dx | |
double | Iy_ |
dI/dy | |
double | X2_ |
The sums of various monomials to form the scatter matrix. | |
double | Y2_ |
double | I2_ |
double | XY_ |
double | XI_ |
double | YI_ |
double | error_ |
double | sigma_sq_ |
fitting errors | |
vnl_double_3x3 | Si_ |
scatter matrix | |
unsigned int | tag_ |
int | id_ |
unsigned long | timestamp_ |
Static Protected Attributes | |
static int | tagcount_ |
Friends | |
friend vcl_ostream & | operator<< (vcl_ostream &, vsol_spatial_object_2d const &) |
friend vcl_ostream & | operator<< (vcl_ostream &, vsol_spatial_object_2d const *) |
Definition at line 37 of file vdgl_digital_region.h.
vdgl_digital_region::vdgl_digital_region | ( | ) | [inline] |
Definition at line 42 of file vdgl_digital_region.h.
vdgl_digital_region::vdgl_digital_region | ( | int | npts, |
const float * | xp, | ||
const float * | yp, | ||
const unsigned short * | pix | ||
) |
Definition at line 41 of file vdgl_digital_region.cxx.
vdgl_digital_region::vdgl_digital_region | ( | vdgl_digital_region const & | r | ) |
Definition at line 25 of file vdgl_digital_region.cxx.
vdgl_digital_region::~vdgl_digital_region | ( | ) |
Definition at line 63 of file vdgl_digital_region.cxx.
virtual double vdgl_digital_region::area | ( | void | ) | const [inline, virtual] |
Implements vsol_region_2d.
Definition at line 106 of file vdgl_digital_region.h.
float vdgl_digital_region::AspectRatio | ( | ) | const |
Compute the aspect ratio from the scatter matrix.
Definition at line 292 of file vdgl_digital_region.cxx.
virtual vsol_point_2d_sptr vdgl_digital_region::centroid | ( | void | ) | const [inline, virtual] |
The centroid of the pointset.
Implements vsol_region_2d.
Definition at line 109 of file vdgl_digital_region.h.
vsol_spatial_object_2d * vdgl_digital_region::clone | ( | void | ) | const [virtual] |
Implements vsol_region_2d.
Definition at line 17 of file vdgl_digital_region.cxx.
float vdgl_digital_region::ComputeIntensityStdev | ( | ) |
Compute the intensity stdev for the region.
Calculate the standard deviation of intensity for the region.
Definition at line 160 of file vdgl_digital_region.cxx.
double vdgl_digital_region::ComputeSampleResidual | ( | ) | const [protected] |
Computes the squared deviation from the sample mean.
Definition at line 412 of file vdgl_digital_region.cxx.
void vdgl_digital_region::ComputeScatterMatrix | ( | ) | const [protected] |
The scatter matrix (upper 3x3) is transformed to the origin by subtracting off the means.
Definition at line 376 of file vdgl_digital_region.cxx.
float vdgl_digital_region::Diameter | ( | ) | const |
Compute the diameter from the scatter matrix.
Definition at line 269 of file vdgl_digital_region.cxx.
void vdgl_digital_region::DoPlaneFit | ( | ) | const |
Fit a plane to the region intensities.
Solve for the fitted plane.
Closed form solution in terms of the scatter matrix.
Definition at line 421 of file vdgl_digital_region.cxx.
float vdgl_digital_region::get_max | ( | ) | const [inline] |
Definition at line 74 of file vdgl_digital_region.h.
float vdgl_digital_region::get_min | ( | ) | const [inline] |
Definition at line 73 of file vdgl_digital_region.h.
float vdgl_digital_region::get_pixel_size | ( | ) | const [inline] |
Definition at line 70 of file vdgl_digital_region.h.
vcl_vector< unsigned int > vdgl_digital_region::histogram | ( | int | nbins | ) |
Compute the intensity histogram.
Compute the histogram.
The intensity ranges from get_min() to get_max().
Definition at line 529 of file vdgl_digital_region.cxx.
unsigned short vdgl_digital_region::I | ( | ) | const |
double vdgl_digital_region::I2 | ( | ) | const |
The second order intensity moment of the region.
Definition at line 246 of file vdgl_digital_region.cxx.
unsigned short const* vdgl_digital_region::Ij | ( | ) | const [inline] |
Definition at line 64 of file vdgl_digital_region.h.
void vdgl_digital_region::IncrByXYI | ( | double | x, |
double | y, | ||
int | intens | ||
) | const [protected] |
Update the scatter matrix elements.
The means are subtracted from the input values before incrementing. Thus the scatter matrix is formed with a coordinate system at the origin.
Definition at line 364 of file vdgl_digital_region.cxx.
void vdgl_digital_region::IncrementMeans | ( | float | x, |
float | y, | ||
unsigned short | pix | ||
) |
Used to scan through a set of pixels and acquire mean values for coordinates and intensity.
This approach is necessary to accumulate scatter matrices which have zero mean. One scans the region pixels twice. First to get the means and number of region pixels and then to insert the pixel data into fixed arrays
Definition at line 147 of file vdgl_digital_region.cxx.
void vdgl_digital_region::InitPixelArrays | ( | ) |
Now we have the number of pixels so we can create the storage arrays.
Definition at line 175 of file vdgl_digital_region.cxx.
void vdgl_digital_region::InsertInPixelArrays | ( | float | x, |
float | y, | ||
unsigned short | pix | ||
) |
Insert pixel data into the face arrays.
Definition at line 188 of file vdgl_digital_region.cxx.
float vdgl_digital_region::Io | ( | ) | const |
The mean intensity value of the region.
Definition at line 212 of file vdgl_digital_region.cxx.
float vdgl_digital_region::Io_sd | ( | ) | const |
The intensity standard deviation value of the region.
Definition at line 218 of file vdgl_digital_region.cxx.
float vdgl_digital_region::Ir | ( | ) | const |
The pixel intensity with the plane subtracted.
The Residual Intensity.
Definition at line 485 of file vdgl_digital_region.cxx.
vcl_string vdgl_digital_region::is_a | ( | ) | const [inline, virtual] |
Return a platform independent string identifying the class.
Reimplemented from vsol_region_2d.
Definition at line 140 of file vdgl_digital_region.h.
virtual bool vdgl_digital_region::is_convex | ( | void | ) | const [inline, virtual] |
Return true if this region is convex.
Implements vsol_region_2d.
Definition at line 123 of file vdgl_digital_region.h.
double vdgl_digital_region::Ix | ( | ) | const |
First derivative of intensity wrt x.
Definition at line 345 of file vdgl_digital_region.cxx.
double vdgl_digital_region::Iy | ( | ) | const |
First derivative of intensity wrt y.
Definition at line 352 of file vdgl_digital_region.cxx.
bool vdgl_digital_region::next | ( | ) | const [inline] |
increment to next pixel and check if iterator is finished.
Definition at line 78 of file vdgl_digital_region.h.
unsigned int vdgl_digital_region::Npix | ( | ) | const [inline] |
Definition at line 65 of file vdgl_digital_region.h.
void vdgl_digital_region::PrincipalOrientation | ( | vnl_float_2 & | major_axis | ) |
Compute the principal orientation of the region.
major_axis is a 2-d vector representing the orientation.
Definition at line 314 of file vdgl_digital_region.cxx.
void vdgl_digital_region::PrintFit | ( | ) | const |
Definition at line 451 of file vdgl_digital_region.cxx.
void vdgl_digital_region::reset | ( | ) | const [inline] |
reset the iterator for accessing region pixels.
Definition at line 76 of file vdgl_digital_region.h.
void vdgl_digital_region::ResetPixelData | ( | ) |
Initialize the region for accepting a stream of pixels through repeated calls to ::IncrementMeans(..)
Definition at line 131 of file vdgl_digital_region.cxx.
vcl_vector< unsigned int > vdgl_digital_region::residual_histogram | ( | int | nbins, |
float * | min = 0 , |
||
float * | max = 0 |
||
) |
Compute the residual intensity histogram.
The intensity range is returned as the last two arguments.
Definition at line 541 of file vdgl_digital_region.cxx.
void vdgl_digital_region::set_I | ( | unsigned short | I | ) |
change pixel intensity
Modify the pixel intensity.
Definition at line 120 of file vdgl_digital_region.cxx.
void vdgl_digital_region::set_pixel_size | ( | float | pixel_size | ) | [inline] |
The size of a region pixel in image pixel units.
(due to expanded resolution processing)
Definition at line 69 of file vdgl_digital_region.h.
void vdgl_digital_region::set_X | ( | float | x | ) |
change x pixel coordinate
Modify the X pixel coordinate.
Definition at line 102 of file vdgl_digital_region.cxx.
void vdgl_digital_region::set_Y | ( | float | y | ) |
change y pixel coordinate
Modify the Y pixel coordinate.
Definition at line 111 of file vdgl_digital_region.cxx.
bool vdgl_digital_region::transform | ( | vnl_float_3x3 const & | t | ) |
transform this region using the given 3x3 projective transformation matrix.
Definition at line 507 of file vdgl_digital_region.cxx.
double vdgl_digital_region::Var | ( | ) | const [inline] |
The plane fitting error.
Definition at line 130 of file vdgl_digital_region.h.
float vdgl_digital_region::X | ( | ) | const |
The x pixel coordinate.
The X pixel coordinate.
Definition at line 72 of file vdgl_digital_region.cxx.
double vdgl_digital_region::X2 | ( | ) | const |
The second order X moment of the region.
Individual scatter matrix elements.
Definition at line 225 of file vdgl_digital_region.cxx.
double vdgl_digital_region::XI | ( | ) | const |
The second order X,intensity moment of the region.
Definition at line 253 of file vdgl_digital_region.cxx.
float const* vdgl_digital_region::Xj | ( | ) | const [inline] |
The region pixel coordinates and intensities.
Definition at line 62 of file vdgl_digital_region.h.
float vdgl_digital_region::Xo | ( | ) | const |
The mean X value of the region.
Definition at line 200 of file vdgl_digital_region.cxx.
double vdgl_digital_region::XY | ( | ) | const |
The second order X,Y moment of the region.
Definition at line 239 of file vdgl_digital_region.cxx.
float vdgl_digital_region::Y | ( | ) | const |
The y pixel coordinate.
The Y pixel coordinate.
Definition at line 82 of file vdgl_digital_region.cxx.
double vdgl_digital_region::Y2 | ( | ) | const |
The second order Y moment of the region.
Definition at line 232 of file vdgl_digital_region.cxx.
double vdgl_digital_region::YI | ( | ) | const |
The second order Y,intensity moment of the region.
Definition at line 260 of file vdgl_digital_region.cxx.
float const* vdgl_digital_region::Yj | ( | ) | const [inline] |
Definition at line 63 of file vdgl_digital_region.h.
float vdgl_digital_region::Yo | ( | ) | const |
The mean Y value of the region.
Definition at line 206 of file vdgl_digital_region.cxx.
double vdgl_digital_region::error_ [mutable, protected] |
Definition at line 162 of file vdgl_digital_region.h.
bool vdgl_digital_region::fit_valid_ [mutable, protected] |
Has a plane fit been done?
Definition at line 156 of file vdgl_digital_region.h.
double vdgl_digital_region::I2_ [mutable, protected] |
Definition at line 161 of file vdgl_digital_region.h.
float vdgl_digital_region::io_ [protected] |
Mean Values.
Definition at line 149 of file vdgl_digital_region.h.
float vdgl_digital_region::io_stdev_ [protected] |
Intensity standard deviation for region.
Definition at line 150 of file vdgl_digital_region.h.
double vdgl_digital_region::Ix_ [mutable, protected] |
dI/dx
Definition at line 158 of file vdgl_digital_region.h.
double vdgl_digital_region::Iy_ [mutable, protected] |
dI/dy
Definition at line 159 of file vdgl_digital_region.h.
float vdgl_digital_region::max_ [protected] |
Definition at line 148 of file vdgl_digital_region.h.
float vdgl_digital_region::min_ [protected] |
Upper and lower bounds.
Definition at line 148 of file vdgl_digital_region.h.
unsigned int vdgl_digital_region::npts_ [protected] |
Number of pixels in the region.
Definition at line 144 of file vdgl_digital_region.h.
unsigned short* vdgl_digital_region::pix_ [protected] |
The pixel intensities.
Definition at line 147 of file vdgl_digital_region.h.
int vdgl_digital_region::pix_index_ [mutable, protected] |
Index in pixel array (iterator)
Definition at line 151 of file vdgl_digital_region.h.
float vdgl_digital_region::pixel_size_ [protected] |
Image pixel size in fractions of a pixel.
Definition at line 145 of file vdgl_digital_region.h.
bool vdgl_digital_region::scatter_matrix_valid_ [mutable, protected] |
Is the scatter matrix current?
Definition at line 157 of file vdgl_digital_region.h.
vnl_double_3x3 vdgl_digital_region::Si_ [mutable, protected] |
scatter matrix
Definition at line 163 of file vdgl_digital_region.h.
double vdgl_digital_region::sigma_sq_ [mutable, protected] |
fitting errors
Definition at line 162 of file vdgl_digital_region.h.
double vdgl_digital_region::X2_ [mutable, protected] |
The sums of various monomials to form the scatter matrix.
Definition at line 161 of file vdgl_digital_region.h.
double vdgl_digital_region::XI_ [mutable, protected] |
Definition at line 161 of file vdgl_digital_region.h.
float vdgl_digital_region::xo_ [protected] |
Definition at line 149 of file vdgl_digital_region.h.
float* vdgl_digital_region::xp_ [protected] |
Definition at line 146 of file vdgl_digital_region.h.
double vdgl_digital_region::XY_ [mutable, protected] |
Definition at line 161 of file vdgl_digital_region.h.
double vdgl_digital_region::Y2_ [mutable, protected] |
Definition at line 161 of file vdgl_digital_region.h.
double vdgl_digital_region::YI_ [mutable, protected] |
Definition at line 161 of file vdgl_digital_region.h.
float vdgl_digital_region::yo_ [protected] |
Definition at line 149 of file vdgl_digital_region.h.
float * vdgl_digital_region::yp_ [protected] |
The location of each pixel.
Definition at line 146 of file vdgl_digital_region.h.