30 #ifndef _D_SKELETON_HPP
31 #define _D_SKELETON_HPP
33 #include "DMorphoBase.hpp"
34 #include "DHitOrMiss.hpp"
72 ASSERT_ALLOCATED(&imIn, &imOut);
73 ASSERT_SAME_SIZE(&imIn, &imOut);
93 const StrElt &se = DEFAULT_SE)
95 ASSERT_ALLOCATED(&imIn, &imOut);
96 ASSERT_SAME_SIZE(&imIn, &imOut);
109 erode(imEro, imEro, se);
110 open(imEro, imTemp, se);
111 sub(imEro, imTemp, imTemp);
112 sup(imOut, imTemp, imTemp);
113 idempt =
equ(imTemp, imOut);
127 template <
class T1,
class T2>
129 const StrElt &se = DEFAULT_SE)
131 ASSERT_ALLOCATED(&imIn, &imOut);
132 ASSERT_SAME_SIZE(&imIn, &imOut);
146 erode(imEro, imEro, se);
147 open(imEro, imTemp1, se);
148 sub(imEro, imTemp1, imTemp1);
149 test(imTemp1, r++, imOut, imTemp2);
150 idempt =
equ(imTemp2, imOut);
151 copy(imTemp2, imOut);
179 const StrElt &se = DEFAULT_SE)
181 ASSERT_ALLOCATED(&imIn, &imOut);
182 ASSERT_SAME_SIZE(&imIn, &imOut);
185 T *out = imOut.getPixels();
187 fill<T>(imOut, T(0));
192 size_t nbrPixels = Size[0] * Size[1] * Size[2];
193 size_t sePtsNumber = se.points.size();
196 UINT nthreads = Core::getInstance()->getNumberOfThreads();
197 #pragma omp parallel num_threads(nthreads)
203 for (
size_t i = 0; i < nbrPixels; ++i) {
210 for (UINT pts = 0; pts < sePtsNumber; ++pts) {
213 qt.
shift(se.points[pts]);
217 if (in[qt.reference] >= in[pt.reference] + 1) {
220 if (in[qt.reference] <= in[pt.reference] - 1) {
228 out[pt.reference] = in[pt.reference];
void getSize(size_t *w, size_t *h, size_t *d) const
Get image size.
Definition: DBaseImage.h:118
Hexagonal L ([1,2], [4,5])
Definition: DCompositeSE.h:216
Hexagonal M ([1], [3,4,5])
Definition: DCompositeSE.h:238
ImageBox.
Definition: DCommon.h:267
void setReference(off_t x, off_t y, off_t z=0)
setReference() - set reference point
Definition: DCommon.h:320
bool inImage()
inImage() - check if the reference point is inside image bounds
Definition: DCommon.h:396
void shift(off_t dx, off_t dy, off_t dz=0)
shift() - move the point by some displacements
Definition: DCommon.h:371
Definition: DBaseImage.h:386
Main Image class.
Definition: DImage.hpp:57
lineType getPixels() const
Get the pixels as a 1D array.
Definition: DImage.hpp:105
Base structuring element.
Definition: DStructuringElement.h:68
RES_T sub(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
sub() - Subtraction between two images
Definition: DImageArith.hpp:160
RES_T inv(const Image< T > &imIn, Image< T > &imOut)
inv() - Invert an image.
Definition: DImageArith.hpp:70
RES_T sup(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
sup() - Sup of two images
Definition: DImageArith.hpp:254
RES_T equ(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
equ() - Equality operator (pixel by pixel)
Definition: DImageArith.hpp:366
RES_T test(const Image< T1 > &imIn, const Image< T2 > &imInT, const Image< T2 > &imInF, Image< T2 > &imOut)
test() - Test
Definition: DImageArith.hpp:1109
RES_T fill(Image< T > &imOut, const T &value)
fill() - Fill an image with a given value.
Definition: DImageArith.hpp:1456
RES_T open(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE)
open() - Morphological grayscale opening
Definition: DMorphoFilter.hpp:123
RES_T fullThin(const Image< T > &imIn, const CompStrEltList &mhtSE, Image< T > &imOut)
fullThin() - Thinning transform (full)
Definition: DHitOrMiss.hpp:303
RES_T erode(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE, const T borderVal=ImDtTypes< T >::max())
erode() - Morphological grayscale erosion
Definition: DMorphoBase.hpp:112
RES_T skeleton(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE)
skeleton() - Morphological skeleton
Definition: DSkeleton.hpp:92
RES_T pruneSkiz(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE)
pruneSkiz() -
Definition: DSkeleton.hpp:178
RES_T skiz(const Image< T > &imIn, Image< T > &imOut)
skiz() - Skeleton by Influence Zones (Skiz)
Definition: DSkeleton.hpp:70
RES_T extinctionValues(const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
extinctionValues() - Extinction values
Definition: DSkeleton.hpp:128
Definition: DTypes.hpp:88