msl 1.3.0
Loading...
Searching...
No Matches
msl::MaskBase< T > Class Template Reference

Detailed Description

template<typename T>
class msl::MaskBase< T >

Base class for masks, boolean and non-boolean.

#include <MaskBase.h>

Public Types

using Point = Vector2l
 2D point, as (column, row), (x, y) or (ky,kz)
using Shape = Vector2l
 Shape of the mask, as (column, row), (x, y) or (ky,kz).
using Points = std::vector<Point>
 Container of Point.

Public Member Functions

 MaskBase (Shape const &shape={}, T value=T())
 Create a constant mask.
 MaskBase (MaskBase const &)=default
 MaskBase (MaskBase &&)=default
MaskBaseoperator= (MaskBase const &)=default
MaskBaseoperator= (MaskBase &&)=default
std::size_t size () const
 Return the total number of points in the mask.
Shape const & shape () const
 Return the shape of the mask.
void fill (T value)
 Fill all points of mask with value.
T const & operator[] (Point const &p) const
 Read-only access to a mask item.
T & operator[] (Point const &p)
 Read/write access to a mask item.

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

Shape _shape
 Shape of the mask.
std::vector< T > _mask
 Linear container of mask points.

Member Function Documentation

◆ operator[]() [1/2]

template<typename T>
T const & msl::MaskBase< T >::operator[] ( Point const & p) const

Read-only access to a mask item.

Warning
No bound-checking is performed.

◆ operator[]() [2/2]

template<typename T>
T & msl::MaskBase< T >::operator[] ( Point const & p)

Read/write access to a mask item.

Warning
No bound-checking is performed.

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