def iainfgen(f, Iab): from iaunion import iaunion from iadil import iadil from ianeg import ianeg A, Bc = Iab y = iaunion(iadil(f, A), iadil(ianeg(f), Bc)) return y
def iaero(f, b=None): from ianeg import ianeg from iadil import iadil from iasereflect import iasereflect from iasecross import iasecross if b is None: b = iasecross() y = ianeg(iadil(ianeg(f), iasereflect(b))) return y
def iaopen(f, b=None): from iadil import iadil from iaero import iaero from iasecross import iasecross if b is None: b = iasecross() y = iadil( iaero(f,b),b) return y
def iagradm(f, Bdil=None, Bero=None): from iasubm import iasubm from iadil import iadil from iaero import iaero from iasecross import iasecross if Bdil is None: Bdil = iasecross() if Bero is None: Bero = iasecross() y = iasubm( iadil(f,Bdil),iaero(f,Bero)) return y
def iaclose(f, b=None): from iaero import iaero from iadil import iadil from iasecross import iasecross if b is None: b = iasecross() y = iaero(iadil(f, b), b) return y
def iacdil(f, g, b=iasecross(), n=1): from iaintersec import iaintersec from iadil import iadil from iaisequal import iaisequal y = iaintersec(f, g) for i in range(n): aux = y y = iaintersec(iadil(y, b), g) if iaisequal(y, aux): break return y
def iacdil(f, g, b=iasecross(), n=1): from iaintersec import iaintersec from iadil import iadil from iaisequal import iaisequal y = iaintersec(f,g) for i in xrange(n): aux = y y = iaintersec( iadil(y,b),g) if iaisequal(y,aux): break return y
def iaskelmrec(f, B=None): from iabinary import iabinary from iaintersec import iaintersec from iadil import iadil from iaunion import iaunion from iasecross import iasecross if B is None: B = iasecross(None) y = iabinary(iaintersec(f, 0)) for r in range(max(ravel(f)), 1, -1): y = iadil(iaunion(y, iabinary(f, r)), B) y = iaunion(y, iabinary(f, 1)) return y
def iaskelmrec(f, B=None): from iabinary import iabinary from iaintersec import iaintersec from iadil import iadil from iaunion import iaunion from iasecross import iasecross if B is None: B = iasecross(None) y = iabinary( iaintersec(f, 0)) for r in range(max(ravel(f)),1,-1): y = iadil( iaunion(y,iabinary(f,r)), B) y = iaunion(y, iabinary(f,1)) return y
def iabshow(f1, f2=None, f3=None, factor=17): from iabinary import iabinary from iaframe import iaframe from iadil import iadil from iaunion import iaunion from iasedisk import iasedisk from iaserot import iaserot from iasecross import iasecross from iasesum import iasesum assert f1.dtype == bool, 'f1 must be boolean image' factor = max(factor, 9) hfactor = factor / 2 if size(f1.shape) == 1: f1 = f1[newaxis, :] if f2 != None: f2 = f2[newaxis, :] if f3 != None: f3 = f3[newaxis, :] bz = zeros(factor * array(f1.shape)).astype(bool) b0 = asarray(bz) b0[hfactor::factor, hfactor::factor] = f1 fr1 = iaframe(zeros((factor, factor), bool)) fr1 = iadil(b0, fr1) if f2 != None: assert f1.shape == f2.shape, 'f1 and f2 must have same shape' b1 = asarray(bz) b1[hfactor::factor, hfactor::factor] = f2 fr2 = iadil(b1, iasedisk(hfactor - 4)) fr1 = iaunion(fr1, fr2) if f3 != None: assert f1.shape == f3.shape, 'f1 and f3 must have same shape' bz[hfactor::factor, hfactor::factor] = f3 fr3 = iadil(bz, iasesum(iaserot(iasecross(1), 45), hfactor - 1)) fr1 = iaunion(fr1, fr3) return fr1
def iabshow(f1, f2=None, f3=None, factor=17): from iabinary import iabinary from iaframe import iaframe from iadil import iadil from iaunion import iaunion from iasedisk import iasedisk from iaserot import iaserot from iasecross import iasecross from iasesum import iasesum assert f1.dtype == bool, 'f1 must be boolean image' factor = max(factor,9) hfactor = factor/2 if size(f1.shape) == 1: f1 = f1[newaxis,:] if f2 != None: f2 = f2[newaxis,:] if f3 != None: f3 = f3[newaxis,:] bz = zeros(factor * array(f1.shape)).astype(bool) b0 = asarray(bz) b0[hfactor::factor,hfactor::factor] = f1 fr1 = iaframe(zeros((factor,factor),bool)) fr1 = iadil(b0,fr1) if f2 != None: assert f1.shape == f2.shape, 'f1 and f2 must have same shape' b1 = asarray(bz) b1[hfactor::factor,hfactor::factor] = f2 fr2 = iadil(b1,iasedisk(hfactor - 4)) fr1 = iaunion(fr1,fr2) if f3 != None: assert f1.shape == f3.shape, 'f1 and f3 must have same shape' bz[hfactor::factor,hfactor::factor] = f3 fr3 = iadil(bz, iasesum(iaserot(iasecross(1),45),hfactor - 1)) fr1 = iaunion(fr1,fr3) return fr1
def iacloserec(f, bdil=iasecross(), bc=iasecross()): from iasuprec import iasuprec from iadil import iadil return iasuprec( iadil(f,bdil),f,bc)