31#ifndef SEGMENT_PROBER_H 
   32#define SEGMENT_PROBER_H 
   34#include <drain/image/ProbingControl.h>   
   38#include "drain/util/ReferenceMap.h" 
   39#include "CoordinateHandler.h" 
   57template <
class S, 
class D>
 
   63        link(
"anchor", this->anchor.tuple(), 
"intensity");
 
   66        link(
"marker", this->
markerValue, 
"marker not universal?");
 
   82        return anchor.contains(x);
 
 
 
   99template <
class S, 
class D, 
class C>
 
  121        control.markerImage.
setGeometry(s.getGeometry().area);
 
  156        mout.
debug(control.handler );
 
 
  175        bool HORZ_MODE = ((cp.xUnderFlowPolicy != EdgePolicy::POLAR) && (cp.xOverFlowPolicy != EdgePolicy::POLAR));
 
  178            mout.
debug(
"Horz Probe");
 
  179            for (
size_t i=0; i<src.getWidth(); ++i){
 
  180                for (
size_t j=0; j<src.getHeight(); ++j){
 
  192            mout.
debug(
"Vert Probe");
 
  193            for (
size_t j=0; j<src.getHeight(); ++j){
 
  194                for (
size_t i=0; i<src.getWidth(); ++i){
 
 
  208    void probe(
int i, 
int j, 
bool HORIZONTAL){
 
  212        if (control.handler.
validate(i, j)){
 
 
  314        return (dst->
get<D>(i,j) != 0);
 
 
  320    template <
int DI, 
int DJ>
 
  366        while (move<1,0>(i,j)){
 
  377        while (move<-1,0>(i,j)){
 
  393            if (control.handler.
validate(i2, j2)){
 
  400            if (control.handler.
validate(i2, j2)){
 
 
  425        while (move<0,1>(i,j)){
 
  436        while (move<0,-1>(i,j)){
 
  450            if (control.handler.
validate(i2, j2)){
 
  457            if (control.handler.
validate(i2, j2)){
 
 
 
  471template <
class S, 
class D, 
class C>
 
  479    ostr << 
"conf: " << prober.conf << 
", ";
 
  482    ostr << 
"handler: "   << prober.control.handler << 
',';
 
  546        return (dst->
get<dst_t>(i,j) > 0);
 
 
 
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Logger & debug(const TT &... args)
Debug information.
Definition Log.h:666
Logger & debug2(const TT &... args)
Debug information.
Definition Log.h:676
Definition ReferenceMap.h:207
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition ReferenceMap.h:407
Image with static geometry.
Definition ImageChannel.h:60
bool validate(Point2D< int > &p) const
Handles the coordinate, returning true if the position is reversible.
Definition CoordinateHandler.h:238
Policies for coordinate underflows and overflows.
Definition CoordinatePolicy.h:106
Definition SegmentProber.h:490
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:514
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:509
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:499
void put(size_t i, T x)
Sets the intensity in location i to x. See \address.
Definition ImageFrame.h:189
T get(size_t i) const
Gets the intensity at location i. See address().
Definition ImageFrame.h:251
const CoordinatePolicy & getCoordinatePolicy() const
Coord policy.
Definition ImageLike.h:174
virtual void setGeometry(size_t width, size_t height, size_t imageChannels=1, size_t alphaChannels=0)
Resizes the image, keeps the current type.
Definition Image.h:97
Container for parameters of SegmentProber.
Definition SegmentProber.h:58
bool isValidIntensity(S x) const
Criterion.
Definition SegmentProber.h:81
D markerValue
"fill value", also dynamically changing visit marker?
Definition SegmentProber.h:77
A recursive method for visiting pixels of a segment in an image.
Definition SegmentProber.h:100
void scan()
A convenience function for traversing a whole image.
Definition SegmentProber.h:170
void probe(int i, int j, bool HORIZONTAL)
Start probings.
Definition SegmentProber.h:208
void scanHorzProbeVert(int i, int j)
A semi-recursive approach that turns the 2D recursion to 1D traversal + 1D recursion.
Definition SegmentProber.h:354
virtual void update(int i, int j)
Application dependent operation performed in each segment location (i,j).
Definition SegmentProber.h:275
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:313
bool move(int &i, int &j)
Try to move; change coords in success, else keep them intact.
Definition SegmentProber.h:322
bool isValidPixel(int i, int j) const
Returns isValidSegment(i,j) and !isVisited(i,j).
Definition SegmentProber.h:239
virtual void init()
Fills the segment having intensity between min and max.
Definition SegmentProber.h:151
void setDst(Channel &d)
Set new target channel. Needed in multichannel operations.
Definition SegmentProber.h:129
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SegmentProber.h:306
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:290
void scanVertProbeHorz(int i, int j)
Definition SegmentProber.h:413
virtual bool isValidMove(int i0, int j0, int i, int j) const
Application dependent, to be redefined. Note: assumes checked coordinates.
Definition SegmentProber.h:268
virtual bool isValidSegment(int i, int j) const =0
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:523
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:557
virtual void update(int i, int j)
Application dependent operation performed in each segment location (i,j).
Definition SegmentProber.h:552
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:545
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SegmentProber.h:530
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:536
Definition DataSelector.cpp:1277
Container for parameters of SegmentProber.
Definition ProbingControl.h:60
Definition ProbingControl.h:195