cytometer/deepcell.py
def step(self):
		"""Perform a single step of the morphological Chan-Vese evolution."""
		# Assign attributes to local variables for convenience.
		u = self._u
		
		if u is None:
			raise ValueError("the levelset function is not set (use set_levelset)")
		
		data = self.data
		
		# Create mask to separate objects
		labeled, nr_objects = mh.label(u)
		mask = mh.segmentation.gvoronoi(labeled)
		mask = 1-find_boundaries(mask)

		self.mask = np.float32(mask)/np.float32(mask).max()

		# Determine c0 and c1.
		inside = u>0
		outside = u<=0
		c0 = data[outside].sum() / float(outside.sum())
		c1 = data[inside].sum() / float(inside.sum())
		
		# Image attachment.
		dres = np.array(np.gradient(u))
		abs_dres = np.abs(dres).sum(0)
		aux = abs_dres * (self.lambda1*(data - c1)**2 - self.lambda2*(data - c0)**2)
		
		res = np.copy(u)
		res[aux < 0] = 1
		res[aux > 0] = 0
		
		# Smoothing.
		for i in range(self.smoothing):
			res = curvop(res)
		
		# Apply mask
		res *= mask

		self._u = res
Perform a single step of the morphological Chan-Vese evolution.
Perform a single step of the morphological Chan-Vese evolution.
Perform a single step of the morphological Chan - Vese evolution .
def step(self):
		u = self._u
		if u is None:
			raise ValueError("the levelset function is not set (use set_levelset)")
		data = self.data
		labeled, nr_objects = mh.label(u)
		mask = mh.segmentation.gvoronoi(labeled)
		mask = 1-find_boundaries(mask)
		self.mask = np.float32(mask)/np.float32(mask).max()
		inside = u>0
		outside = u<=0
		c0 = data[outside].sum() / float(outside.sum())
		c1 = data[inside].sum() / float(inside.sum())
		dres = np.array(np.gradient(u))
		abs_dres = np.abs(dres).sum(0)
		aux = abs_dres * (self.lambda1*(data - c1)**2 - self.lambda2*(data - c0)**2)
		res = np.copy(u)
		res[aux < 0] = 1
		res[aux > 0] = 0
		for i in range(self.smoothing):
			res = curvop(res)
		res *= mask
		self._u = res
def step ( self ) : u = self . _u if u is None : raise ValueError ( "the levelset function is not set (use set_levelset)" ) data = self . data labeled , nr_objects = mh . label ( u ) mask = mh . segmentation . gvoronoi ( labeled ) mask = 1 - find_boundaries ( mask ) self . mask = np . float32 ( mask ) / np . float32 ( mask ) . max ( ) inside = u > 0 outside = u <= 0 c0 = data [ outside ] . sum ( ) / float ( outside . sum ( ) ) c1 = data [ inside ] . sum ( ) / float ( inside . sum ( ) ) dres = np . array ( np . gradient ( u ) ) abs_dres = np . abs ( dres ) . sum ( 0 ) aux = abs_dres * ( self . lambda1 * ( data - c1 ) ** 2 - self . lambda2 * ( data - c0 ) ** 2 ) res = np . copy ( u ) res [ aux < 0 ] = 1 res [ aux > 0 ] = 0 for i in range ( self . smoothing ) : res = curvop ( res ) res *= mask self . _u = res
Perform a single step of the morphological Chan-Vese evolution.
Perform a single step of the morphological Chan - Vese evolution .
"""Perform a single step of the morphological Chan-Vese evolution.""" # Assign attributes to local variables for convenience. # Create mask to separate objects # Determine c0 and c1. # Image attachment. # Smoothing. # Apply mask
self