|
degate 0.1.1
|
#include <WireMatching.h>

Public Member Functions | |||||
| WireMatching () | |||||
| virtual void | init (BoundingBox const &bounding_box, Project_shptr project) | ||||
| |||||
| virtual void | run () | ||||
| void | set_wire_diameter (unsigned int wire_diameter) | ||||
| void | set_median_filter_width (unsigned int median_filter_width) | ||||
| void | set_sigma (double sigma) | ||||
| void | set_min_edge_magnitude (double min_edge_magnitude) | ||||
Private Attributes | |||||
| Layer_shptr | layer | ||||
| LogicModel_shptr | lmodel | ||||
| unsigned int | wire_diameter | ||||
| unsigned int | median_filter_width | ||||
| double | sigma | ||||
| double | min_edge_magnitude | ||||
| BackgroundImage_shptr | img | ||||
| BoundingBox | bounding_box | ||||
Definition at line 31 of file WireMatching.h.
| WireMatching::WireMatching | ( | ) |
Definition at line 31 of file WireMatching.cc.
: wire_diameter(5), median_filter_width(3), sigma(0.5), min_edge_magnitude(0.25) { }
| void WireMatching::init | ( | BoundingBox const & | bounding_box, |
| Project_shptr | project | ||
| ) | [virtual] |
| InvalidPointerException | |
| DegateRuntimeException |
Implements degate::Matching.
Definition at line 39 of file WireMatching.cc.
References bounding_box, img, layer, and lmodel.
{
this->bounding_box = bounding_box;
if(project == NULL)
throw InvalidPointerException("Invalid pointer for parameter project.");
lmodel = project->get_logic_model();
assert(lmodel != NULL); // always has a logic model
layer = lmodel->get_current_layer();
if(layer == NULL) throw DegateRuntimeException("No current layer in project.");
ScalingManager_shptr sm = layer->get_scaling_manager();
assert(sm != NULL);
img = sm->get_image(1).second;
assert(img != NULL);
}
| void WireMatching::run | ( | ) | [virtual] |
Implements degate::Matching.
Definition at line 77 of file WireMatching.cc.
References bounding_box, debug(), degate::EdgeDetection::get_border(), degate::BoundingBox::get_max_x(), degate::BoundingBox::get_max_y(), degate::BoundingBox::get_min_x(), degate::BoundingBox::get_min_y(), img, layer, lmodel, median_filter_width, min_edge_magnitude, degate::LineSegmentExtraction< ImageType >::run(), degate::ZeroCrossingEdgeDetection::run(), sigma, TM, and wire_diameter.
{
ZeroCrossingEdgeDetection ed(bounding_box.get_min_x(),
bounding_box.get_max_x(),
bounding_box.get_min_y(),
bounding_box.get_max_y(),
median_filter_width,
sigma > 0 ? 10 : 0,
sigma,
wire_diameter >> 1,
wire_diameter + (wire_diameter >> 1),
min_edge_magnitude, 0.5);
TileImage_GS_DOUBLE_shptr i = ed.run(img, TileImage_GS_DOUBLE_shptr(), "/tmp");
assert(i != NULL);
LineSegmentExtraction<TileImage_GS_DOUBLE> extraction(i, wire_diameter/2, 2, ed.get_border());
LineSegmentMap_shptr line_segments = extraction.run();
assert(line_segments != NULL);
assert(lmodel != NULL);
assert(layer != NULL);
BOOST_FOREACH(LineSegment_shptr ls, *line_segments) {
debug(TM, "found wire");
Wire_shptr w(new Wire(bounding_box.get_min_x() + ls->get_from_x(),
bounding_box.get_min_y() + ls->get_from_y(),
bounding_box.get_min_x() + ls->get_to_x(),
bounding_box.get_min_y() + ls->get_to_y(),
wire_diameter));
lmodel->add_object(layer->get_layer_pos(), w);
}
}

| void WireMatching::set_median_filter_width | ( | unsigned int | median_filter_width | ) |
Definition at line 65 of file WireMatching.cc.
References median_filter_width.
{
this->median_filter_width = median_filter_width;
}
| void WireMatching::set_min_edge_magnitude | ( | double | min_edge_magnitude | ) |
Definition at line 73 of file WireMatching.cc.
References min_edge_magnitude.
{
this->min_edge_magnitude = min_edge_magnitude;
}
| void WireMatching::set_sigma | ( | double | sigma | ) |
| void WireMatching::set_wire_diameter | ( | unsigned int | wire_diameter | ) |
Definition at line 61 of file WireMatching.cc.
References wire_diameter.
{
this->wire_diameter = wire_diameter;
}
Definition at line 41 of file WireMatching.h.
Definition at line 39 of file WireMatching.h.
Layer_shptr degate::WireMatching::layer [private] |
Definition at line 35 of file WireMatching.h.
LogicModel_shptr degate::WireMatching::lmodel [private] |
Definition at line 36 of file WireMatching.h.
unsigned int degate::WireMatching::median_filter_width [private] |
Definition at line 37 of file WireMatching.h.
Referenced by run(), and set_median_filter_width().
double degate::WireMatching::min_edge_magnitude [private] |
Definition at line 38 of file WireMatching.h.
Referenced by run(), and set_min_edge_magnitude().
double degate::WireMatching::sigma [private] |
Definition at line 38 of file WireMatching.h.
Referenced by run(), and set_sigma().
unsigned int degate::WireMatching::wire_diameter [private] |
Definition at line 37 of file WireMatching.h.
Referenced by run(), and set_wire_diameter().
1.7.4