Lagrange
Loading...
Searching...
No Matches
View3D.h
1/*
2 * Copyright 2025 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <mdspan/mdspan.hpp>
15
16// Not sure we will keep mdspan, so this is an experimental API
17// The plan is to have a low-level API around a multi-dimensional view (equivalent to span<> in core
18// module), and multi-dimensional array (in Array3D.h). Then we can build a higher-level Image class
19// on top of that (equivalent to the Attribute<> class in core module).
20namespace lagrange::image::experimental {
21
24
25template <class T, typename Extent, typename Layout>
26using mdspan = MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<T, Extent, Layout>;
27
28template <class IndexType, size_t... Extents>
29using extents = MDSPAN_IMPL_STANDARD_NAMESPACE::extents<IndexType, Extents...>;
30
31template <typename IndexType, size_t Rank>
32using dextents = MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<IndexType, Rank>;
33
34using layout_left = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_left;
35using layout_right = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_right;
36using layout_stride = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_stride;
37
38using full_extent_t = MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent_t;
39
40constexpr auto dynamic_extent = MDSPAN_IMPL_STANDARD_NAMESPACE::dynamic_extent;
41
42template <typename T>
43using View3D = mdspan<T, dextents<size_t, 3>, layout_stride>;
44
46
47} // namespace lagrange::image::experimental