コード例 #1
0
def blackTopHat3D(imIn, imOut, n, se=m3D.CUBOCTAHEDRON1):
    """
    Performs a black Top Hat operation on 'imIn' and puts the result in 'imOut'.
    This operator extracts from 'imIn' the dark objects thinner than 2*'n'+1. 
    
    The structuring element used is defined by 'se' ('CUBOCTAHEDRON1' by default).
    """
    
    imWrk = m3D.image3DMb(imIn)
    m3D.closing3D(imIn, imWrk, n, se=se)
    m3D.sub3D(imWrk, imIn, imOut)
コード例 #2
0
def alternateFilter3D(imIn, imOut, n, openFirst, se=m3D.CUBOCTAHEDRON1):
    """
    Performs an alternate filter operation of size 'n' on 3D image 'imIn'
    and puts the result in 'imOut'. If 'openFirst' is True, the filter
    begins with an opening, a closing otherwise.
    """

    if openFirst:
        m3D.opening3D(imIn, imOut, n, se=se)
        m3D.closing3D(imOut, imOut, n, se=se)
    else:
        m3D.closing3D(imIn, imOut, n, se=se)
        m3D.opening3D(imOut, imOut, n, se=se)
コード例 #3
0
def alternateFilter3D(imIn, imOut,n, openFirst, se=m3D.CUBOCTAHEDRON1):
    """
    Performs an alternate filter operation of size 'n' on 3D image 'imIn'
    and puts the result in 'imOut'. If 'openFirst' is True, the filter
    begins with an opening, a closing otherwise.
    """
    
    if openFirst:
        m3D.opening3D(imIn, imOut, n, se=se)
        m3D.closing3D(imOut, imOut, n, se=se)
    else:
        m3D.closing3D(imIn, imOut, n, se=se)
        m3D.opening3D(imOut, imOut, n, se=se)
コード例 #4
0
def fullAlternateFilter3D(imIn, imOut, n, openFirst, se=m3D.CUBOCTAHEDRON1):
    """
    Performs a full alternate filter operation (successive alternate filters of
    increasing sizes, from 1 to 'n') on 3D image 'imIn' and puts the result 
    in 'imOut'. 'n' controls the filter size. If 'openFirst' is True, the filter
    begins with an opening, a closing otherwise.
    """

    m3D.copy3D(imIn, imOut)
    for i in range(1, n + 1):
        if openFirst:
            m3D.opening3D(imOut, imOut, i, se=se)
            m3D.closing3D(imOut, imOut, i, se=se)
        else:
            m3D.closing3D(imOut, imOut, i, se=se)
            m3D.opening3D(imOut, imOut, i, se=se)
コード例 #5
0
def fullAlternateFilter3D(imIn, imOut, n, openFirst, se=m3D.CUBOCTAHEDRON1):
    """
    Performs a full alternate filter operation (successive alternate filters of
    increasing sizes, from 1 to 'n') on 3D image 'imIn' and puts the result 
    in 'imOut'. 'n' controls the filter size. If 'openFirst' is True, the filter
    begins with an opening, a closing otherwise.
    """
    
    m3D.copy3D(imIn, imOut)
    for i in range(1,n+1):
        if openFirst:
            m3D.opening3D(imOut, imOut, i, se=se)
            m3D.closing3D(imOut, imOut, i, se=se)
        else:
            m3D.closing3D(imOut, imOut, i, se=se)
            m3D.opening3D(imOut, imOut, i, se=se)