31#ifndef SEGMENT_PROBER_H
32#define SEGMENT_PROBER_H
34#include <drain/image/ProbingControl.h>
37#include "drain/util/ReferenceMap.h"
38#include "CoordinateHandler.h"
55template <
class S,
class D>
61 link(
"anchor", this->anchor.tuple(),
"intensity");
64 link(
"marker", this->
markerValue,
"marker not universal?");
80 return anchor.contains(x);
97template <
class S,
class D,
class C>
119 control.markerImage.
setGeometry(s.getGeometry().area);
154 mout.
debug(control.handler );
173 bool HORZ_MODE = ((cp.xUnderFlowPolicy != EdgePolicy::POLAR) && (cp.xOverFlowPolicy != EdgePolicy::POLAR));
176 mout.
debug(
"Horz Probe");
177 for (
size_t i=0; i<src.getWidth(); ++i){
178 for (
size_t j=0; j<src.getHeight(); ++j){
190 mout.
debug(
"Vert Probe");
191 for (
size_t j=0; j<src.getHeight(); ++j){
192 for (
size_t i=0; i<src.getWidth(); ++i){
206 void probe(
int i,
int j,
bool HORIZONTAL){
210 if (control.handler.
validate(i, j)){
312 return (dst->
get<D>(i,j) != 0);
318 template <
int DI,
int DJ>
364 while (move<1,0>(i,j)){
375 while (move<-1,0>(i,j)){
391 if (control.handler.
validate(i2, j2)){
398 if (control.handler.
validate(i2, j2)){
423 while (move<0,1>(i,j)){
434 while (move<0,-1>(i,j)){
448 if (control.handler.
validate(i2, j2)){
455 if (control.handler.
validate(i2, j2)){
469template <
class S,
class D,
class C>
477 ostr <<
"conf: " << prober.conf <<
", ";
480 ostr <<
"handler: " << prober.control.handler <<
',';
544 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:313
Logger & debug(const TT &... args)
Debug information.
Definition Log.h:667
Logger & debug2(const TT &... args)
Debug information.
Definition Log.h:677
Definition ReferenceMap.h:215
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:415
Image with static geometry.
Definition ImageChannel.h:58
bool validate(Point2D< int > &p) const
Handles the coordinate, returning true if the position is reversible.
Definition CoordinateHandler.h:235
Policies for coordinate underflows and overflows.
Definition CoordinatePolicy.h:100
Definition SegmentProber.h:488
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:512
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:507
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:497
void put(size_t i, T x)
Sets the intensity in location i to x. See \address.
Definition ImageFrame.h:187
T get(size_t i) const
Gets the intensity at location i. See address().
Definition ImageFrame.h:249
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:87
Container for parameters of SegmentProber.
Definition SegmentProber.h:56
bool isValidIntensity(S x) const
Criterion.
Definition SegmentProber.h:79
D markerValue
"fill value", also dynamically changing visit marker?
Definition SegmentProber.h:75
A recursive method for visiting pixels of a segment in an image.
Definition SegmentProber.h:98
void scan()
A convenience function for traversing a whole image.
Definition SegmentProber.h:168
void probe(int i, int j, bool HORIZONTAL)
Start probings.
Definition SegmentProber.h:206
void scanHorzProbeVert(int i, int j)
A semi-recursive approach that turns the 2D recursion to 1D traversal + 1D recursion.
Definition SegmentProber.h:352
virtual void update(int i, int j)
Application dependent operation performed in each segment location (i,j).
Definition SegmentProber.h:273
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:311
bool move(int &i, int &j)
Try to move; change coords in success, else keep them intact.
Definition SegmentProber.h:320
bool isValidPixel(int i, int j) const
Returns isValidSegment(i,j) and !isVisited(i,j).
Definition SegmentProber.h:237
virtual void init()
Fills the segment having intensity between min and max.
Definition SegmentProber.h:149
void setDst(Channel &d)
Set new target channel. Needed in multichannel operations.
Definition SegmentProber.h:127
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SegmentProber.h:304
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:288
void scanVertProbeHorz(int i, int j)
Definition SegmentProber.h:411
virtual bool isValidMove(int i0, int j0, int i, int j) const
Application dependent, to be redefined. Note: assumes checked coordinates.
Definition SegmentProber.h:266
virtual bool isValidSegment(int i, int j) const =0
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:521
virtual bool isValidSegment(int i, int j) const
Application dependent, to be redefined. Assumes checked coordinates.
Definition SegmentProber.h:555
virtual void update(int i, int j)
Application dependent operation performed in each segment location (i,j).
Definition SegmentProber.h:550
virtual bool isVisited(int i, int j) const
Experimental.
Definition SegmentProber.h:543
virtual void clear()
Called before processing each segment. Compare with init(), which is called once for each image.
Definition SegmentProber.h:528
virtual void visit(int i, int j)
Visiting a single pixel when not coming from any direction.
Definition SegmentProber.h:534
Definition DataSelector.cpp:1277
Container for parameters of SegmentProber.
Definition ProbingControl.h:60
Definition ProbingControl.h:195