Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SegmentProber< S, D, C > Class Template Referenceabstract

A recursive method for visiting pixels of a segment in an image. More...

#include <SegmentProber.h>

Collaboration diagram for SegmentProber< S, D, C >:
Collaboration graph
[legend]

Public Types

typedef S src_t
 
typedef D dst_t
 
typedef C conf_t
 

Public Member Functions

 SegmentProber (const Channel &s)
 
 SegmentProber (const Channel &s, Channel &d)
 
void setDst (Channel &d)
 Set new target channel. Needed in multichannel operations.
 
virtual void init ()
 Fills the segment having intensity between min and max. More...
 
void scan ()
 A convenience function for traversing a whole image. More...
 
void probe (int i, int j, bool HORIZONTAL)
 Start probings.
 
bool isValidPixel (int i, int j) const
 Returns isValidSegment(i,j) and !isVisited(i,j).
 
virtual bool isValidSegment (int i, int j) const =0
 Application dependent, to be redefined. Assumes checked coordinates. More...
 

Public Attributes

ProberControlcontrol
 
conf_t conf
 
const Channelsrc
 
Channeldst
 

Protected Member Functions

virtual bool isValidMove (int i0, int j0, int i, int j) const
 Application dependent, to be redefined. Note: assumes checked coordinates. More...
 
virtual void update (int i, int j)
 Application dependent operation performed in each segment location (i,j).
 
virtual void visit (int i, int j)
 Visiting a single pixel when not coming from any direction. More...
 
virtual void clear ()
 Called before processing each segment. Compare with init(), which is called once for each image. More...
 
virtual bool isVisited (int i, int j) const
 Experimental.
 
template<int DI, int DJ>
bool move (int &i, int &j)
 Try to move; change coords in success, else keep them intact.
 
void scanHorzProbeVert (int i, int j)
 A semi-recursive approach that turns the 2D recursion to 1D traversal + 1D recursion. More...
 
void scanVertProbeHorz (int i, int j)
 

Protected Attributes

SimpleProberControl basicControl
 

Detailed Description

template<class S, class D, class C>
class drain::image::SegmentProber< S, D, C >

A recursive method for visiting pixels of a segment in an image.

A helper class applied by FloodFillOp and SegmentAreaOp.

Template Parameters
S- storage type of the source image data (int by default, but should be floating-type, if src is).
D- storage type of the destination image data
C- configuration type,
Author
Marku.nosp@m.s.Pe.nosp@m.ura@f.nosp@m.mi.f.nosp@m.i

Member Function Documentation

◆ clear()

virtual void clear ( )
inlineprotectedvirtual

Called before processing each segment. Compare with init(), which is called once for each image.

Application dependent initialisation for statistics updated with update(int i, int j) function.

Reimplemented in DopplerSegmentProber, SuperProber, SegmentStatisticsProber< T, D >, and SizeProber.

◆ init()

virtual void init ( )
inlinevirtual

Fills the segment having intensity between min and max.

Called after src and dst have been set, but before processing. See clear().

Reimplemented in DopplerSegmentProber.

◆ isValidMove()

virtual bool isValidMove ( int  i0,
int  j0,
int  i,
int  j 
) const
inlineprotectedvirtual

Application dependent, to be redefined. Note: assumes checked coordinates.

Application dependent. Assumes checked coordinates.

Reimplemented in DopplerSegmentProber.

◆ isValidSegment()

virtual bool isValidSegment ( int  i,
int  j 
) const
pure virtual

Application dependent, to be redefined. Assumes checked coordinates.

Determines if the current position is within a segment. The criterion of "segment" depends on the application.

Note: does not check coordinates, assumes them to be checked by the calling scope.

Implemented in DopplerSegmentProber, SuperProber, SegmentStatisticsProber< T, D >, SizeProber, and FillProber.

◆ scan()

void scan ( )
inline

A convenience function for traversing a whole image.

Applicable in cases where probing parameters are not spatically ("dynamically") changing.

◆ scanHorzProbeVert()

void scanHorzProbeVert ( int  i,
int  j 
)
inlineprotected

A semi-recursive approach that turns the 2D recursion to 1D traversal + 1D recursion.

s * the horizontal direction is handled sequentially whereas the vertical direction handled recursively. Compared to fully recursive approach, this technique preserves the speed but offers smaller consumption of memory.

Scan right. Note than i may wrap beyond image width.

Scan left

Scan again, continuing one step above and below.

◆ scanVertProbeHorz()

void scanVertProbeHorz ( int  i,
int  j 
)
inlineprotected

Scan DOWN. Note than j may wrap beyond image height.

Scan UP

Scan again, continuing one step above and below.

◆ visit()

virtual void visit ( int  i,
int  j 
)
inlineprotectedvirtual

Visiting a single pixel when not coming from any direction.

Visiting means

  • updating the status of this prober, for example by updating statistics like segment size
  • marking the pixel visited in dst image
Parameters
i0- current i coordinate (always valid)
j0- current j coordinate (always valid)

Mark visited

Reimplemented in DopplerSegmentProber, SizeProber, and FillProber.


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