1 from smilPython
import *
3 class myWSFlooding(WatershedFlooding_UINT8_UINT16):
4 def initialize(self, imIn, imLbl, imOut, se):
6 WatershedFlooding_UINT8_UINT16.initialize(self, imIn, imLbl, imOut, se)
7 self.imgWS.updatesEnabled =
True
8 self.imgLbl.updatesEnabled =
True
9 self.nbrPixProcessed = 0
10 self.refresh_every = 10
12 def processPixel(self, offset):
14 WatershedFlooding_UINT8_UINT16.processPixel(self, offset)
15 if self.nbrPixProcessed>=self.refresh_every:
17 self.imgLbl.modified()
19 self.nbrPixProcessed = 0
21 self.nbrPixProcessed += 1
24 if not "imIn" in globals():
25 imIn = Image(
"https://smil.cmm.minesparis.psl.eu/images/lena.png")
28 imMark = Image(imIn,
"UINT16")
29 imBasins = Image(imIn,
"UINT16")
38 wsFlood = myWSFlooding()
39 wsFlood.flood(imIn, imMark, imWS, imBasins, sSE())
RES_T hMinimaLabeled(const Image< T1 > &imIn, const T1 &height, Image< T2 > &imOut, const StrElt &se=DEFAULT_SE)
hMinimaLabeled() - Calculate the h-minima and labelize them
Definition: DMorphoExtrema.hpp:182
RES_T gradient(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE)
gradient() - Morphological gradient
Definition: DMorphoResidues.hpp:62