def minima3D(imIn, imOut, h=1, grid=m3D.DEFAULT_GRID3D): """ Computes the minima of 'imIn' using a dual build operation and puts the result in 'imOut'. 'h' can be used to define the minima depth. Grid used by the dual build operation can be specified by 'grid'. Only works with 8-bit or 32-bit as input. 'imOut' must be binary. """ imWrk = m3D.image3DMb(imIn) m3D.addConst3D(imIn, h, imWrk) m3D.dualBuild3D(imIn, imWrk, grid=grid) m3D.sub3D(imWrk, imIn, imWrk) m3D.threshold3D(imWrk, imOut, 1, mamba.computeMaxRange(imIn[0])[1])
def deepMinima3D(imIn, imOut, h, grid=m3D.DEFAULT_GRID3D): """ Computes the minima of the dual reconstruction of image 'imIn' by imIn + h and puts the result in 'imOut'. Grid used by the dual build operation can be specified by 'grid'. Only works with 8-bit or 32-bit images as input. 'imOut' must be binary. """ imWrk = m3D.image3DMb(imIn) if imIn.getDepth() == 8: m3D.addConst3D(imIn, h, imWrk) else: m3D.ceilingAddConst3D(imIn, h, imWrk) m3D.dualBuild3D(imIn, imWrk, grid=grid) minima3D(imWrk, imOut, 1, grid=grid)
def minDynamics3D(imIn, imOut, h, grid=m3D.DEFAULT_GRID3D): """ Extracts the minima of 'imIn' with a dynamics higher or equal to 'h' and puts the result in 'imOut'. Grid used by the dual build operation can be specified by 'grid'. Only works with 8-bit or 32-bit images as input. 'imOut' must be binary. """ imWrk = m3D.image3DMb(imIn) if imIn.getDepth() == 8: m3D.addConst3D(imIn, h, imWrk) m3D.dualBuild3D(imIn, imWrk, grid=grid) m3D.sub3D(imWrk, imIn, imWrk) else: m3D.ceilingAddConst3D(imIn, h, imWrk) m3D.dualBuild3D(imIn, imWrk, grid=grid) m3D.floorSub3D(imWrk, imIn, imWrk) m3D.threshold3D(imWrk, imOut, h, mamba.computeMaxRange(imIn[0])[1])