def phi(self, size=(151, 151)): """Returns implicit contour representation of the worm shape Arguments: size (tuple ro array): size of the contour representation Returns: array: contour representation of the worm Note: worm border is given by phi==0 """ return mask_to_phi(self.mask(size=size))
def phi(self, size = (151, 151)): """Returns implicit contour representation of the worm shape Arguments: size (tuple ro array): size of the contour representation Returns: array: contour representation of the worm Note: worm border is given by phi==0 """ return mask_to_phi(self.mask(size = size));
def phi_from_image(self, img, threshold = 75): return msk.mask_to_phi(img < threshold);
def phi_from_image(self, img, threshold=75): return msk.mask_to_phi(img < threshold)
import worm.model as wm; # load image img = exp.load_img(wid = 80, t= 500000, smooth = 1.0); aplt.plot_array(img); from skimage.filters import threshold_otsu threshold_factor = 0.95; level = threshold_factor * threshold_otsu(img); from imageprocessing.masking import mask_to_phi phi_img = mask_to_phi(img < level); ### worm -> Phi w = wm.WormModel(npoints = 20); w.from_image(img, sigma = None) w.plot(image = img); phi = w.phi() plt.figure(1); plt.subplot(1,3,1); plt.imshow(phi); plt.subplot(1,3,2);
import worm.model as wm # load image img = exp.load_img(wid=80, t=500000, smooth=1.0) aplt.plot_array(img) from skimage.filters import threshold_otsu threshold_factor = 0.95 level = threshold_factor * threshold_otsu(img) from imageprocessing.masking import mask_to_phi phi_img = mask_to_phi(img < level) ### worm -> Phi w = wm.WormModel(npoints=20) w.from_image(img, sigma=None) w.plot(image=img) phi = w.phi() plt.figure(1) plt.subplot(1, 3, 1) plt.imshow(phi) plt.subplot(1, 3, 2) plt.imshow(phi_img)