17 using value_type =
typename T::value_type;
19 static_assert(std::is_integral<value_type>::value,
"Integral image required.");
21 GOOSEEYE_ASSERT(f.dimension() == m_shape_orig.size(), std::out_of_range);
22 GOOSEEYE_ASSERT(m_stat == Type::L || m_stat == Type::Unset, std::out_of_range);
28 xt::pad_mode pad_mode = xt::pad_mode::constant;
32 pad_mode = xt::pad_mode::periodic;
43 auto ix = m_shape[0] > 1 ? xt::range(1, m_shape[0] - 1) : xt::range(0, m_shape[0]);
44 auto iy = m_shape[1] > 1 ? xt::range(1, m_shape[1] - 1) : xt::range(0, m_shape[1]);
45 auto iz = m_shape[2] > 1 ? xt::range(1, m_shape[2] - 1) : xt::range(0, m_shape[2]);
47 xt::view(r, ix, iy, iz) = 0;
51 for (
size_t i = 0; i < MAX_DIM; ++i) {
52 xt::view(stamp, xt::all(), xt::keep(i)) -= m_pad[i][0];
57 for (
size_t istamp = 0; istamp < stamp.shape(0); ++istamp) {
61 GooseEYE::path({0, 0, 0}, {stamp(istamp, 0), stamp(istamp, 1), stamp(istamp, 2)}, mode);
64 for (
size_t h = m_pad[0][0]; h < F.shape(0) - m_pad[0][1]; ++h) {
65 for (
size_t i = m_pad[1][0]; i < F.shape(1) - m_pad[1][1]; ++i) {
66 for (
size_t j = m_pad[2][0]; j < F.shape(2) - m_pad[2][1]; ++j) {
67 for (
size_t p = 0; p <
path.shape(0); ++p) {
73 if (!F(h + dh, i + di, j + dj)) {
77 m_first(m_pad[0][0] + dh, m_pad[1][0] + di, m_pad[2][0] + dj) += 1.0;
84 for (
size_t p = 0; p <
path.shape(0); ++p) {
88 m_norm(m_pad[0][0] + dh, m_pad[1][0] + di, m_pad[2][0] + dj) += f.size();
array_type::tensor< int, 2 > path(const array_type::tensor< int, 1 > &x0, const array_type::tensor< int, 1 > &x1, path_mode mode=path_mode::Bresenham)
Compute a path between two pixels.