msl 1.1.0
 
Loading...
Searching...
No Matches
msl::Mask Class Reference

A two dimensional mask. More...

#include <Mask.h>

Public Types

using Point = Vector2l
 2D point, as (column, row)
 
using Shape = Vector2l
 Shape of the mask, as (column, row)
 
using Points = std::vector<Point>
 

Public Member Functions

 Mask (Shape const &shape={}, bool value=true)
 Create a constant mask.
 
std::size_t size () const
 Return the total number of points in the mask.
 
Shape const & shape () const
 Return the shape of the mask.
 
std::size_t count () const
 Return the number of enabled points.
 
Maskenable (Point const &p)
 Enable a point.
 
Maskdisable (Point const &p)
 Disable a point.
 
bool enabled (Point const &p) const
 Check whether the point is enabled.
 
Maskflip ()
 Switch the status of all points (enabled ↔ disabled)
 
Maskoperator|= (Mask const &right)
 In-place union of two masks.
 
Maskoperator&= (Mask const &right)
 In-place intersection of two masks.
 
Points enabledPoints () const
 Return a vector of enabled points.
 

Static Public Member Functions

static bool lessX (Point const &p, Point const &q)
 Compare points according to their x coordinate.
 
static bool lessY (Point const &p, Point const &q)
 Compare points according to their y coordinate.
 

Protected Member Functions

std::size_t _index (Point const &p) const
 Return the linear index corresponding to a point.
 

Protected Attributes

Shape _shape
 
boost::dynamic_bitset _mask
 

Detailed Description

A two dimensional mask.

Member Typedef Documentation

◆ Point

2D point, as (column, row)

◆ Shape

Shape of the mask, as (column, row)

◆ Points

using msl::Mask::Points = std::vector<Point>

Constructor & Destructor Documentation

◆ Mask()

msl::Mask::Mask ( Shape const & shape = {},
bool value = true )

Create a constant mask.

Member Function Documentation

◆ lessX()

static bool msl::Mask::lessX ( Point const & p,
Point const & q )
inlinestatic

Compare points according to their x coordinate.

◆ lessY()

static bool msl::Mask::lessY ( Point const & p,
Point const & q )
inlinestatic

Compare points according to their y coordinate.

◆ size()

std::size_t msl::Mask::size ( ) const

Return the total number of points in the mask.

◆ shape()

Shape const & msl::Mask::shape ( ) const

Return the shape of the mask.

◆ count()

std::size_t msl::Mask::count ( ) const

Return the number of enabled points.

◆ enable()

Mask & msl::Mask::enable ( Point const & p)

Enable a point.

◆ disable()

Mask & msl::Mask::disable ( Point const & p)

Disable a point.

◆ enabled()

bool msl::Mask::enabled ( Point const & p) const

Check whether the point is enabled.

◆ flip()

Mask & msl::Mask::flip ( )

Switch the status of all points (enabled ↔ disabled)

◆ operator|=()

Mask & msl::Mask::operator|= ( Mask const & right)

In-place union of two masks.

◆ operator&=()

Mask & msl::Mask::operator&= ( Mask const & right)

In-place intersection of two masks.

◆ enabledPoints()

Points msl::Mask::enabledPoints ( ) const

Return a vector of enabled points.

◆ _index()

std::size_t msl::Mask::_index ( Point const & p) const
protected

Return the linear index corresponding to a point.

Member Data Documentation

◆ _shape

Shape msl::Mask::_shape
protected

◆ _mask

boost::dynamic_bitset msl::Mask::_mask
protected

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