def linearClose3D(imIn, imOut, dir, n, grid=m3D.DEFAULT_GRID3D, edge=mamba.FILLED): """ Performs a closing by a segment of size 'n' in direction 'dir'. If 'edge' is set to 'EMPTY', the operation must be modified to remain extensive. """ imWrk = m3D.image3DMb(imIn) if edge == mamba.EMPTY: m3D.copy3D(imIn, imWrk) m3D.linearDilate3D(imIn, imOut, dir, n, grid=grid) m3D.linearErode3D(imOut, imOut, m3D.transposeDirection3D(dir, grid=grid), n, edge=edge, grid=grid) if edge == mamba.EMPTY: m3D.logic3D(imOut, imWrk, imOut, "sup")
def linearOpen3D(imIn, imOut, dir, n, grid=m3D.DEFAULT_GRID3D, edge=mamba.FILLED): """ Performs an opening by a segment of size 'n' in direction 'dir'. 'edge' is set to 'FILLED' by default. """ m3D.linearErode3D(imIn, imOut, dir, n, edge=edge, grid=grid) m3D.linearDilate3D(imOut, imOut, m3D.transposeDirection3D(dir, grid=grid), n, grid=grid)