def supBlackTopHat3D(imIn, imOut, n, grid=m3D.DEFAULT_GRID3D): """ Performs a black Top Hat operation with the infimum of directional openings on 'imIn' and puts the result in 'imOut'. This operator partly extracts from 'imIn' the dark objects whose extension in at least one direction of 'grid' is smaller than 'n'. """ imWrk = m3D.image3DMb(imIn) m3D.infClose3D(imIn, imWrk, n, grid=grid) m3D.sub3D(imWrk, imIn, imOut)
def linearAlternateFilter3D(imIn, imOut, n, openFirst, grid=m3D.DEFAULT_GRID3D): """ Performs an alternate filter operation on 3D image 'imIn' with openings and closings by segments of size 'n' (supremeum of openings and infimum of closings) and puts the result in 'imOut'. If 'openFirst' is True, the filter begins with an opening, a closing otherwise. """ if openFirst: m3D.supOpen3D(imIn, imOut, n, grid=grid) m3D.infClose3D(imOut, imOut, n, grid=grid) else: m3D.infClose3D(imIn, imOut, n, grid=grid) m3D.supOpen3D(imOut, imOut, n, grid=grid)