degate  0.1.2
Public Member Functions | Private Attributes
degate::WireMatching Class Reference

#include <WireMatching.h>

Inheritance diagram for degate::WireMatching:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WireMatching ()
virtual void init (BoundingBox const &bounding_box, Project_shptr project)
 
Exceptions:
InvalidPointerException
DegateRuntimeException

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

Detailed Description

Definition at line 31 of file WireMatching.h.


Constructor & Destructor Documentation

Definition at line 31 of file WireMatching.cc.


Member Function Documentation

void WireMatching::init ( BoundingBox const &  bounding_box,
Project_shptr  project 
) [virtual]

Exceptions:
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::ZeroCrossingEdgeDetection::run(), degate::LineSegmentExtraction< ImageType >::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);
  }

}

Here is the call graph for this function:

void WireMatching::set_median_filter_width ( unsigned int  median_filter_width)

Definition at line 65 of file WireMatching.cc.

References 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.

void WireMatching::set_sigma ( double  sigma)

Definition at line 69 of file WireMatching.cc.

References sigma.

                                         {
  this->sigma = sigma;
}
void WireMatching::set_wire_diameter ( unsigned int  wire_diameter)

Definition at line 61 of file WireMatching.cc.

References wire_diameter.


Member Data Documentation

Definition at line 41 of file WireMatching.h.

Referenced by init(), and run().

Definition at line 39 of file WireMatching.h.

Referenced by init(), and run().

Definition at line 35 of file WireMatching.h.

Referenced by init(), and run().

Definition at line 36 of file WireMatching.h.

Referenced by init(), and run().

Definition at line 37 of file WireMatching.h.

Referenced by run(), and set_median_filter_width().

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().


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