Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04a91732dc+cc8870d3f5,g07dc498a13+5aa0b8792f,g0fba68d861+488cddfaa9,g1409bbee79+5aa0b8792f,g1a7e361dbc+5aa0b8792f,g1fd858c14a+f64bc332a9,g35bb328faa+fcb1d3bbc8,g4d2262a081+b1c1982739,g4d39ba7253+9633a327c1,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+9633a327c1,g668ecb457e+25d63fd678,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+8b64ca622a,g89139ef638+5aa0b8792f,g89e1512fd8+37f975783e,g8d6b6b353c+9633a327c1,g9125e01d80+fcb1d3bbc8,g989de1cb63+5aa0b8792f,g9f33ca652e+b196626af7,ga9baa6287d+9633a327c1,gaaedd4e678+5aa0b8792f,gabe3b4be73+1e0a283bba,gb1101e3267+71e32094df,gb58c049af0+f03b321e39,gb90eeb9370+2807b1ad02,gc741bbaa4f+1ae86710ed,gcf25f946ba+8b64ca622a,gd315a588df+a39986a76f,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+94dfc458f4,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,gfe73954cf8+a1301e4c20,w.2025.11
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst::gauss2d::VectorImage< T > Class Template Reference

#include <vectorimage.h>

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

Public Member Functions

 VectorImage (size_t n_rows, size_t n_cols, const T *value_init=Image< T, VectorImage< T > >::_value_default_ptr(), std::shared_ptr< const CoordinateSystem > coordsys=nullptr)
 
 ~VectorImage ()=default
 
T & _get_value_impl (size_t row, size_t col)
 
T & _get_value_unchecked_impl (size_t row, size_t col)
 
void add_value_unchecked_impl (size_t row, size_t col, T value)
 
get_value_unchecked_impl (size_t row, size_t col) const
 
void set_value_impl (size_t row, size_t col, T value)
 
void set_value_unchecked_impl (size_t row, size_t col, T value)
 
size_t get_n_cols_impl () const
 
size_t get_n_rows_impl () const
 
T & _get_value (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 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_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, VectorImage< T > > & operator+= (T value)
 
Image< T, VectorImage< 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
 
static constexpr std::string_view PY_NAMESPACE_SEPARATOR
 

Detailed Description

template<typename T>
class lsst::gauss2d::VectorImage< T >

Definition at line 43 of file vectorimage.h.

Constructor & Destructor Documentation

◆ VectorImage()

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

Definition at line 45 of file vectorimage.h.

48 : Image<T, VectorImage<T>>(coordsys), _n_rows(n_rows), _n_cols(n_cols) {
49 _data.resize(n_rows);
50 // No real option but to resize with vectors
51 // Just reserving would cause _unchecked calls to break
54 for (size_t row = 0; row < _n_rows; row++) {
55 _data[row].resize(n_cols, value_init_override);
56 }
57 }
Image(size_t n_rows, size_t n_cols, const T *value_init=_value_default_ptr(), std::shared_ptr< const CoordinateSystem > coordsys=nullptr)=delete

◆ ~VectorImage()

template<typename T>
lsst::gauss2d::VectorImage< T >::~VectorImage ( )
default

Member Function Documentation

◆ _check_row_col()

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

Definition at line 133 of file image.h.

A 2D image with scalar numeric values, using CRTP.
Definition image.h:107
void _check_row_col_impl(size_t row, size_t col) const
Definition image.h:134

◆ _check_row_col_impl()

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

Definition at line 134 of file image.h.

134 {
136 throw std::out_of_range("row,col = " + std::to_string(row) + "," + std::to_string(col)
137 + " n_rows,n_cols = " + std::to_string(this->get_n_rows()) + ","
138 + std::to_string(this->get_n_cols()));
139 }
140 }

◆ _get_value()

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

Definition at line 123 of file image.h.

123{ return static_cast<C&>(*this)._get_value_impl(row, col); }
T & _get_value_impl(size_t row, size_t col)
Definition image.h:124

◆ _get_value_impl()

template<typename T>
T & lsst::gauss2d::VectorImage< T >::_get_value_impl ( size_t row,
size_t col )
inline

Definition at line 60 of file vectorimage.h.

60 {
61 // This doesn't work on vector<bool> because it's bit-packed
62 // One could specialize: if constexpr (std::is_same_v<bool, T>)
63 // ... if there were a workable alternative, but there isn't.
64 if constexpr (std::is_same_v<bool, T>) {
65 throw std::logic_error("VectorImage<bool> cannot use _get_value");
66 } else {
67 // TODO: Check at performance vs default implementation
68 return this->_data.at(row).at(col);
69 }
70 }

◆ _get_value_unchecked()

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

Definition at line 128 of file image.h.

128 {
129 return self()._get_value_unchecked_impl(row, col);
130 }
T & _get_value_unchecked_impl(size_t row, size_t col)=delete

◆ _get_value_unchecked_impl()

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

Definition at line 71 of file vectorimage.h.

71 {
72 // See note in _get_value
73 if constexpr (std::is_same_v<bool, T>) {
74 throw std::logic_error("VectorImage<bool> cannot use _get_value_unchecked");
75 } else {
76 return this->_data[row][col];
77 }
78 }

◆ _value_default_ptr()

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

Definition at line 121 of file image.h.

121{ return &_value_default; };

◆ add_value()

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

Definition at line 150 of file image.h.

150{ self().add_value_impl(row, col, value); }
void add_value_impl(size_t row, size_t col, T value)
Definition image.h:151

◆ add_value_impl()

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

Definition at line 151 of file image.h.

151{ this->_get_value(row, col) += value; }
T & _get_value(size_t row, size_t col)
Definition image.h:123

◆ add_value_unchecked()

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

Definition at line 152 of file image.h.

152 {
154 }
void add_value_unchecked_impl(size_t row, size_t col, T value)
Definition image.h:155

◆ add_value_unchecked_impl()

template<typename T>
void lsst::gauss2d::VectorImage< T >::add_value_unchecked_impl ( size_t row,
size_t col,
T value )
inline

Definition at line 79 of file vectorimage.h.

79{ this->_data[row][col] += value; }

◆ fill()

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

Definition at line 158 of file image.h.

158{ self().fill_impl(value); }

◆ fill_impl()

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

Definition at line 159 of file image.h.

159 {
160 const size_t n_rows = get_n_rows();
161 const size_t n_cols = get_n_cols();
162 for (size_t row = 0; row < n_rows; ++row) {
163 for (size_t col = 0; col < n_cols; ++col) {
165 }
166 }
167 }
void set_value_unchecked(size_t row, size_t col, T value)
Definition image.h:179

◆ get_coordsys()

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

Definition at line 142 of file image.h.

142{ return _coordsys; };

◆ get_coordsys_ptr_const()

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

Definition at line 143 of file image.h.

143{ return _coordsys_ptr; };

◆ get_n_cols()

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

Definition at line 145 of file image.h.

145{ return static_cast<const C&>(*this).get_n_cols_impl(); }
size_t get_n_cols_impl() const =delete

◆ get_n_cols_impl()

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

Definition at line 84 of file vectorimage.h.

84{ return _n_cols; };

◆ get_n_rows()

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

Definition at line 147 of file image.h.

147{ return static_cast<const C&>(*this).get_n_rows_impl(); }
size_t get_n_rows_impl()=delete

◆ get_n_rows_impl() [1/2]

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

◆ get_n_rows_impl() [2/2]

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

Definition at line 85 of file vectorimage.h.

85{ return _n_rows; };

◆ get_value()

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

Definition at line 168 of file image.h.

168{ return self_const().get_value_impl(row, col); }
T get_value_impl(size_t row, size_t col) const
Definition image.h:169

◆ get_value_impl()

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

Definition at line 169 of file image.h.

169 {
172 }
T get_value_unchecked(size_t row, size_t col) const
Definition image.h:173
void _check_row_col(size_t row, size_t col) const
Definition image.h:133

◆ get_value_unchecked()

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

Definition at line 173 of file image.h.

173 {
175 }
T get_value_unchecked_impl(size_t row, size_t col) const =delete

◆ get_value_unchecked_impl()

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

Definition at line 80 of file vectorimage.h.

80{ return this->_data[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 {
51 }

◆ operator!=()

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

Definition at line 248 of file image.h.

248{ return !(*this == other); }

◆ operator*=()

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

Definition at line 213 of file image.h.

213 {
214 const size_t n_rows = get_n_rows();
215 const size_t n_cols = get_n_cols();
216 for (size_t row = 0; row < n_rows; ++row) {
217 for (size_t col = 0; col < n_cols; ++col) {
218 // Avoid annoying warning for bool case
219 if constexpr (std::is_same_v<T, bool>) {
221 } else {
223 }
224 }
225 }
226 return *this;
227 }

◆ operator+=()

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

Definition at line 202 of file image.h.

202 {
203 const size_t n_rows = get_n_rows();
204 const size_t n_cols = get_n_cols();
205 for (size_t row = 0; row < n_rows; ++row) {
206 for (size_t col = 0; col < n_cols; ++col) {
208 }
209 }
210 return *this;
211 }
void add_value_unchecked(size_t row, size_t col, T value)
Definition image.h:152

◆ operator==()

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

Definition at line 232 of file image.h.

232 {
234 const size_t n_rows = get_n_rows();
235 const size_t n_cols = get_n_cols();
236 for (size_t row = 0; row < n_rows; ++row) {
237 for (size_t col = 0; col < n_cols; ++col) {
239 return false;
240 }
241 }
242 }
243 return true;
244 }
245 return false;
246 }

◆ repr()

std::string lsst::gauss2d::Image< T, VectorImage< 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.

190 {
191 return type_name_str<C>(false, namespace_separator) + "(" + (name_keywords ? "coordsys=" : "")
192 + _coordsys.repr(name_keywords, namespace_separator) + ", " + (name_keywords ? "n_rows=" : "")
193 + std::to_string(this->get_n_rows()) + ", " + (name_keywords ? "n_cols=" : "")
194 + std::to_string(this->get_n_cols()) + ")";
195 }
std::string repr(bool name_keywords, std::string_view namespace_separator) const override
Return a full, callable string representation of this.
Definition image.h:190
std::string type_name_str(bool strip_namespace=false, std::string_view namespace_str=detail::NAMESPACE_SEPARATOR)
Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.
Definition type_name.h:104

◆ set_value()

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

Definition at line 177 of file image.h.

177{ return self().set_value_impl(row, col, value); }
void set_value_impl(size_t row, size_t col, T value)
Definition image.h:178

◆ set_value_impl()

template<typename T>
void lsst::gauss2d::VectorImage< T >::set_value_impl ( size_t row,
size_t col,
T value )
inline

Definition at line 81 of file vectorimage.h.

81{ this->_data.at(row).at(col) = value; }

◆ set_value_unchecked()

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

Definition at line 179 of file image.h.

179 {
181 }
void set_value_unchecked_impl(size_t row, size_t col, T value)
Definition image.h:182

◆ set_value_unchecked_impl()

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

Definition at line 82 of file vectorimage.h.

82{ this->_data[row][col] = value; }

◆ shape()

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

Definition at line 186 of file image.h.

186{ return {this->get_n_rows(), this->get_n_cols()}; }

◆ size()

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

Definition at line 188 of file image.h.

188{ return this->get_n_rows() * this->get_n_cols(); };

◆ str()

lsst.scarlet.lite.image.Image::str ( ) const
inlineoverridevirtualinherited

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

Implements lsst::gauss2d::Object.

Definition at line 197 of file image.h.

197 {
198 return type_name_str<C>(true) + "(coordsys=" + _coordsys.str() + ", n_rows="
199 + std::to_string(this->get_n_rows()) + ", n_cols=" + std::to_string(this->get_n_cols()) + ")";
200 }
std::string str() const override
Return a brief, human-readable string representation of this.
Definition image.h:197
T to_string(T... args)

Member Data Documentation

◆ _value_default

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

Definition at line 120 of file image.h.

◆ CC_NAMESPACE_SEPARATOR

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

std::string_view lsst::gauss2d::Object::NULL_STR_GENERAL
staticconstexprinherited

Definition at line 46 of file object.h.

◆ PY_NAMESPACE_SEPARATOR

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 file: