Ejemplo n.º 1
0
def mosaic3D(imIn, imOut, imWts, grid=m3D.DEFAULT_GRID3D):
    """
    Builds the mosaic 3D image of 'imIn' and puts the results into 'imOut'.
    The watershed line (pixel values set to 255) is stored in the 
    greytone 3D image 'imWts'. A mosaic image is a simple image made of various 
    tiles of uniform grey values. It is built using the watershed of 'imIn' 
    gradient and original markers made of gradient minima which are labelled by
    the maximum value of 'imIn' pixels inside them.
    """

    imWrk1 = m3D.image3DMb(imIn, 1)
    imWrk2 = m3D.image3DMb(imIn)
    m3D.copy3D(imIn, imWrk2)
    im_mark = m3D.image3DMb(imIn, 32)
    se = m3D.structuringElement3D(m3D.getDirections3D(grid), grid)
    m3D.gradient3D(imIn, imOut, se=se)
    m3D.minima3D(imOut, imWrk1, grid=grid)
    m3D.add3D(im_mark, imWrk1, im_mark)
    imWrk1.convert(8)
    m3D.build3D(imWrk1, imWrk2, grid=grid)
    m3D.add3D(im_mark, imWrk2, im_mark)
    m3D.watershedSegment3D(imOut, im_mark, grid=grid)
    m3D.copyBytePlane3D(im_mark, 3, imWts)
    m3D.subConst3D(im_mark, 1, im_mark)
    m3D.copyBytePlane3D(im_mark, 0, imOut)
Ejemplo n.º 2
0
def mosaic3D(imIn, imOut, imWts, grid=m3D.DEFAULT_GRID3D):
    """
    Builds the mosaic 3D image of 'imIn' and puts the results into 'imOut'.
    The watershed line (pixel values set to 255) is stored in the 
    greytone 3D image 'imWts'. A mosaic image is a simple image made of various 
    tiles of uniform grey values. It is built using the watershed of 'imIn' 
    gradient and original markers made of gradient minima which are labelled by
    the maximum value of 'imIn' pixels inside them.
    """
   
    imWrk1 = m3D.image3DMb(imIn, 1)
    imWrk2 = m3D.image3DMb(imIn)
    m3D.copy3D(imIn, imWrk2)
    im_mark = m3D.image3DMb(imIn, 32)
    se = m3D.structuringElement3D(m3D.getDirections3D(grid), grid)
    m3D.gradient3D(imIn, imOut, se=se)
    m3D.minima3D(imOut, imWrk1, grid=grid) 
    m3D.add3D(im_mark, imWrk1, im_mark) 
    imWrk1.convert(8)
    m3D.build3D(imWrk1, imWrk2, grid=grid)
    m3D.add3D(im_mark, imWrk2, im_mark)   
    m3D.watershedSegment3D(imOut, im_mark, grid=grid)
    m3D.copyBytePlane3D(im_mark, 3, imWts)
    m3D.subConst3D(im_mark, 1, im_mark)
    m3D.copyBytePlane3D(im_mark, 0, imOut)
Ejemplo n.º 3
0
def valuedWatershed3D(imIn, imOut, grid=m3D.DEFAULT_GRID3D):
    """
    Returns the valued watershed of greyscale or 32-bit 3D image 'imIn' into greyscale
    3D image 'imOut'. Each pixel of the watershed lines is given its
    corresponding value in initial image 'imIn'.
    """

    im_min = m3D.image3DMb(imIn, 1)
    m3D.minima3D(imIn, im_min, grid=grid)
    markerControlledWatershed3D(imIn, im_min, imOut, grid=grid)
Ejemplo n.º 4
0
def valuedWatershed3D(imIn, imOut, grid=m3D.DEFAULT_GRID3D):
    """
    Returns the valued watershed of greyscale or 32-bit 3D image 'imIn' into greyscale
    3D image 'imOut'. Each pixel of the watershed lines is given its
    corresponding value in initial image 'imIn'.
    """
    
    im_min = m3D.image3DMb(imIn, 1)
    m3D.minima3D(imIn, im_min, grid=grid)
    markerControlledWatershed3D(imIn, im_min, imOut, grid=grid)