Commit 7d850b1e authored by Edwin Carlinet's avatar Edwin Carlinet

Old API cleaning.

Rename new_pixel/new_pixel_type -> pixel/pixel_type.
parent cdd0912b
......@@ -44,7 +44,7 @@ namespace mln::archetypes
struct ConcreteImage
{
using new_pixel_type = archetypes::Pixel;
using pixel_type = archetypes::Pixel;
using value_type = pixel_value_t<mln::archetypes::Pixel>;
using reference = pixel_reference_t<mln::archetypes::Pixel>;
using point_type = ::ranges::range_value_t<Domain>;
......@@ -72,8 +72,8 @@ namespace mln::archetypes
struct pixel_range
{
const new_pixel_type* begin();
const new_pixel_type* end();
const pixel_type* begin();
const pixel_type* end();
};
pixel_range pixels();
......@@ -104,13 +104,13 @@ namespace mln::archetypes
struct OutputImage : Image
{
using new_pixel_type = archetypes::OutputPixel;
using pixel_type = archetypes::OutputPixel;
using reference = pixel_reference_t<mln::archetypes::OutputPixel>;
struct pixel_range
{
const new_pixel_type* begin();
const new_pixel_type* end();
const pixel_type* begin();
const pixel_type* end();
};
pixel_range pixels();
......@@ -164,8 +164,8 @@ namespace mln::archetypes
reference operator()(point_type);
reference at(point_type);
new_pixel_type new_pixel(point_type);
new_pixel_type new_pixel_at(point_type);
pixel_type pixel(point_type);
pixel_type pixel_at(point_type);
};
......@@ -179,8 +179,8 @@ namespace mln::archetypes
reference operator()(point_type);
reference at(point_type);
new_pixel_type new_pixel(point_type);
new_pixel_type new_pixel_at(point_type);
pixel_type pixel(point_type);
pixel_type pixel_at(point_type);
};
......@@ -225,8 +225,8 @@ namespace mln::archetypes
struct pixel_range
{
const new_pixel_type* begin();
const new_pixel_type* end();
const pixel_type* begin();
const pixel_type* end();
pixel_range reversed();
};
......@@ -245,7 +245,7 @@ namespace mln::archetypes
struct OutputBidirectionalImage : BidirectionalImage
{
using new_pixel_type = archetypes::OutputPixel;
using pixel_type = archetypes::OutputPixel;
using reference = pixel_reference_t<mln::archetypes::OutputPixel>;
struct value_range
......@@ -259,8 +259,8 @@ namespace mln::archetypes
struct pixel_range
{
const new_pixel_type* begin();
const new_pixel_type* end();
const pixel_type* begin();
const pixel_type* end();
pixel_range reversed();
};
......
......@@ -156,13 +156,13 @@ namespace mln::concepts
#if __GNUC__ == 9
{ ima(p) } -> ::concepts::same_as<image_reference_t<I>>&&; // For concrete image it returns a const_reference
{ ima.at(p) } -> ::concepts::same_as<image_reference_t<I>>&&; // idem
{ ima.new_pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // For concrete image pixel may propagate constness
{ ima.new_pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // idem
{ ima.pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // For concrete image pixel may propagate constness
{ ima.pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // idem
#else
{ ima(p) } -> ::concepts::same_as<image_reference_t<I>>; // For concrete image it returns a const_reference
{ ima.at(p) } -> ::concepts::same_as<image_reference_t<I>>; // idem
{ ima.new_pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>; // For concrete image pixel may propagate constness
{ ima.new_pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>; // idem
{ ima.pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>; // For concrete image pixel may propagate constness
{ ima.pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>; // idem
#endif
};
......
......@@ -51,14 +51,14 @@ namespace mln
using reference = T&;
using const_reference = const T&;
using index_type = int;
using new_pixel_type = details::ndpix<T, N>;
using pixel_type = details::ndpix<T, N>;
using new_const_pixel_type = details::ndpix<const T, N>;
using domain_type = ndbox<N>;
using extension_type = internal::ndimage_extension<T, N>;
using new_value_range = ranges::mdspan<T, N>;
using new_const_value_range = ranges::mdspan<const T, N>;
using new_pixel_range = details::ndpix_range<T, N>;
using pixel_range = details::ndpix_range<T, N>;
using new_const_pixel_range = details::ndpix_range<const T, N>;
......@@ -159,15 +159,15 @@ namespace mln
const_reference operator[](index_type i) const noexcept;
reference operator[](index_type i) noexcept;
new_pixel_type new_pixel(fast_point_type p) noexcept;
new_const_pixel_type new_pixel(fast_point_type p) const noexcept;
new_pixel_type new_pixel_at(fast_point_type p) noexcept;
new_const_pixel_type new_pixel_at(fast_point_type p) const noexcept;
pixel_type pixel(fast_point_type p) noexcept;
new_const_pixel_type pixel(fast_point_type p) const noexcept;
pixel_type pixel_at(fast_point_type p) noexcept;
new_const_pixel_type pixel_at(fast_point_type p) const noexcept;
new_value_range values() noexcept;
new_const_value_range values() const noexcept;
new_pixel_range pixels() noexcept;
pixel_range pixels() noexcept;
new_const_pixel_range pixels() const noexcept;
/// \}
......@@ -192,7 +192,7 @@ namespace mln
std::ptrdiff_t __index_of_point(const int coords[]) const noexcept;
new_pixel_type __pixel_at(fast_point_type p) noexcept;
pixel_type __pixel_at(fast_point_type p) noexcept;
new_const_pixel_type __pixel_at(fast_point_type p) const noexcept;
// Get a data reference at the given coords
......@@ -500,37 +500,37 @@ namespace mln
}
template <class T, int N>
inline auto __ndbuffer_image<T, N>::__pixel_at(fast_point_type p) noexcept -> new_pixel_type
inline auto __ndbuffer_image<T, N>::__pixel_at(fast_point_type p) noexcept -> pixel_type
{
fast_point_type lcoords = p;
lcoords[0] = 0;
T* lineptr = Impl::get_pointer(this->__info(), lcoords.data());
return new_pixel_type{{}, this->__info(), lineptr, p};
return pixel_type{{}, this->__info(), lineptr, p};
}
template <class T, int N>
inline auto __ndbuffer_image<T, N>::new_pixel(fast_point_type p) const noexcept -> new_const_pixel_type
inline auto __ndbuffer_image<T, N>::pixel(fast_point_type p) const noexcept -> new_const_pixel_type
{
assert(Impl::is_point_in_domain(this->__info(), p.data()));
return this->__pixel_at(p);
}
template <class T, int N>
inline auto __ndbuffer_image<T, N>::new_pixel(fast_point_type p) noexcept -> new_pixel_type
inline auto __ndbuffer_image<T, N>::pixel(fast_point_type p) noexcept -> pixel_type
{
assert(Impl::is_point_in_domain(this->__info(), p.data()));
return this->__pixel_at(p);
}
template <class T, int N>
inline auto __ndbuffer_image<T, N>::new_pixel_at(fast_point_type p) const noexcept -> new_const_pixel_type
inline auto __ndbuffer_image<T, N>::pixel_at(fast_point_type p) const noexcept -> new_const_pixel_type
{
assert(Impl::is_point_valid(this->__info(), p.data()));
return this->__pixel_at(p);
}
template <class T, int N>
inline auto __ndbuffer_image<T, N>::new_pixel_at(fast_point_type p) noexcept -> new_pixel_type
inline auto __ndbuffer_image<T, N>::pixel_at(fast_point_type p) noexcept -> pixel_type
{
assert(Impl::is_point_valid(this->__info(), p.data()));
return this->__pixel_at(p);
......
......@@ -107,9 +107,9 @@ namespace mln
using domain_type = image_domain_t<I>;
/// \}
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using new_pixel_type::pixel_adaptor::pixel_adaptor;
using pixel_type::pixel_adaptor::pixel_adaptor;
};
/// Traits & Image Properties
......@@ -177,16 +177,16 @@ namespace mln
return m_ima.at(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel(point_type p)
{
return m_ima.new_pixel(p);
return m_ima.pixel(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel_at(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel_at(point_type p)
{
return m_ima.new_pixel_at(p);
return m_ima.pixel_at(p);
}
/// \}
......
......@@ -26,7 +26,7 @@ namespace mln
public:
/// Type definitions
/// \{
using typename clip_view::image_adaptor::new_pixel_type;
using typename clip_view::image_adaptor::pixel_type;
using typename clip_view::image_adaptor::point_type;
using typename clip_view::image_adaptor::reference;
using typename clip_view::image_adaptor::value_type;
......@@ -83,7 +83,7 @@ namespace mln
auto pixels()
{
auto g = [this](point_type p) -> new_pixel_type { return this->base().new_pixel_at(p); };
auto g = [this](point_type p) -> pixel_type { return this->base().pixel_at(p); };
return mln::ranges::view::transform(m_subdomain, g);
}
......@@ -112,17 +112,17 @@ namespace mln
{
return this->base().at(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel(point_type p)
{
mln_precondition(domain().has(p));
mln_precondition(this->base().domain().has(p));
return this->base().new_pixel(p);
return this->base().pixel(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel_at(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel_at(point_type p)
{
return this->base().new_pixel_at(p);
return this->base().pixel_at(p);
}
/// \}
......
......@@ -30,7 +30,7 @@ namespace mln
using point_type = image_point_t<I>;
using typename image_adaptor<I>::domain_type;
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using reference = extend_by_projection_view_base<I, Proj>::reference;
......@@ -40,8 +40,8 @@ namespace mln
return (*m_view)(q);
}
new_pixel_type(image_pixel_t<I> px, extend_by_projection_view_base<I, Proj>* ima)
: new_pixel_type::pixel_adaptor{std::move(px)}
pixel_type(image_pixel_t<I> px, extend_by_projection_view_base<I, Proj>* ima)
: pixel_type::pixel_adaptor{std::move(px)}
, m_view{ima}
{
}
......@@ -75,22 +75,22 @@ namespace mln
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel(point_type p)
{
assert(this->base().domain().has(p));
return this->new_pixel_at(p);
return this->pixel_at(p);
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel_at(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel_at(point_type p)
{
return {this->base().new_pixel_at(p), this};
return {this->base().pixel_at(p), this};
}
/// \}
auto pixels()
{
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> new_pixel_type {
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> pixel_type {
return {std::move(px), this};
});
}
......
......@@ -187,14 +187,14 @@ namespace mln
const adapted_image_t* m_adapted_image_ptr; // mutable
};
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using reference = extended_view::reference;
reference val() const { return (*m_ima_ptr)(this->base().point()); }
new_pixel_type(image_pixel_t<I> px, extended_view<I>* ima_ptr)
: new_pixel_type::pixel_adaptor{std::move(px)}
pixel_type(image_pixel_t<I> px, extended_view<I>* ima_ptr)
: pixel_type::pixel_adaptor{std::move(px)}
, m_ima_ptr{ima_ptr}
{
}
......@@ -230,21 +230,21 @@ namespace mln
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel(point_type p)
{
return {this->base().new_pixel(p), this};
return {this->base().pixel(p), this};
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel_at(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel_at(point_type p)
{
return {this->base().new_pixel(p), this};
return {this->base().pixel(p), this};
}
/// \}
auto pixels()
{
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> new_pixel_type {
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> pixel_type {
return {std::move(px), this};
});
}
......
......@@ -27,7 +27,7 @@ namespace mln
public:
/// Type definitions
/// \{
using new_pixel_type = image_pixel_t<I>;
using pixel_type = image_pixel_t<I>;
using typename filter_view::image_adaptor::point_type;
using typename filter_view::image_adaptor::reference;
using typename filter_view::image_adaptor::value_type;
......@@ -115,17 +115,17 @@ namespace mln
{
return this->base().at(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel(point_type p)
{
mln_precondition(domain().has(p));
mln_precondition(std::invoke(f, this->base().at(p)));
return this->base().new_pixel(p);
return this->base().pixel(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel_at(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel_at(point_type p)
{
return this->base().new_pixel_at(p);
return this->base().pixel_at(p);
}
/// \}
......
......@@ -39,14 +39,14 @@ namespace mln
using typename image_adaptor<I>::value_type;
using extension_type = extension::by_image<value_type, point_type>;
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using reference = image_extended_view::reference;
reference val() const { return (*m_ima)(this->base().point()); }
new_pixel_type(image_pixel_t<I> px, image_extended_view<I>* ima)
: new_pixel_type::pixel_adaptor{std::move(px)}
pixel_type(image_pixel_t<I> px, image_extended_view<I>* ima)
: pixel_type::pixel_adaptor{std::move(px)}
, m_ima{ima}
{
}
......@@ -83,21 +83,21 @@ namespace mln
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel(point_type p)
{
return this->new_pixel_at(p);
return this->pixel_at(p);
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel_at(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel_at(point_type p)
{
return {this->base().new_pixel_at(p), this};
return {this->base().pixel_at(p), this};
}
/// \}
auto pixels()
{
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> new_pixel_type {
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> pixel_type {
return {std::move(px), this};
});
}
......
......@@ -37,7 +37,7 @@ namespace mln
public:
/// Type definitions
/// \{
using new_pixel_type = image_pixel_t<I>;
using pixel_type = image_pixel_t<I>;
using typename mask_view::image_adaptor::point_type;
using typename mask_view::image_adaptor::reference;
using typename mask_view::image_adaptor::value_type;
......@@ -106,18 +106,18 @@ namespace mln
return this->base()(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel(point_type p)
{
mln_precondition(m_mask.domain().has(p));
mln_precondition(this->base().domain().has(p));
return this->base().new_pixel(p);
return this->base().pixel(p);
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel_at(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel_at(point_type p)
{
return this->base().new_pixel_at(p);
return this->base().pixel_at(p);
}
/// \}
......
......@@ -39,14 +39,14 @@ namespace mln
using typename image_adaptor<I>::value_type;
using extension_type = extension::none;
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using reference = none_extended_view::reference;
reference val() const { return (*m_ima)(this->base().point()); }
new_pixel_type(image_pixel_t<I> px, none_extended_view<I>* ima)
: new_pixel_type::pixel_adaptor{std::move(px)}
pixel_type(image_pixel_t<I> px, none_extended_view<I>* ima)
: pixel_type::pixel_adaptor{std::move(px)}
, m_ima{ima}
{
}
......@@ -80,21 +80,21 @@ namespace mln
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel(point_type p)
{
return this->new_pixel_at(p);
return this->pixel_at(p);
}
template <class J = I>
std::enable_if_t<image_accessible_v<J>, new_pixel_type> new_pixel_at(point_type p)
std::enable_if_t<image_accessible_v<J>, pixel_type> pixel_at(point_type p)
{
return {this->base().new_pixel_at(p), this};
return {this->base().pixel_at(p), this};
}
/// \}
auto pixels()
{
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> new_pixel_type {
return ranges::view::transform(this->base().pixels(), [this](image_pixel_t<I> px) -> pixel_type {
return {std::move(px), this};
});
}
......
......@@ -52,26 +52,26 @@ namespace mln
public:
/// Pixel type definitions
/// \{
struct new_pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<new_pixel_type>
struct pixel_type : pixel_adaptor<image_pixel_t<I>>, mln::details::Pixel<pixel_type>
{
using point_type = transform_view::point_type;
using site_type[[deprecated]] = transform_view::point_type;
using reference = transform_view::reference;
using value_type = transform_view::value_type;
new_pixel_type(fun_t fun, image_pixel_t<I> px)
: new_pixel_type::pixel_adaptor{px}
pixel_type(fun_t fun, image_pixel_t<I> px)
: pixel_type::pixel_adaptor{px}
, fun_{fun}
{
}
new_pixel_type(const new_pixel_type& other)
: new_pixel_type::pixel_adaptor{other}
pixel_type(const pixel_type& other)
: pixel_type::pixel_adaptor{other}
, fun_(other.fun_)
{
}
new_pixel_type(new_pixel_type&& other)
: new_pixel_type::pixel_adaptor{std::move(other)}
pixel_type(pixel_type&& other)
: pixel_type::pixel_adaptor{std::move(other)}
, fun_(std::move(other.fun_))
{
}
......@@ -109,7 +109,7 @@ namespace mln
auto pixels()
{
auto pxwrapper = [fun = this->fun_](image_pixel_t<I> px) { return new_pixel_type{fun, std::move(px)}; };
auto pxwrapper = [fun = this->fun_](image_pixel_t<I> px) { return pixel_type{fun, std::move(px)}; };
return mln::ranges::view::transform(this->base().pixels(), pxwrapper);
}
......@@ -147,17 +147,17 @@ namespace mln
return std::invoke(fun_, this->base().at(p));
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel(point_type p)
{
mln_precondition(this->domain().has(p));
return {fun_, this->base().new_pixel(p)};
return {fun_, this->base().pixel(p)};
}
template <typename Ret = new_pixel_type>
std::enable_if_t<accessible::value, Ret> new_pixel_at(point_type p)
template <typename Ret = pixel_type>
std::enable_if_t<accessible::value, Ret> pixel_at(point_type p)
{
return {fun_, this->base().new_pixel_at(p)};
return {fun_, this->base().pixel_at(p)};
}
/// \}
......@@ -206,7 +206,7 @@ namespace mln
public:
/// Pixel type definitions
/// \{
struct new_pixel_type : mln::details::Pixel<new_pixel_type>
struct pixel_type : mln::details::Pixel<pixel_type>
{
public: