30 #ifndef _D_MORPHO_LABEL_HPP
31 #define _D_MORPHO_LABEL_HPP
33 #include "Base/include/private/DImageArith.hpp"
34 #include "Core/include/DImage.h"
35 #include "DMorphImageOperations.hpp"
36 #include "Base/include/private/DBlobMeasures.hpp"
77 template <
class T1,
class T2,
class compOperatorT = std::equal_to<T1>>
78 class labelFunctGeneric :
public MorphImageFunctionBase<T1, T2>
81 typedef MorphImageFunctionBase<T1, T2> parentClass;
82 typedef typename parentClass::imageInType imageInType;
83 typedef typename parentClass::imageOutType imageOutType;
90 virtual RES_T initialize(
const imageInType &imIn, imageOutType &imOut,
93 parentClass::initialize(imIn, imOut, se);
97 max_value_label = ImDtTypes<T2>::max();
101 virtual RES_T processImage(
const imageInType &imIn,
102 imageOutType & ,
const StrElt & )
104 this->pixelsIn = imIn.getPixels();
106 size_t nbPixels = imIn.getPixelCount();
107 for (
size_t i = 0; i < nbPixels; i++) {
108 if (this->pixelsOut[i] == T2(0)) {
110 processPixel(i, dum);
116 virtual void processPixel(
size_t pointOffset,
117 SMIL_UNUSED vector<int> &dOffsets)
119 T1 pVal = this->pixelsIn[pointOffset];
121 if (pVal == T1(0) || this->pixelsOut[pointOffset] != T2(0))
124 queue<size_t> propagation;
128 if (labels == max_value_label)
130 this->pixelsOut[pointOffset] = (T2) labels;
131 propagation.push(pointOffset);
133 size_t pixPerLine = this->imSize[0];
134 size_t pixPerSlice = this->imSize[0] * this->imSize[1];
136 while (!propagation.empty()) {
137 off_t x, y, z, n_x, n_y, n_z;
139 bool oddLine =
false;
140 size_t curOffset, nbOffset;
142 curOffset = propagation.front();
143 pVal = this->pixelsIn[curOffset];
145 z = curOffset / (pixPerSlice);
146 y = (curOffset - z * pixPerSlice) / pixPerLine;
147 x = curOffset - y * pixPerLine - z * pixPerSlice;
149 oddLine = this->oddSe && (y % 2);
151 for (UINT i = 0; i < this->sePointNbr; ++i) {
155 if (n_z < 0 || n_z >= off_t(this->imSize[2]))
158 if (n_y < 0 || n_y >= off_t(this->imSize[1]))
161 if (oddLine && ((n_y + 1) % 2) != 0)
163 if (n_x < 0 || n_x >= off_t(this->imSize[0]))
169 nbOffset = n_x + n_y * pixPerLine + n_z * pixPerSlice;
170 if (nbOffset != curOffset && this->pixelsOut[nbOffset] != labels &&
171 compareFunc(this->pixelsIn[nbOffset], pVal)) {
172 this->pixelsOut[nbOffset] = T2(labels);
173 propagation.push(nbOffset);
180 compOperatorT compareFunc;
188 template <
class T1,
class T2,
class compOperatorT = std::equal_to<T1>>
189 class labelFunctFast :
public MorphImageFunctionBase<T1, T2>
192 typedef MorphImageFunctionBase<T1, T2> parentClass;
193 typedef typename parentClass::imageInType imageInType;
194 typedef typename parentClass::imageOutType imageOutType;
195 typedef typename imageInType::lineType lineInType;
196 typedef typename imageInType::sliceType sliceInType;
197 typedef typename imageOutType::lineType lineOutType;
198 typedef typename imageOutType::sliceType sliceOutType;
205 virtual RES_T initialize(
const imageInType &imIn, imageOutType &imOut,
208 parentClass::initialize(imIn, imOut, se);
212 max_value_label = ImDtTypes<T2>::max();
216 virtual RES_T processImage(
const imageInType &imIn, imageOutType &imOut,
220 Image<T1> tmp2(imIn);
221 ASSERT(
clone(imIn, tmp) == RES_OK);
222 if (this->imSize[2] == 1) {
223 ASSERT(
erode(tmp, tmp2, SquSE()) == RES_OK);
225 ASSERT(
erode(tmp, tmp2, CubeSE()) == RES_OK);
227 ASSERT(
sub(tmp, tmp2, tmp) == RES_OK);
229 lineInType pixelsTmp = tmp.getPixels();
239 for (
size_t i = 0; i < this->imSize[2] * this->imSize[1]; ++i) {
240 pixelsTmp[i * this->imSize[0]] = this->pixelsIn[i * this->imSize[0]];
244 queue<size_t> propagation;
245 int x, y, z, n_x, n_y, n_z;
248 T2 current_label = labels;
249 bool is_not_a_gap =
false;
250 bool process_labeling =
false;
255 i < this->imSize[2] * this->imSize[1] * this->imSize[0]; ++i) {
256 if (i % (this->imSize[0]) == 0) {
257 is_not_a_gap =
false;
259 if (pixelsTmp[i] != T1(0)) {
260 if (this->pixelsOut[i] == T2(0)) {
264 if (labels == max_value_label)
266 current_label = (T2) labels;
268 this->pixelsOut[i] = current_label;
269 process_labeling =
true;
271 current_label = this->pixelsOut[i];
276 if (this->pixelsIn[i] == T1(0)) {
277 is_not_a_gap =
false;
280 if (process_labeling) {
283 while (!propagation.empty()) {
284 z = propagation.front() / (this->imSize[1] * this->imSize[0]);
285 y = (propagation.front() - z * this->imSize[1] * this->imSize[0]) /
287 x = propagation.front() - y * this->imSize[0] -
288 z * this->imSize[1] * this->imSize[0];
290 oddLine = this->oddSe && (y % 2);
293 for (UINT i = 0; i < this->sePointNbr; ++i) {
294 p = this->sePoints[i];
297 n_x += (oddLine && ((n_y + 1) % 2) != 0);
299 nbOffset = n_x + (n_y) * this->imSize[0] +
300 (n_z) * this->imSize[1] * this->imSize[0];
301 if (n_x >= 0 && n_x < (
int) this->imSize[0] && n_y >= 0 &&
302 n_y < (int) this->imSize[1] && n_z >= 0 &&
303 n_z < (
int) this->imSize[2] &&
304 compareFunc(this->pixelsIn[nbOffset],
305 pixelsTmp[propagation.front()]) &&
306 this->pixelsOut[nbOffset] != current_label) {
307 this->pixelsOut[nbOffset] = current_label;
308 propagation.push(nbOffset);
314 process_labeling =
false;
319 size_t nSlices = imIn.getDepth();
320 size_t nLines = imIn.getHeight();
321 size_t nPixels = imIn.getWidth();
326 sliceInType srcLines = imIn.getLines();
327 sliceOutType desLines = imOut.getLines();
331 for (
size_t s = 0; s < nSlices; ++s) {
333 #pragma omp parallel private(lineIn, lineOut, l, v, previous_value, \
340 for (l = 0; l < nLines; ++l) {
341 lineIn = srcLines[l + s * nSlices];
342 lineOut = desLines[l + s * nSlices];
343 previous_value = lineIn[0];
344 previous_label = lineOut[0];
345 for (v = 1; v < nPixels; ++v) {
346 if (compareFunc(lineIn[v], previous_value)) {
347 lineOut[v] = previous_label;
349 previous_value = lineIn[v];
350 previous_label = lineOut[v];
359 compOperatorT compareFunc;
368 struct lambdaEqualOperator {
369 inline bool operator()(T &a, T &b)
371 bool retVal = a > b ? (a - b) <= lambda : (b - a) <= lambda;
379 template <
class T1,
class T2>
380 size_t labelWithoutFunctor(
const Image<T1> &imIn, Image<T2> &imOut,
381 const StrElt &se = DEFAULT_SE)
384 ASSERT_ALLOCATED(&imIn, &imOut);
385 ASSERT_SAME_SIZE(&imIn, &imOut);
388 typedef Image<T1> inT;
389 typedef Image<T2> outT;
390 typedef typename inT::lineType inLineT;
391 typedef typename outT::lineType outLineT;
394 StrElt cpSe = se.noCenter();
399 size_t lblNbr_real = 0;
402 UINT sePtsNumber = cpSe.points.size();
403 if (sePtsNumber == 0)
405 queue<size_t> propagation;
407 size_t x, x0, y, y0, z, z0;
410 inLineT inP = imIn.getPixels();
411 outLineT outP = imOut.getPixels();
413 for (
size_t s = 0; s < size[2]; ++s) {
414 for (
size_t l = 0; l < size[1]; ++l) {
415 for (
size_t p = 0; p < size[0]; ++p) {
416 o = p + l * size[0] + s * size[0] * size[1];
417 if (inP[o] != T1(0) && outP[o] == T2(0)) {
420 if (lblNbr == (
size_t)(ImDtTypes<T2>::max() - 1))
423 outP[o] = T2(lblNbr);
426 o = propagation.front();
430 y0 = (o % (size[1] * size[0])) / size[0];
431 z0 = o / (size[0] * size[1]);
432 oddLine = cpSe.odd && y0 % 2;
433 for (UINT pSE = 0; pSE < sePtsNumber; ++pSE) {
434 x = x0 + cpSe.points[pSE].x;
435 y = y0 + cpSe.points[pSE].y;
436 z = z0 + cpSe.points[pSE].z;
441 nb_o = x + y * size[0] + z * size[0] * size[1];
442 if (x < size[0] && y < size[1] && z < size[2] &&
443 outP[nb_o] != lblNbr && inP[nb_o] == inP[o]) {
444 outP[nb_o] = T2(lblNbr);
445 propagation.push(nb_o);
448 }
while (!propagation.empty());
457 template <
class T1,
class T2>
458 size_t labelWithoutFunctor2Partitions(
const Image<T1> &imIn,
459 const Image<T1> &imIn2,
461 const StrElt & se = DEFAULT_SE)
464 ASSERT_ALLOCATED(&imIn, &imIn2, &imOut);
465 ASSERT_SAME_SIZE(&imIn, &imOut);
466 ASSERT_SAME_SIZE(&imIn2, &imOut);
469 typedef Image<T1> inT;
470 typedef Image<T2> outT;
471 typedef typename inT::lineType inLineT;
472 typedef typename outT::lineType outLineT;
475 StrElt cpSe = se.noCenter();
480 size_t lblNbr_real = 0;
483 UINT sePtsNumber = cpSe.points.size();
484 if (sePtsNumber == 0)
486 queue<size_t> propagation;
488 size_t x, x0, y, y0, z, z0;
491 inLineT inP = imIn.getPixels();
492 inLineT in2P = imIn2.getPixels();
493 outLineT outP = imOut.getPixels();
495 for (
size_t s = 0; s < size[2]; ++s) {
496 for (
size_t l = 0; l < size[1]; ++l) {
497 for (
size_t p = 0; p < size[0]; ++p) {
498 o = p + l * size[0] + s * size[0] * size[1];
499 if (inP[o] != T1(0) && outP[o] == T2(0)) {
502 if (lblNbr == (
size_t) ImDtTypes<T2>::max() - 1)
505 outP[o] = T2(lblNbr);
508 o = propagation.front();
512 y0 = (o % (size[1] * size[0])) / size[0];
513 z0 = o / (size[0] * size[1]);
514 oddLine = cpSe.odd && y0 % 2;
515 for (UINT pSE = 0; pSE < sePtsNumber; ++pSE) {
516 x = x0 + cpSe.points[pSE].x;
517 y = y0 + cpSe.points[pSE].y;
518 z = z0 + cpSe.points[pSE].z;
523 nb_o = x + y * size[0] + z * size[0] * size[1];
524 if (x < size[0] && y < size[1] && z < size[2] &&
525 outP[nb_o] != lblNbr && inP[nb_o] == inP[o] &&
526 in2P[nb_o] == in2P[o]) {
527 outP[nb_o] = T2(lblNbr);
528 propagation.push(nb_o);
531 }
while (!propagation.empty());
563 template <
class T1,
class T2>
565 const StrElt &se = DEFAULT_SE)
567 if ((
void *) &imIn == (
void *) &imOut) {
570 return label(tmpIm, imOut);
573 ASSERT_ALLOCATED(&imIn, &imOut);
574 ASSERT_SAME_SIZE(&imIn, &imOut);
576 labelFunctGeneric<T1, T2> f;
578 ASSERT((f._exec(imIn, imOut, se) == RES_OK), 0);
580 size_t lblNbr = f.getLabelNbr();
583 std::cerr <<
"Label number exceeds data type max!" << std::endl;
605 template <
class T1,
class T2>
609 ASSERT_ALLOCATED(&imIn, &imOut);
610 ASSERT_SAME_SIZE(&imIn, &imOut);
612 labelFunctGeneric<T1, T2, lambdaEqualOperator<T1>> f;
613 f.compareFunc.lambda = lambdaVal;
615 ASSERT((f._exec(imIn, imOut, se) == RES_OK), 0);
617 size_t lblNbr = f.getLabelNbr();
620 std::cerr <<
"Label number exceeds data type max!" << std::endl;
633 template <
class T1,
class T2>
635 const StrElt &se = DEFAULT_SE)
637 ASSERT_ALLOCATED(&imIn, &imOut);
638 ASSERT_SAME_SIZE(&imIn, &imOut);
640 labelFunctFast<T1, T2> f;
642 ASSERT((f._exec(imIn, imOut, se) == RES_OK), 0);
644 size_t lblNbr = f.getLabelNbr();
647 std::cerr <<
"Label number exceeds data type max!" << std::endl;
664 template <
class T1,
class T2>
668 ASSERT_ALLOCATED(&imIn, &imOut);
669 ASSERT_SAME_SIZE(&imIn, &imOut);
671 labelFunctFast<T1, T2, lambdaEqualOperator<T1>> f;
672 f.compareFunc.lambda = lambdaVal;
674 ASSERT((f._exec(imIn, imOut, se) == RES_OK), 0);
676 size_t lblNbr = f.getLabelNbr();
679 std::cerr <<
"Label number exceeds data type max!" << std::endl;
685 template <
typename T>
686 inline double maxMapValueDouble(map<T, double> &m)
688 return std::max_element(m.begin(), m.end(), map_comp_value_less())->second;
691 template <
typename T>
692 inline double minMapValueDouble(map<T, double> &m)
694 return std::min_element(m.begin(), m.end(), map_comp_value_less())->second;
735 template <
typename T1,
typename T2,
typename T3>
739 const string property =
"area",
bool doRescale =
false,
742 ASSERT_ALLOCATED(&imIn, &imRegions, &imLabelOut);
743 ASSERT_SAME_SIZE(&imIn, &imRegions, &imLabelOut);
745 vector<double> retVal(3);
747 map<string, int> property2key = {
748 {
"area", 1}, {
"volume", 2}, {
"max", 3}, {
"min", 4},
749 {
"mean", 5}, {
"stddev", 6}, {
"median", 7}, {
"mode", 8},
750 {
"nbvalues", 9}, {
"entropy", 10}};
751 if (property2key.find(property) == property2key.end()) {
752 ERR_MSG(
"Property unknown when calling function labelWithProperty");
755 int key = property2key[property];
761 size_t nl =
label(imRegions, imLabel, se);
764 "Increase output image type to include value " + to_string(nl);
769 ERR_MSG(
"No labels returned");
773 map<T3, double> markers;
775 typedef typename std::map<T3, T2>::iterator itT2_T;
776 typedef typename std::map<T3, std::vector<T2>>::iterator itT2Vec_T;
777 typedef typename std::map<T3, double>::iterator itD_T;
778 typedef typename std::map<T3, std::vector<double>>::iterator itDVec_T;
783 map<T3, double> values =
blobsArea(blobs);
784 for (itD_T iter = values.begin(); iter != values.end(); ++iter) {
785 markers[iter->first] = iter->second;
791 for (itD_T iter = values.begin(); iter != values.end(); ++iter) {
792 markers[iter->first] = iter->second;
798 for (itT2_T iter = values.begin(); iter != values.end(); ++iter) {
799 markers[iter->first] = iter->second;
805 for (itT2_T iter = values.begin(); iter != values.end(); ++iter) {
806 markers[iter->first] = iter->second;
811 map<T3, std::vector<double>> values =
blobsMeanVal(imIn, blobs);
812 for (itDVec_T iter = values.begin(); iter != values.end(); ++iter) {
813 markers[iter->first] = (iter->second)[0];
818 map<T3, std::vector<double>> values =
blobsMeanVal(imIn, blobs);
819 for (itDVec_T iter = values.begin(); iter != values.end(); ++iter) {
820 markers[iter->first] = (iter->second)[1];
826 for (itT2_T iter = values.begin(); iter != values.end(); ++iter) {
827 markers[iter->first] = iter->second;
833 for (itT2_T iter = values.begin(); iter != values.end(); ++iter) {
834 markers[iter->first] = iter->second;
840 for (itT2Vec_T iter = values.begin(); iter != values.end(); ++iter) {
841 markers[iter->first] = iter->second.size();
847 for (itD_T iter = values.begin(); iter != values.end(); ++iter) {
848 markers[iter->first] = iter->second;
856 ASSERT(!markers.empty());
858 double maxV = maxMapValueDouble(markers);
859 double minV = minMapValueDouble(markers);
867 double k = (maxT - 1.) / (maxV - minV);
868 for (
auto it = markers.begin(); it != markers.end(); it++) {
870 it->second = 1. + k * (it->second - minV);
872 cout <<
" Values where rescaled :" << endl;
873 cout <<
" Min : \t" << minV <<
"\t=> " << 1. << endl;
874 cout <<
" Max : \t" << maxV <<
"\t=> " << maxT << endl;
875 maxV = maxMapValueDouble(markers);
878 if (abs(
scale - 1.) > 0.001)
880 for (
auto it = markers.begin(); it != markers.end(); it++)
886 ss <<
"Max " <<
property <<
" value (" << maxV
887 <<
") exceeds data type upper limit (" << maxT <<
")";
892 if (
applyLookup(imLabel, markers, imLabelOut) != RES_OK)
918 template <
class T1,
class T2>
920 const StrElt &se = DEFAULT_SE)
925 ASSERT_ALLOCATED(&imIn, &imOut);
926 ASSERT_SAME_SIZE(&imIn, &imOut);
932 ASSERT(
label(imIn, imLabel, se) != 0);
933 map<T2, double> areas =
blobsArea(imLabel);
934 ASSERT(!areas.empty());
940 "Areas max value exceeds data type max!", 0);
942 ASSERT(
applyLookup(imLabel, areas, imOut) == RES_OK);
968 template <
class T1,
class T2>
976 ASSERT_ALLOCATED(&imIn, &imLabelOut);
977 ASSERT_SAME_SIZE(&imIn, &imLabelOut);
983 ASSERT(
label(imLabelIn, imLabel, se) != 0);
984 label(imLabelIn, imLabel, se);
985 bool onlyNonZeros =
true;
986 map<T2, Blob> blobs =
computeBlobs(imLabel, onlyNonZeros);
987 map<T2, double> volumes =
blobsVolume(imIn, blobs);
988 ASSERT(!volumes.empty());
993 cout << maxV << endl;
995 "Volumes max value exceeds data type max!", 0);
997 ASSERT(
applyLookup(imLabel, volumes, imLabelOut) == RES_OK);
1023 template <
class T1,
class T2>
1030 ASSERT_ALLOCATED(&imIn, &imLabelOut);
1031 ASSERT_SAME_SIZE(&imIn, &imLabelOut);
1037 ASSERT(
label(imLabelIn, imLabel, se) != 0);
1038 label(imLabelIn, imLabel, se);
1039 bool onlyNonZeros =
true;
1040 map<T2, Blob> blobs =
computeBlobs(imLabel, onlyNonZeros);
1042 ASSERT(!markers.empty());
1049 "Markers max value exceeds data type max!", 0);
1051 ASSERT(
applyLookup(imLabel, markers, imLabelOut) == RES_OK);
1077 template <
class T1,
class T2>
1085 ASSERT_ALLOCATED(&imIn, &imLabelOut);
1086 ASSERT_SAME_SIZE(&imIn, &imLabelOut);
1092 ASSERT(
label(imLabelIn, imLabel, se) != 0);
1093 label(imLabelIn, imLabel, se);
1094 bool onlyNonZeros =
true;
1095 map<T2, Blob> blobs =
computeBlobs(imLabel, onlyNonZeros);
1096 map<T2, std::vector<double>> meanValsStd =
blobsMeanVal(imIn, blobs);
1097 map<T2, double> markers;
1099 for (
typename std::map<T2, std::vector<double>>::iterator iter =
1100 meanValsStd.begin();
1101 iter != meanValsStd.end(); ++iter) {
1102 markers[iter->first] = (iter->second)[0];
1107 ASSERT(!markers.empty());
1113 "Markers max value exceeds data type max!", 0);
1115 ASSERT(
applyLookup(imLabel, markers, imLabelOut) == RES_OK);
1122 template <
class T1,
class T2>
1123 class neighborsFunct :
public MorphImageFunctionBase<T1, T2>
1126 typedef MorphImageFunctionBase<T1, T2> parentClass;
1128 virtual inline void processPixel(
size_t pointOffset,
1129 vector<int> &dOffsetList)
1133 vector<int>::iterator dOffset = dOffsetList.begin();
1134 while (dOffset != dOffsetList.end()) {
1135 T1 val = parentClass::pixelsIn[pointOffset + *dOffset];
1136 if (find(vals.begin(), vals.end(), val) == vals.end()) {
1137 vals.push_back(val);
1142 parentClass::pixelsOut[pointOffset] = T2(nbrValues);
1159 template <
class T1,
class T2>
1161 const StrElt &se = DEFAULT_SE)
1163 ASSERT_ALLOCATED(&imIn, &imOut);
1164 ASSERT_SAME_SIZE(&imIn, &imOut);
1166 neighborsFunct<T1, T2> f;
1168 ASSERT((f._exec(imIn, imOut, se) == RES_OK));
Definition: DBaseImage.h:386
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 applyLookup(const Image< T1 > &imIn, const mapT &_map, Image< T2 > &imOut, T2 defaultValue=T2(0))
applyLookup() - Apply a lookup map to a labeled image
Definition: DImageArith.hpp:1990
RES_T fill(Image< T > &imOut, const T &value)
fill() - Fill an image with a given value.
Definition: DImageArith.hpp:1456
map< labelT, double > blobsVolume(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsVolume() - Measure the sum of values of each blob in imIn.
Definition: DBlobMeasures.hpp:91
map< labelT, T > blobsMedianVal(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsMedianVal() - Measure the median value of imIn in each blob.
Definition: DBlobMeasures.hpp:193
map< T, Blob > computeBlobs(const Image< T > &imIn, bool onlyNonZero=true)
Create a map of blobs from a labeled image.
Definition: DBlob.hpp:98
map< labelT, double > blobsEntropy(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsEntropy() - Measure blobs entropy.
Definition: DBlobMeasures.hpp:340
map< labelT, Vector_double > blobsMeanVal(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsMeanVal() - Measure the mean value and the std dev.
Definition: DBlobMeasures.hpp:150
map< labelT, T > blobsMaxVal(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsMaxVal() - Measure the maximum value of each blob in imIn.
Definition: DBlobMeasures.hpp:120
map< labelT, T > blobsMinVal(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsMinVal() - Measure the minimum value of each blob in imIn.
Definition: DBlobMeasures.hpp:106
map< labelT, T > blobsModeVal(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsModeVal() - Measure the mode value of imIn in each blob.
Definition: DBlobMeasures.hpp:180
map< labelT, vector< T > > blobsValueList(const Image< T > &imIn, map< labelT, Blob > &blobs)
blobsValueList() - Measure the list of values of each blob in imIn.
Definition: DBlobMeasures.hpp:165
map< T, double > blobsArea(const Image< T > &imLbl, const bool onlyNonZero=true)
blobsArea() - Calculate the area of each region in a labeled image
Definition: DBlobMeasures.hpp:60
RES_T neighbors(const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
neighbors() - Neighbors count
Definition: DMorphoLabel.hpp:1160
size_t labelWithVolume(const Image< T1 > &imIn, const Image< T2 > &imLabelIn, Image< T2 > &imLabelOut, const StrElt &se=DEFAULT_SE)
labelWithVolume() - Image labelization with the volume (sum of values) of each connected components i...
Definition: DMorphoLabel.hpp:969
size_t label(const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
label() - Image labelization
Definition: DMorphoLabel.hpp:564
size_t labelWithMax(const Image< T1 > &imIn, const Image< T2 > &imLabelIn, Image< T2 > &imLabelOut, const StrElt &se=DEFAULT_SE)
labelwithMax() - Image labelization with the maximum values of each connected components in the imLab...
Definition: DMorphoLabel.hpp:1024
size_t labelWithProperty(const Image< T1 > &imRegions, const Image< T2 > &imIn, Image< T3 > &imLabelOut, const string property="area", bool doRescale=false, double scale=1., const StrElt &se=DEFAULT_SE)
labelWithProperty() - Image labelization with the value of the property of each connected components ...
Definition: DMorphoLabel.hpp:737
size_t fastLabel(const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
fastLabel() - Image labelization (faster, use OpenMP)
Definition: DMorphoLabel.hpp:634
size_t labelWithArea(const Image< T1 > &imIn, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
labelWithArea() - Image labelization with the size (area) of each connected components
Definition: DMorphoLabel.hpp:919
size_t lambdaLabel(const Image< T1 > &imIn, const T1 &lambdaVal, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
lambdaLabel() - Lambda-flat zones labelization
Definition: DMorphoLabel.hpp:606
size_t labelWithMean(const Image< T1 > &imIn, const Image< T2 > &imLabelIn, Image< T1 > &imLabelOut, const StrElt &se=DEFAULT_SE)
labelWithMean() - Image labelization with the mean values of each connected components in the imLabel...
Definition: DMorphoLabel.hpp:1078
size_t lambdaFastLabel(const Image< T1 > &imIn, const T1 &lambdaVal, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
lambdaFastLabel() - Lambda-flat zones labelization (faster, use OpenMP)
Definition: DMorphoLabel.hpp:665
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
Definition: DTypes.hpp:88
Definition: DCommon.h:111