![]() |
|
Base class for linear and exponential distances in rectangular pixel images. More...
#include <DistanceModel.h>


Public Types | |
| enum | PIXEL_ADJACENCY { CONN_UNSET =0 , CONN4 =4 , CONN8 =8 , KNIGHT =16 } |
| typedef PIXEL_ADJACENCY | topol_t |
| typedef drain::EnumFlagger< drain::SingleFlagger< PIXEL_ADJACENCY > > | PixelAdjacencyFlagger |
Public Types inherited from BeanLike | |
| typedef ReferenceMap | map_t |
Public Member Functions | |
| void | setMax (float maxCodeValue) |
| Set maximum (expected) code value. Radii, if given, will set pixel-to-pixel decrements scaled to this value. | |
| float | getMax () const |
| Returns the maximum (expected) code value. | |
| virtual void | setRadius (float horz, float vert=nan_f, float horzLeft=nan_f, float vertUp=nan_f)=0 |
| Sets the geometry of the distance model. | |
| void | setRadiusVerbatim (float horz, float vert=nan_f, float horzLeft=nan_f, float vertUp=nan_f) |
| Simply copies values, does not try to set defaults. | |
| const Bidirectional< float > & | getRadiusHorz () const |
| const Bidirectional< float > & | getRadiusVert () const |
| virtual void | setDecrement (float horz, float vert=NAN, float horzRight=NAN, float vertUp=NAN)=0 |
| virtual DistanceElement | getElement (short dx, short dy, bool forward=true) const =0 |
| void | update () |
| virtual void | updateBean () const override |
| Called after setParameters() | |
| void | setTopology (PIXEL_ADJACENCY topology) |
| Sets the topology of the computation grid: 0=diamond, 1=diagonal, 2=extended (chess knight steps) | |
| void | setTopology (const std::string &topology) |
| void | createChain (DistanceNeighbourhood &chain, PIXEL_ADJACENCY topology=PIXEL_ADJACENCY::KNIGHT, bool forward=true) const |
| Creates a list of DistanceElements. | |
| void | createChain (DistanceNeighbourhood &chain, bool forward=true) const |
| virtual float | decrease (float value, float coeff) const =0 |
Public Member Functions inherited from BeanLike | |
| BeanLike (const BeanLike &b) | |
| BeanLike (const std::string &name, const std::string &description="") | |
| virtual const std::string & | getName () const |
| Return the name of an instance. | |
| virtual const std::string & | getDescription () const |
| Return a brief description. | |
| bool | hasParameters () const |
| template<class F > | |
| F | getParameter (const std::string &p) const |
| Gets a single parameter. | |
| const map_t & | getParameters () const |
| map_t & | getParameters () |
| template<class F > | |
| void | setParametersFromEntries (const F &args) |
| void | setParameters (std::initializer_list< Variable::init_pair_t > args) |
| Grants access to (if above hidden) | |
| virtual void | setParameters (const std::string &p, char assignmentSymbol='=', char separatorSymbol=0) |
| Sets comma-separated parameters in a predetermined order "a,b,c" or by specifing them "b=2". | |
| template<class T > | |
| void | setParameters (const std::map< std::string, T > &args) |
| Set parameters. | |
| template<class T > | |
| void | setParameters (const SmartMap< T > &args) |
| Set parameters. | |
| void | setParameter (const std::string &p, const Castable &value) |
| Sets a single parameter. | |
| template<class T > | |
| void | setParameter (const std::string &p, const VariableT< T > &value) |
| template<class F > | |
| void | setParameter (const std::string &p, const F &value) |
| Sets a single parameter. | |
| template<class F > | |
| void | setParameter (const std::string &p, std::initializer_list< F > value) |
| Sets a single parameter. | |
| BeanLike & | operator= (const BeanLike &b) |
| virtual std::ostream & | toStream (std::ostream &ostr, bool compact=true) const |
Public Attributes | |
| PixelAdjacencyFlagger | pixelAdjacency |
Static Public Attributes | |
| static const float | nan_f = std::numeric_limits<float>::quiet_NaN() |
Protected Member Functions | |
| DistanceModel (const std::string &name, const std::string &description="") | |
| Base class for digital distance models. Supports 4-, 8- and extended "chess knight" distance. | |
| DistanceModel (const DistanceModel &dm) | |
Protected Member Functions inherited from BeanLike | |
| virtual void | storeLastArguments (const std::string &p) |
| Called after setParameters() | |
Protected Attributes | |
| std::string | pixelAdjacencyStr |
| drain::Bidirectional< float > | horzRadius |
| drain::Bidirectional< float > | vertRadius |
| drain::Bidirectional< float > | horzDec |
| Final decrement or decay per pixel in horizontal direction. Derived from horzRadius; definition varies in subclasses. | |
| drain::Bidirectional< float > | vertDec |
| Final decrement or decay per pixel in vertical direction. Derived from vertRadius; definition varies in subclasses. | |
| float | maxCodeValue |
| Needed internally to get diag decrement larger than horz/vert decrements. (Not used for scaling). | |
Protected Attributes inherited from BeanLike | |
| const std::string | name |
| const std::string | description |
| map_t | parameters |
Base class for linear and exponential distances in rectangular pixel images.
|
inlineprotected |
Base class for digital distance models. Supports 4-, 8- and extended "chess knight" distance.
Sets the horizontal and vertical radius for the distance function. The parameters are called "width" and "height"
By default, the geometry is octagonal, applying 8-distance.
| void createChain | ( | DistanceNeighbourhood & | chain, |
| PIXEL_ADJACENCY | topology = PIXEL_ADJACENCY::KNIGHT, |
||
| bool | forward = true |
||
| ) | const |
Creates a list of DistanceElements.
Diagonal (dx+dy) and "chess knight" (2dx+dy or dx+2dy) values will be adjusted as well.
|
pure virtual |
Set the distance geometry directly by modifying decrement/decay coefficients. Alternative to setRadus(). Set final decrement or decay per pixel. The exact definition varies in subclasses; the decay may be linear decrement as with DistanceModelLinear or multiplicative as with DistanceModelExponential .
| horz | - horizontal distance decrement/decay |
| vert | - vertical distance decrement/decay; if NaN, set equal to horz |
| horzLeft | - horizontal distance decrement/decay; if NaN, set equal to horz |
| vertUp | - vertical distance decrement/decay; if NaN, set equal to vert |
Special values:
Implemented in DistanceModelLinear, and DistanceModelExponential.
|
pure virtual |
Sets the geometry of the distance model.
The values are in float, as eg. half-width radius may be sharp, under 1.0.
| horz | - horizontal distance, "width". |
| vert | - vertical distance, "height"; if negative, set equal to horizontal |
Special values:
horz for vert and horzRight; vert for \vertUp )Implemented in DistanceModelExponential, and DistanceModelLinear.
|
overridevirtual |
Called after setParameters()
Reimplemented from BeanLike.
1.9.8