EleFits  5.3.0
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches
Static Public Attributes | Static Public Member Functions | Public Member Functions | Related Functions | List of all members
Position< N > Class Template Reference

#include <Position.h>

Detailed Description

template<long N = 2>
class Euclid::Fits::Position< N >

n-dimensional pixel position or image shape, i.e. set of integer coordinates.

Template Parameters
NA non-negative dimension (0 is allowed), or -1 for variable dimension.

The values are stored in a std::array<long, N> in general (N &ge; 0), or std::vector<long> for variable dimension (N = -1).

Memory and services are optimized when dimension is fixed at compile-time (N &ge; 0).

Anonymous brace-initialization is permitted, e.g.:

VecRaster<float> raster({1920, 1080});
// Is equivalent to
VecRaster<float> raster(Position<2>({1920, 1080}));
n-dimensional pixel position or image shape, i.e. set of integer coordinates.
Definition: Position.h:51
Data of a n-dimensional image (2D by default).
Definition: Raster.h:149

Classical positions are instantiated with named constructors, e.g.:

auto bottomLeft = Position<2>::zero();
auto topRight = Position<2>::max();
static Position< N > max()
Create max position (full of -1's).
static Position< N > zero()
Create position 0.
See also
Region

Static Public Attributes

static constexpr long Dim = N
 The dimension template parameter.
 

Static Public Member Functions

static Position< N > max ()
 Create max position (full of -1's).
 
static Position< N > one ()
 Create a position full of 1's.
 
static Position< N > zero ()
 Create position 0.
 

Public Member Functions

 Position ()
 Default constructor. More...
 
 Position (long dim)
 Create a position of given dimension.
 
 Position (std::initializer_list< long > indices)
 Create a position from a brace-enclosed list of indices.
 
template<typename TIterator >
 Position (TIterator begin, TIterator end)
 Create a position by copying data from some container.
 
template<long M>
Position< M > extend (const Position< M > &padding) const
 Create a position of higher dimension. More...
 
bool isMax () const
 Check whether the position is max.
 
bool isZero () const
 Check whether the position is zero.
 
template<long M>
Position< M > slice () const
 Create a position of lower dimension. More...
 
- Public Member Functions inherited from DataContainer< T, THolder, TDerived >
template<typename TSize = std::size_t, typename std::enable_if_t< std::is_integral< TSize >::value, TSize > * = nullptr>
 DataContainer (TSize s=0, std::remove_const_t< T > *d=nullptr)
 Construct from a size and non-constant data.
 
template<typename TSize = std::size_t, typename std::enable_if_t< std::is_integral< TSize >::value, TSize > * = nullptr>
 DataContainer (TSize s, const T *d)
 Construct from a size and constant data.
 
template<typename TIterator >
 DataContainer (TIterator begin, TIterator end)
 Iterator-based constructor.
 
 DataContainer (std::initializer_list< T > values)
 Value list constructor.
 
template<typename TArg0 , typename... TArgs, typename std::enable_if_t< not std::is_integral< TArg0 >::value, TArg0 > * = nullptr>
 DataContainer (TArg0 arg0, TArgs &&... args)
 Forwarding constructor.
 
T * data ()
 
const std::decay_t< Container > & container () const
 Access the container in read-only mode.
 
ContainermoveTo (Container &destination)
 Move the container. More...
 
- Public Member Functions inherited from ContiguousContainerMixin< T, TDerived >
bool empty () const
 Check whether the container is empty. More...
 
const T & operator[] (size_type index) const
 Access the element with given index.
 
T & operator[] (size_type index)
 Access the element with given index.
 
const_iterator begin () const
 Iterator to the first element.
 
iterator begin ()
 Iterator to the first element.
 
const_iterator cbegin ()
 Iterator to the first element.
 
const_iterator end () const
 Iterator to one past the last element.
 
iterator end ()
 Iterator to one past the last element.
 
const_iterator cend ()
 Iterator to one past the last element.
 
virtual bool operator== (const TDerived &rhs) const
 Check equality.
 
bool operator!= (const TDerived &rhs) const
 Check inequality.
 
- Public Member Functions inherited from VectorArithmeticMixin< T, TDerived, Incrementable >
TDerived & operator+= (const TDerived &rhs)
 V += U and W = V + U.
 
TDerived & operator+= (const T &rhs)
 V += a, V = U + a, V = a + U.
 
TDerived & operator-= (const TDerived &rhs)
 V -= U and W = V - U.
 
TDerived & operator-= (const T &rhs)
 V -= a, V = U - a, V = a - U.
 
TDerived & operator*= (const T &rhs)
 V *= a, V = U * a, V = a * U.
 
TDerived & operator/= (const T &rhs)
 V /= a, V = U / a.
 
template<typename TFunc , typename... TContainers>
TDerived & generate (TFunc &&func, const TContainers &... args)
 Generate values from a function with optional input containers. More...
 
template<typename TFunc , typename... TContainers>
TDerived & apply (TFunc &&func, const TContainers &... args)
 Apply a function with optional input containers. More...
 
TDerived operator+ () const
 Copy.
 
TDerived operator- () const
 Compute the opposite.
 

Related Functions

(Note that these are not member functions.)

template<long N = 2>
using Indices = typename std::conditional<(N==-1), std::vector< long >, std::array< long,(std::size_t) N > >::type
 The index container type.
 
template<long N = 2>
long shapeSize (const Position< N > &shape)
 Compute the number of pixels in a given shape.
 

Additional Inherited Members

- Public Types inherited from DataContainer< T, THolder, TDerived >
using Container = typename Holder::Container
 The concrete container type.
 
using Holder = THolder
 The concrete data holder type.
 
- Public Types inherited from ContiguousContainerMixin< T, TDerived >
using const_iterator = const T *
 The constant value iterator.
 
using const_reference = const T &
 The constant value reference.
 
using difference_type = std::ptrdiff_t
 The iterator difference type.
 
using iterator = T *
 The value iterator.
 
using reference = T &
 The value reference.
 
using size_type = std::size_t
 The underlying container size type.
 
using value_type = T
 The value type.
 

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