#include <gevd_edgel_regions.h>
Definition at line 57 of file gevd_edgel_regions.h.
Public Types | |
| enum | RegionLabel { UNLABELED = 0, EDGE, LABEL } |
Public Member Functions | |
| gevd_edgel_regions (bool debug=false) | |
| Default constructor. | |
| ~gevd_edgel_regions () | |
| Default destructor. | |
| bool | compute_edgel_regions (vil1_image *image, vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
| The key process loop. | |
| bool | compute_edgel_regions (gevd_bufferxy *buf, vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
| void | SetVerbose () |
| void | ClearVerbose () |
| void | SetDebug () |
| void | ClearDebug () |
| void | set_magnification (float magnification) |
| unsigned int | BaseLabel (unsigned int label) |
| Get the most basic label equivalent to a given label. | |
| unsigned int | GetMaxRegionLabel () |
| void | SetMaxRegionLabel (unsigned int label) |
| unsigned int ** | GetRegionArray () |
| int | GetXSize () |
| int | GetYSize () |
| vil1_image * | GetEdgeImage (vcl_vector< vtol_edge_2d_sptr > &edgels) |
| Paint the edgels into the region label array and then output an image where the value is 255 if the pixel is an edge, 0 otherwise. | |
| bool | InsertRegionEquivalence (unsigned int label_b, unsigned int label_a) |
| assign equivalence of region label b to region label a. | |
| void | GrowEquivalenceClasses () |
| Form equivalence classes by transitive closure on each label. | |
| void | PropagateEquivalence () |
| Populate the label_map_ to reflect the equivalences between labels. | |
| unsigned int | GetLabel (vtol_edge_2d_sptr e, unsigned int nr) |
| Get the a region label for an edge used to construct the boundaries. | |
| void | print_region_array () |
| void | print_region_equivalence () |
| void | print_reverse_region_equivalence () |
| void | print_base_equivalence () |
| void | print_intensity_data () |
Protected Member Functions | |
| bool | GroupContainsEdges (vcl_vector< vtol_edge_2d_sptr > &sg) |
| Check if the SpatialGroup contains Edge(s). | |
| bool | InitRegionArray (vcl_vector< vtol_edge_2d_sptr > &sg) |
| Initialize the region label array. | |
| unsigned char | label_code (unsigned int label) |
| Get code for a given label. | |
| bool | add_to_forward (unsigned int key, unsigned int value) |
| Add a new pair to the forward equivalence list. | |
| bool | add_to_reverse (unsigned int key, unsigned int value) |
| Add a new pair to the reverse equivalence list. | |
| unsigned char | EncodeNeighborhood (unsigned int ul, unsigned int ur, unsigned int ll, unsigned int lr) |
| Encode a 2x2 neighbor hood with the state of the region array for a given location. | |
| void | UpdateConnectedNeighborhood (unsigned int x, unsigned int y) |
| Propagate connected components. | |
| void | AssignEdgeLabels (unsigned int x, unsigned int y) |
| After connected components have been generated pass over the array and assign region labels to the gevd_region_edge(s). | |
| void | ApplyRegionEquivalence () |
| Scan the region_label_array_ and apply the region equivalence map. | |
| bool | out_of_bounds (unsigned int x, unsigned int y) |
| Bounds check on region_label_array_. | |
| void | insert_adjacency (unsigned int region, vtol_edge_2d_sptr e) |
| Insert an Edge into the adjacency list for a region. | |
| void | CollectEdges () |
| Get the edges adjacent to each region. | |
| void | CollectFaceEdges () |
| Trace through the topology network keeping regions on the left. | |
| void | ConstructFaces () |
| Construct Face(s) from Edge(s) in the face_edge_index_ array. | |
| void | AccumulateMeans () |
| Accumulate intensity statistics from each region and update the vtol_intensity_face parameters. | |
| void | AccumulateRegionData () |
| Insert region pixels into the vtol_intensity_face arrays. | |
| void | InsertFaceData () |
| Do both a scatter matrix update and insertion into the region pixel arrays of each intensity face. | |
| unsigned int | X (unsigned int x) |
| The region array can be offset from the corner of the ROI. | |
| unsigned int | Y (unsigned int y) |
| unsigned int | Xf (float x) |
| Casts the float x location of a point to an unsigned-int location. | |
| unsigned int | Yf (float y) |
| Casts the float x location of a point to an unsigned-int location. | |
| bool | insert_edgel (float pre_x, float pre_y, float x, float y, gevd_region_edge *e) |
| A utility for inserting an edgel into the region_label_array_. | |
| void | insert_equivalence (unsigned int ll, unsigned int ur, unsigned int &lr) |
| bool | merge_equivalence (vcl_map< unsigned int, vcl_vector< unsigned int > * > &tab, unsigned int cur_label, unsigned int label) |
| Find the set of labels equivalent to label from a given hash table and merge into the appropriate equivalence set. | |
| bool | get_next_label (vcl_vector< unsigned int > *labels, unsigned int &label) |
| Find the next label not accounted for in the current equivalence set. | |
| void | print_edge_colis (unsigned int x, unsigned int y, gevd_region_edge *r1, gevd_region_edge *r2) |
| bool | corrupt_boundary (vcl_vector< vtol_edge_2d_sptr > &edges, vcl_vector< vtol_vertex_sptr > &bad_verts) |
| In a correct boundary, each vertex must appear twice, i.e. | |
| bool | remove_hairs (vcl_vector< vtol_edge_2d_sptr > &edges) |
| Remove hairs from region boundary. | |
| bool | connect_ends (vcl_vector< vtol_edge_2d_sptr > &edges, vcl_vector< vtol_vertex_sptr > &bad_verts) |
| void | repair_failed_insertions (vcl_vector< vtol_edge_2d_sptr > &edges, vcl_vector< vtol_vertex_sptr > &bad_verts) |
| There can be some gaps in the region boundary due to missing edges caused by a high local density of vertices. | |
| void | get_buffer_row (unsigned int row) |
| get a row from a BufferXY. | |
| void | get_image_row (unsigned int row) |
| Get an image row. | |
| unsigned short | get_intensity (unsigned int x) |
| Get the intensity of a single pixel. | |
| int | bytes_per_pix () |
| bool | compute_edgel_regions (vcl_vector< vtol_edge_2d_sptr > &sgrp, vcl_vector< vtol_intensity_face_sptr > &faces) |
Protected Attributes | |
| bool | verbose_ |
| bool | debug_ |
| bool | image_source_ |
| bool | buf_source_ |
| float | magnification_ |
| vil1_image * | image_ |
| gevd_bufferxy * | buf_ |
| gevd_region_edge *** | edge_boundary_array_ |
| unsigned int ** | region_label_array_ |
| unsigned int | min_region_label_ |
| unsigned int | max_region_label_ |
| float | Xob_ |
| float | Yob_ |
| unsigned int | xo_ |
| unsigned int | yo_ |
| unsigned int | xend_ |
| unsigned int | yend_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | region_pairs_forward_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | region_pairs_reverse_ |
| vcl_map< unsigned int, vcl_vector< unsigned int > * > | equivalence_set_ |
| vcl_map< unsigned int, unsigned int > | label_map_ |
| vcl_map< int, gevd_region_edge * > | region_edges_ |
| vcl_map< unsigned int, vcl_vector< vtol_edge_2d_sptr > * > | region_edge_adjacency_ |
| vcl_vector< vtol_intensity_face_sptr > * | faces_ |
| vtol_intensity_face_sptr * | intensity_face_index_ |
| vcl_vector< vtol_edge_2d_sptr > ** | face_edge_index_ |
| vcl_vector< vtol_edge_2d_sptr > * | failed_insertions_ |
| unsigned char * | ubuf_ |
| unsigned short * | sbuf_ |
|
|
Definition at line 60 of file gevd_edgel_regions.h. |
|
|
Default constructor.
Definition at line 176 of file gevd_edgel_regions.cxx. |
|
|
Default destructor.
Definition at line 208 of file gevd_edgel_regions.cxx. |
|
|
Accumulate intensity statistics from each region and update the vtol_intensity_face parameters.
Definition at line 1996 of file gevd_edgel_regions.cxx. |
|
|
Insert region pixels into the vtol_intensity_face arrays.
Definition at line 2034 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Add a new pair to the forward equivalence list. That is, a ==> b. Note that there can be multiple equivalences which are stored in a vcl_vector Definition at line 899 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Add a new pair to the reverse equivalence list. That is, b==>a. Note that there can be multiple equivalences which are stored in a vcl_vector Definition at line 933 of file gevd_edgel_regions.cxx. |
|
|
Scan the region_label_array_ and apply the region equivalence map. The result is that all equivalences are reconciled with the smallest labels. Definition at line 1720 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
After connected components have been generated pass over the array and assign region labels to the gevd_region_edge(s). As in UpdateConnectedNeighborhood, the algorithm uses a 2x2 neigborhood E.G., ee But the purpose is to assign labels. No updating of the aa region_label_array_ is carried out. Note that the 2x2 neighborhood is encoded as uchar = [ul|ur|ll|lr] 2 2 2 2 bits Definition at line 1561 of file gevd_edgel_regions.cxx. |
|
|
Get the most basic label equivalent to a given label. If the label_map_ is not defined, this function uses the forward label hash table. Otherwise 0 is returned. Definition at line 392 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 709 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 76 of file gevd_edgel_regions.h. |
|
|
Definition at line 74 of file gevd_edgel_regions.h. |
|
|
Get the edges adjacent to each region.
Definition at line 1776 of file gevd_edgel_regions.cxx. |
|
|
Trace through the topology network keeping regions on the left. At this point, we have a list of edges for each region. We will trace out the list and form OneCycle(s). Then the set of OneCycle(s) will form the boundary of the face corresponding to the region. Definition at line 1803 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Definition at line 301 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||
|
Definition at line 273 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||
|
The key process loop. Carries out the steps: 1) Connected components 2)Edge-label assignment 3)Collect region boundaries 4) Construct vtol_intensity_faces 5)Calculate intensity fit Definition at line 290 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Definition at line 1419 of file gevd_edgel_regions.cxx. |
|
|
Construct Face(s) from Edge(s) in the face_edge_index_ array. This method has been made virtual so that sub-classes of vtol_intensity_face can be constructed by sub-classes of gevd_edgel_regions. Definition at line 1881 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
In a correct boundary, each vertex must appear twice, i.e. , shared by two edges. The only exception is a closed loop with one vertex, but in this case, one edge shares the same vertex twice. This routine tests this constraint. Definition at line 1265 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||||||
|
Encode a 2x2 neighbor hood with the state of the region array for a given location. The Neighborhood The states are: ul ur UNLABELED, EDGE, LABEL ll lr 0 1 2 The encoding maps the 2x2 pattern to an unsigned char. The layout of the uchar is: [ul|ur|ll|lr] with 2 bits for the state of each position. Definition at line 971 of file gevd_edgel_regions.cxx. |
|
|
get a row from a BufferXY.
Definition at line 1931 of file gevd_edgel_regions.cxx. |
|
|
Get an image row.
Definition at line 1955 of file gevd_edgel_regions.cxx. |
|
|
Get the intensity of a single pixel.
Definition at line 1977 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Find the next label not accounted for in the current equivalence set. The set of labels is searched to find a label larger than label, but not in the set, labels. Definition at line 511 of file gevd_edgel_regions.cxx. |
|
|
Paint the edgels into the region label array and then output an image where the value is 255 if the pixel is an edge, 0 otherwise.
Definition at line 407 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Get the a region label for an edge used to construct the boundaries. A return corresponding to UNLABELED means the domain outside the ROI or nr is larger than the number of adjacent regions. Definition at line 1746 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 79 of file gevd_edgel_regions.h. |
|
|
Definition at line 81 of file gevd_edgel_regions.h. |
|
|
Definition at line 82 of file gevd_edgel_regions.h. |
|
|
Definition at line 83 of file gevd_edgel_regions.h. |
|
|
Check if the SpatialGroup contains Edge(s).
Definition at line 603 of file gevd_edgel_regions.cxx. |
|
|
Form equivalence classes by transitive closure on each label. The idea is to add labels to the set, cur_set, by equivalence until no new equivalence groups can be found. The current equivalence class, cur_set is repeatedly scanned when new labels are added to pick up new equivalence groups. Old equivalence table entries are removed as they are used. When the equivalence class corresponding to cur_lable is completely closed, then a new label not in a previously formed equivalence class is used to seed a new equivalence class. Definition at line 549 of file gevd_edgel_regions.cxx. |
|
|
Initialize the region label array. There are three types of region label symbols: 1) UNLABELED - no label has yet been assigned, 2) EDGE, the existence of an edgel boundary pixel. 3) An unsigned integer which represents an existing region label. Definition at line 727 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Insert an Edge into the adjacency list for a region.
Definition at line 1757 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||||||||||
|
A utility for inserting an edgel into the region_label_array_. An edgel and a previous edgel in the chain are used to interpolate intermediate edgels to take account of pixel quantization Definition at line 674 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||
|
Definition at line 997 of file gevd_edgel_regions.cxx. |
|
|
Do both a scatter matrix update and insertion into the region pixel arrays of each intensity face. AccumulateScatterData is done first so that the number of pixels can be determined. Definition at line 2072 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
assign equivalence of region label b to region label a.
Definition at line 379 of file gevd_edgel_regions.cxx. |
|
|
Get code for a given label.
Definition at line 885 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||
|
Find the set of labels equivalent to label from a given hash table and merge into the appropriate equivalence set. cur_label is the equivalence set being formed. label is the table key of equivalences to be merged. Definition at line 462 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
Bounds check on region_label_array_.
Definition at line 1737 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 121 of file gevd_edgel_regions.cxx. |
|
||||||||||||||||||||
|
Definition at line 1250 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 131 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 74 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 91 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 106 of file gevd_edgel_regions.cxx. |
|
|
Populate the label_map_ to reflect the equivalences between labels.
Definition at line 436 of file gevd_edgel_regions.cxx. |
|
|
Remove hairs from region boundary. This condition can occur because the region labels are not sub-pixel. A "hair" is an extra edge joined at a vertex which is part of a continuous chain. Unattached vertices are detected by incrementing a count at each vertex for each attached edge in the input array, "edges". Such hairs are removed from the input array. Definition at line 1362 of file gevd_edgel_regions.cxx. |
|
||||||||||||
|
There can be some gaps in the region boundary due to missing edges caused by a high local density of vertices. Take each un-attached vertex and look for a match in the failed edge insertion array. If an edge can be attached, do so. Definition at line 1521 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 77 of file gevd_edgel_regions.h. |
|
|
Definition at line 75 of file gevd_edgel_regions.h. |
|
|
Definition at line 80 of file gevd_edgel_regions.h. |
|
|
Definition at line 73 of file gevd_edgel_regions.h. |
|
||||||||||||
|
Propagate connected components. Uses an unsigned char encoding a 2x2 neighborhood to propagate region labels. For example: aa -> aa xx -> aa Here the lower two labels are set to the upper label. This method operates directly on the region_label_array_. Note that the 2x2 neighborhood is encoded as uchar = [ul|ur|ll|lr] 2 2 2 2 bits Definition at line 1027 of file gevd_edgel_regions.cxx. |
|
|
The region array can be offset from the corner of the ROI. The following two methods transform from the ROI coordinate system to the region label array coordinate system Definition at line 148 of file gevd_edgel_regions.cxx. |
|
|
Casts the float x location of a point to an unsigned-int location.
Definition at line 160 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 153 of file gevd_edgel_regions.cxx. |
|
|
Casts the float x location of a point to an unsigned-int location.
Definition at line 168 of file gevd_edgel_regions.cxx. |
|
|
Definition at line 155 of file gevd_edgel_regions.h. |
|
|
Definition at line 152 of file gevd_edgel_regions.h. |
|
|
Definition at line 150 of file gevd_edgel_regions.h. |
|
|
Definition at line 156 of file gevd_edgel_regions.h. |
|
|
Definition at line 169 of file gevd_edgel_regions.h. |
|
|
Definition at line 177 of file gevd_edgel_regions.h. |
|
|
Definition at line 175 of file gevd_edgel_regions.h. |
|
|
Definition at line 178 of file gevd_edgel_regions.h. |
|
|
Definition at line 154 of file gevd_edgel_regions.h. |
|
|
Definition at line 151 of file gevd_edgel_regions.h. |
|
|