LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
lsst::gauss2d::python::Image< T > Class Template Reference

A Python image using numpy arrrays for storage. More...

#include <image.h>

Inheritance diagram for lsst::gauss2d::python::Image< T >:
lsst::gauss2d::Image< T, Image< T > > lsst::gauss2d::Image< T, Image< T > > lsst::gauss2d::Object lsst::gauss2d::Object

Public Member Functions

 Image (size_t n_rows, size_t n_cols, const T *value_init=lsst::gauss2d::Image< T, Image< T > >::_value_default_ptr(), const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys=nullptr)
 
 Image (py::array_t< T > data, const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys=nullptr)
 Construct an image from a numpy array.
 
 ~Image ()
 
T & _get_value_unchecked_impl (size_t row, size_t col)
 
py::array_t< T > & get_data ()
 
size_t get_n_cols_impl () const
 
size_t get_n_rows_impl () const
 
get_value_unchecked_impl (size_t row, size_t col) const
 
void set_value_unchecked_impl (size_t row, size_t col, T value)
 
 Image (size_t n_rows, size_t n_cols, const T *value_init=lsst::gauss2d::Image< T, Image< T > >::_value_default_ptr(), const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys=nullptr)
 
 Image (py::array_t< T > data, const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys=nullptr)
 Construct an image from a numpy array.
 
 ~Image ()
 
T & _get_value_unchecked_impl (size_t row, size_t col)
 
py::array_t< T > & get_data ()
 
size_t get_n_cols_impl () const
 
size_t get_n_rows_impl () const
 
get_value_unchecked_impl (size_t row, size_t col) const
 
void set_value_unchecked_impl (size_t row, size_t col, T value)
 
T & _get_value (size_t row, size_t col)
 
T & _get_value_impl (size_t row, size_t col)
 
T & _get_value_unchecked (size_t row, size_t col)
 
void _check_row_col (size_t row, size_t col) const
 
void _check_row_col_impl (size_t row, size_t col) const
 
const CoordinateSystemget_coordsys () const
 
std::shared_ptr< const CoordinateSystemget_coordsys_ptr_const () const
 
size_t get_n_cols () const
 
size_t get_n_rows () const
 
size_t get_n_rows_impl ()=delete
 
void add_value (size_t row, size_t col, T value)
 
void add_value_impl (size_t row, size_t col, T value)
 
void add_value_unchecked (size_t row, size_t col, T value)
 
void add_value_unchecked_impl (size_t row, size_t col, T value)
 
void fill (T value)
 
void fill_impl (T value)
 
get_value (size_t row, size_t col) const
 
get_value_impl (size_t row, size_t col) const
 
get_value_unchecked (size_t row, size_t col) const
 
void set_value (size_t row, size_t col, T value)
 
void set_value_impl (size_t row, size_t col, T value)
 
void set_value_unchecked (size_t row, size_t col, T value)
 
std::array< size_t, 2 > shape () const
 
size_t size () const
 
std::string repr (bool name_keywords, std::string_view namespace_separator) const override
 Return a full, callable string representation of this.
 
std::string str () const override
 Return a brief, human-readable string representation of this.
 
Image< T, Image< T > > & operator+= (T value)
 
Image< T, Image< T > > & operator*= (T value)
 
bool operator== (const Image &other) const
 
const bool operator!= (const Image &other) const
 

Static Public Member Functions

static const T * _value_default_ptr ()
 
static std::string_view null_str (const std::string_view &namespace_separator)
 

Static Public Attributes

static constexpr T _value_default
 
static constexpr std::string_view CC_NAMESPACE_SEPARATOR = "::"
 The C++ namespace separator.
 
static constexpr std::string_view NULL_STR_GENERAL = "None"
 
static constexpr std::string_view PY_NAMESPACE_SEPARATOR = "."
 

Detailed Description

template<typename T>
class lsst::gauss2d::python::Image< T >

A Python image using numpy arrrays for storage.

Template Parameters
T

Definition at line 72 of file image.h.

Constructor & Destructor Documentation

◆ Image() [1/4]

template<typename T >
lsst::gauss2d::python::Image< T >::Image ( size_t n_rows,
size_t n_cols,
const T * value_init = lsst::gauss2d::Image<T, Image<T>>::_value_default_ptr(),
const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys = nullptr )
inlineexplicit

Definition at line 74 of file image.h.

77 : gauss2d::Image<T, Image<T>>(coordsys),
78 _ptr_own(std::make_unique<py::array_t<T>>(py::array::ShapeContainer({n_rows, n_cols}))),
79 _data(*_ptr_own),
80 _data_ref(_validate().template mutable_unchecked<2>()) {
81 if (value_init != nullptr) {
82 this->fill(*value_init);
83 }
84 }
A 2D image with scalar numeric values, using CRTP.
Definition image.h:107

◆ Image() [2/4]

template<typename T >
lsst::gauss2d::python::Image< T >::Image ( py::array_t< T > data,
const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys = nullptr )
inlineexplicit

Construct an image from a numpy array.

Parameters
dataThe numpy array to storage the image data.
coordsysThe coordinate system.
Note
Using this constructor will allow leave memory management on the Python side.

Definition at line 94 of file image.h.

96 : gauss2d::Image<T, Image<T>>(coordsys),
97 _data_in(data),
98 _data(_data_in),
99 _data_ref(_validate().template mutable_unchecked<2>()) {}
char * data
Definition BaseRecord.cc:61

◆ ~Image() [1/2]

template<typename T >
lsst::gauss2d::python::Image< T >::~Image ( )
inline

Definition at line 101 of file image.h.

101{};

◆ Image() [3/4]

template<typename T >
lsst::gauss2d::python::Image< T >::Image ( size_t n_rows,
size_t n_cols,
const T * value_init = lsst::gauss2d::Image<T, Image<T>>::_value_default_ptr(),
const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys = nullptr )
inlineexplicit

Definition at line 74 of file image.h.

77 : gauss2d::Image<T, Image<T>>(coordsys),
78 _ptr_own(std::make_unique<py::array_t<T>>(py::array::ShapeContainer({n_rows, n_cols}))),
79 _data(*_ptr_own),
80 _data_ref(_validate().template mutable_unchecked<2>()) {
81 if (value_init != nullptr) {
82 this->fill(*value_init);
83 }
84 }

◆ Image() [4/4]

template<typename T >
lsst::gauss2d::python::Image< T >::Image ( py::array_t< T > data,
const std::shared_ptr< const lsst::gauss2d::CoordinateSystem > coordsys = nullptr )
inlineexplicit

Construct an image from a numpy array.

Parameters
dataThe numpy array to storage the image data.
coordsysThe coordinate system.
Note
Using this constructor will allow leave memory management on the Python side.

Definition at line 94 of file image.h.

96 : gauss2d::Image<T, Image<T>>(coordsys),
97 _data_in(data),
98 _data(_data_in),
99 _data_ref(_validate().template mutable_unchecked<2>()) {}

◆ ~Image() [2/2]

template<typename T >
lsst::gauss2d::python::Image< T >::~Image ( )
inline

Definition at line 101 of file image.h.

101{};

Member Function Documentation

◆ _check_row_col()

void lsst::gauss2d::Image< T, Image< T > >::_check_row_col ( size_t row,
size_t col ) const
inlineinherited

Definition at line 133 of file image.h.

◆ _check_row_col_impl()

void lsst::gauss2d::Image< T, Image< T > >::_check_row_col_impl ( size_t row,
size_t col ) const
inlineinherited

Definition at line 134 of file image.h.

◆ _get_value()

T & lsst::gauss2d::Image< T, Image< T > >::_get_value ( size_t row,
size_t col )
inlineinherited

Definition at line 123 of file image.h.

◆ _get_value_impl()

T & lsst::gauss2d::Image< T, Image< T > >::_get_value_impl ( size_t row,
size_t col )
inlineinherited

Definition at line 124 of file image.h.

◆ _get_value_unchecked()

T & lsst::gauss2d::Image< T, Image< T > >::_get_value_unchecked ( size_t row,
size_t col )
inlineinherited

Definition at line 128 of file image.h.

◆ _get_value_unchecked_impl() [1/2]

template<typename T >
T & lsst::gauss2d::python::Image< T >::_get_value_unchecked_impl ( size_t row,
size_t col )
inline

Definition at line 103 of file image.h.

103{ return this->_data_ref(row, col); };
int row
Definition CR.cc:145
int col
Definition CR.cc:144

◆ _get_value_unchecked_impl() [2/2]

template<typename T >
T & lsst::gauss2d::python::Image< T >::_get_value_unchecked_impl ( size_t row,
size_t col )
inline

Definition at line 103 of file image.h.

103{ return this->_data_ref(row, col); };

◆ _value_default_ptr()

static const T * lsst::gauss2d::Image< T, Image< T > >::_value_default_ptr ( )
inlinestaticinherited

Definition at line 121 of file image.h.

◆ add_value()

void lsst::gauss2d::Image< T, Image< T > >::add_value ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 150 of file image.h.

◆ add_value_impl()

void lsst::gauss2d::Image< T, Image< T > >::add_value_impl ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 151 of file image.h.

◆ add_value_unchecked()

void lsst::gauss2d::Image< T, Image< T > >::add_value_unchecked ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 152 of file image.h.

◆ add_value_unchecked_impl()

void lsst::gauss2d::Image< T, Image< T > >::add_value_unchecked_impl ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 155 of file image.h.

◆ fill()

void lsst::gauss2d::Image< T, Image< T > >::fill ( T value)
inlineinherited

Definition at line 158 of file image.h.

◆ fill_impl()

void lsst::gauss2d::Image< T, Image< T > >::fill_impl ( T value)
inlineinherited

Definition at line 159 of file image.h.

◆ get_coordsys()

const CoordinateSystem & lsst::gauss2d::Image< T, Image< T > >::get_coordsys ( ) const
inlineinherited

Definition at line 142 of file image.h.

◆ get_coordsys_ptr_const()

std::shared_ptr< const CoordinateSystem > lsst::gauss2d::Image< T, Image< T > >::get_coordsys_ptr_const ( ) const
inlineinherited

Definition at line 143 of file image.h.

◆ get_data() [1/2]

template<typename T >
py::array_t< T > & lsst::gauss2d::python::Image< T >::get_data ( )
inline

Definition at line 105 of file image.h.

105{ return this->_data; }

◆ get_data() [2/2]

template<typename T >
py::array_t< T > & lsst::gauss2d::python::Image< T >::get_data ( )
inline

Definition at line 105 of file image.h.

105{ return this->_data; }

◆ get_n_cols()

size_t lsst::gauss2d::Image< T, Image< T > >::get_n_cols ( ) const
inlineinherited

Definition at line 145 of file image.h.

◆ get_n_cols_impl() [1/2]

template<typename T >
size_t lsst::gauss2d::python::Image< T >::get_n_cols_impl ( ) const
inline

Definition at line 107 of file image.h.

107{ return _data.shape(1); };

◆ get_n_cols_impl() [2/2]

template<typename T >
size_t lsst::gauss2d::python::Image< T >::get_n_cols_impl ( ) const
inline

Definition at line 107 of file image.h.

107{ return _data.shape(1); };

◆ get_n_rows()

size_t lsst::gauss2d::Image< T, Image< T > >::get_n_rows ( ) const
inlineinherited

Definition at line 147 of file image.h.

◆ get_n_rows_impl() [1/3]

template<typename T >
size_t lsst::gauss2d::python::Image< T >::get_n_rows_impl ( ) const
inline

Definition at line 108 of file image.h.

108{ return _data.shape(0); };

◆ get_n_rows_impl() [2/3]

template<typename T >
size_t lsst::gauss2d::python::Image< T >::get_n_rows_impl ( ) const
inline

Definition at line 108 of file image.h.

108{ return _data.shape(0); };

◆ get_n_rows_impl() [3/3]

size_t lsst::gauss2d::Image< T, Image< T > >::get_n_rows_impl ( )
deleteinherited

◆ get_value()

T lsst::gauss2d::Image< T, Image< T > >::get_value ( size_t row,
size_t col ) const
inlineinherited

Definition at line 168 of file image.h.

◆ get_value_impl()

T lsst::gauss2d::Image< T, Image< T > >::get_value_impl ( size_t row,
size_t col ) const
inlineinherited

Definition at line 169 of file image.h.

◆ get_value_unchecked()

T lsst::gauss2d::Image< T, Image< T > >::get_value_unchecked ( size_t row,
size_t col ) const
inlineinherited

Definition at line 173 of file image.h.

◆ get_value_unchecked_impl() [1/2]

template<typename T >
T lsst::gauss2d::python::Image< T >::get_value_unchecked_impl ( size_t row,
size_t col ) const
inline

Definition at line 110 of file image.h.

110{ return this->_data_ref(row, col); };

◆ get_value_unchecked_impl() [2/2]

template<typename T >
T lsst::gauss2d::python::Image< T >::get_value_unchecked_impl ( size_t row,
size_t col ) const
inline

Definition at line 110 of file image.h.

110{ return this->_data_ref(row, col); };

◆ null_str()

static std::string_view lsst::gauss2d::Object::null_str ( const std::string_view & namespace_separator)
inlinestaticinherited

Definition at line 49 of file object.h.

49 {
50 return namespace_separator == CC_NAMESPACE_SEPARATOR ? "nullptr" : NULL_STR_GENERAL;
51 }
static constexpr std::string_view CC_NAMESPACE_SEPARATOR
The C++ namespace separator.
Definition object.h:45
static constexpr std::string_view NULL_STR_GENERAL
Definition object.h:46

◆ operator!=()

const bool lsst::gauss2d::Image< T, Image< T > >::operator!= ( const Image< T, Image< T > > & other) const
inlineinherited

Definition at line 248 of file image.h.

◆ operator*=()

Image< T, Image< T > > & lsst::gauss2d::Image< T, Image< T > >::operator*= ( T value)
inlineinherited

Definition at line 213 of file image.h.

◆ operator+=()

Image< T, Image< T > > & lsst::gauss2d::Image< T, Image< T > >::operator+= ( T value)
inlineinherited

Definition at line 202 of file image.h.

◆ operator==()

bool lsst::gauss2d::Image< T, Image< T > >::operator== ( const Image< T, Image< T > > & other) const
inlineinherited

Definition at line 232 of file image.h.

◆ repr()

std::string lsst::gauss2d::Image< T, Image< T > >::repr ( bool name_keywords,
std::string_view namespace_separator ) const
inlineoverridevirtualinherited

Return a full, callable string representation of this.

Parameters
name_keywordsWhether to prefix arguments with "{name}=", where name is the arg name in the header (as with keyword arguments in Python).
namespace_separatorThe string to use to delimit namespaces, i.e. :: in C++ and . in Python.
Returns
A callable string representation of this, which should return an an identical object to this.
Note
The representation with name_keywords=false must be callable in C++. The representation with name_keywords=true should be callable in Python, if there are any bindings.

Implements lsst::gauss2d::Object.

Definition at line 190 of file image.h.

◆ set_value()

void lsst::gauss2d::Image< T, Image< T > >::set_value ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 177 of file image.h.

◆ set_value_impl()

void lsst::gauss2d::Image< T, Image< T > >::set_value_impl ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 178 of file image.h.

◆ set_value_unchecked()

void lsst::gauss2d::Image< T, Image< T > >::set_value_unchecked ( size_t row,
size_t col,
T value )
inlineinherited

Definition at line 179 of file image.h.

◆ set_value_unchecked_impl() [1/2]

template<typename T >
void lsst::gauss2d::python::Image< T >::set_value_unchecked_impl ( size_t row,
size_t col,
T value )
inline

Definition at line 111 of file image.h.

111{ this->_data_ref(row, col) = value; }

◆ set_value_unchecked_impl() [2/2]

template<typename T >
void lsst::gauss2d::python::Image< T >::set_value_unchecked_impl ( size_t row,
size_t col,
T value )
inline

Definition at line 111 of file image.h.

111{ this->_data_ref(row, col) = value; }

◆ shape()

std::array< size_t, 2 > lsst::gauss2d::Image< T, Image< T > >::shape ( ) const
inlineinherited

Definition at line 186 of file image.h.

◆ size()

size_t lsst::gauss2d::Image< T, Image< T > >::size ( ) const
inlineinherited

Definition at line 188 of file image.h.

◆ str()

std::string lsst::gauss2d::Image< T, Image< T > >::str ( ) const
inlineoverridevirtualinherited

Return a brief, human-readable string representation of this.

Implements lsst::gauss2d::Object.

Definition at line 197 of file image.h.

Member Data Documentation

◆ _value_default

constexpr T lsst::gauss2d::Image< T, Image< T > >::_value_default
staticconstexprinherited

Definition at line 120 of file image.h.

◆ CC_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::CC_NAMESPACE_SEPARATOR = "::"
staticconstexprinherited

The C++ namespace separator.

Definition at line 45 of file object.h.

◆ NULL_STR_GENERAL

constexpr std::string_view lsst::gauss2d::Object::NULL_STR_GENERAL = "None"
staticconstexprinherited

Definition at line 46 of file object.h.

◆ PY_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::PY_NAMESPACE_SEPARATOR = "."
staticconstexprinherited

Definition at line 47 of file object.h.


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