pink26 0.1.1
Image processing and digital topology for teaching
Loading...
Searching...
No Matches
neighbors.h
Go to the documentation of this file.
1/*
2Copyright Alain Lebret (2026)
3
4This software is an image processing library whose purpose is to be
5used primarily for research and teaching.
6
7This software is governed by the CeCILL license under French law and
8abiding by the rules of distribution of free software. You can use,
9modify and/ or redistribute the software under the terms of the CeCILL
10license as circulated by CEA, CNRS and INRIA at the following URL
11"http://www.cecill.info".
12
13As a counterpart to the access to the source code and rights to copy,
14modify and redistribute granted by the license, users are provided only
15with a limited warranty and the software's author, the holder of the
16economic rights, and the successive licensors have only limited
17liability.
18
19In this respect, the user's attention is drawn to the risks associated
20with loading, using, modifying and/or developing or reproducing the
21software by the user in light of its specific status of free software,
22that may mean that it is complicated to manipulate, and that also
23therefore means that it is reserved for developers and experienced
24professionals having in-depth computer knowledge. Users are therefore
25encouraged to load and test the software's suitability as regards their
26requirements in conditions enabling the security of their systems and/or
27data to be ensured and, more generally, to use and operate it in the
28same conditions as regards security.
29
30The fact that you are presently reading this means that you have had
31knowledge of the CeCILL license. You don't have to accept the License,
32but note that nothing other than this License grants you permission
33to use, propagate or modify any covered work.
34*/
35
49
50#ifndef PINK26_NEIGHBORS_H
51#define PINK26_NEIGHBORS_H
52
53#include <pink26/image.h>
54
56enum { P26_NEIGHBORS_2D_MAX = 8, P26_NEIGHBORS_3D_MAX = 26 };
57
59typedef struct {
60 int n;
61 int dx[P26_NEIGHBORS_3D_MAX];
62 int dy[P26_NEIGHBORS_3D_MAX];
63 int dz[P26_NEIGHBORS_3D_MAX];
64 p26_index offset[P26_NEIGHBORS_3D_MAX];
66
87p26_status p26_neighborhood_init(const p26_image *img, int connectivity,
88 p26_neighborhood *neighborhood);
89
110int p26_neighbor(const p26_neighborhood *neighborhood, const p26_image *img, p26_index i, int k,
111 p26_index *neighbor_index);
112
113#endif /* PINK26_NEIGHBORS_H */
The image descriptor shared by every pink26 operator.
int p26_neighbor(const p26_neighborhood *neighborhood, const p26_image *img, p26_index i, int k, p26_index *neighbor_index)
Finds neighbor k of pixel i, if it lies inside the image.
p26_status p26_neighborhood_init(const p26_image *img, int connectivity, p26_neighborhood *neighborhood)
Builds the neighborhood of the given connectivity for img's geometry.
p26_status
Result of a pink26 function.
Definition status.h:75
int64_t p26_index
Pixel index or size in pixels (64-bit, so large 3D images fit).
Definition status.h:72
A 2D or 3D image.
Definition image.h:68
The neighbors of a pixel for one connectivity and one image geometry.
Definition neighbors.h:59
int dz[P26_NEIGHBORS_3D_MAX]
Displacement along z of neighbor k.
Definition neighbors.h:63
int dx[P26_NEIGHBORS_3D_MAX]
Displacement along x of neighbor k.
Definition neighbors.h:61
int dy[P26_NEIGHBORS_3D_MAX]
Displacement along y of neighbor k.
Definition neighbors.h:62
p26_index offset[P26_NEIGHBORS_3D_MAX]
Index offset: dz * rs * cs + dy * rs + dx.
Definition neighbors.h:64
int n
Number of neighbors: 4, 8, 6, 18 or 26.
Definition neighbors.h:60