from morph import *
from Numeric import shape
aux = mmreadgray('corneacells.tif');
a=aux[:shape(aux)[0]/2,:shape(aux)[1]/2];
c = mmopen(a,mmsedisk(2));
d = mmregmax( c);
e = mmneg(a);
f = mmcwatershed(e, d, mmsebox());
g = mmgray(f, 'uint16', 1);
h1 = mmaddm(mmlabel(d), uint16(1));
h = mmintersec(mmgray(d,'uint16'), h1);
i = mmunion( g, h);
j = mmgradm( a);
k = mmcwatershed(j, i);
mmshow(a);
mmshow(c);
mmshow(d);
mmshow(f,d);
mmshow(j);
mmshow(a,k);