Ejemplo n.º 1
0
def findColor(color):
    '''This function will search if there are color characters present
    on string and return the color and positions on string'''
    for k, v in colorMap.iteritems():
        x, y = colorStr(v, "_..._").split("_..._")
        fx = color.find(x)
        fy = color.find(y)
        if fx != -1 and fy != -1:
            color = color.replace(x, '').replace(y, '')
            return (k, fx, fy, color)
    return None
Ejemplo n.º 2
0
        (Xdim, Ydim, Zdim, Ndim) = xmipp.getImageSize(fnImg)
        memory = max(memory, Xdim * Ydim * 8)
    memoryMb = int((2 ** ceil(log(memory, 2))) / (2 ** 20)); # Memory size in megabytes
    return memoryMb

#---------------------------------------------------------------------------
# Colors from Xmipp binding
#--------------------------------------------------------------------------- 
from xmipp import XMIPP_MAGENTA, XMIPP_BLUE, XMIPP_GREEN, XMIPP_RED, XMIPP_YELLOW, XMIPP_CYAN, colorStr

colorMap = {'red': XMIPP_RED, 'blue': XMIPP_BLUE,
                'green': XMIPP_GREEN, 'magenta': XMIPP_MAGENTA,
                'yellow': XMIPP_YELLOW, 'cyan': XMIPP_CYAN}


blueStr = lambda s: colorStr(XMIPP_BLUE, s)
greenStr = lambda s: colorStr(XMIPP_GREEN, s)
greenLowStr = lambda s: colorStr(XMIPP_GREEN, s, 0)
failStr = redStr = lambda s: colorStr(XMIPP_RED, s)
headerStr = magentaStr = lambda s: colorStr(XMIPP_MAGENTA, s)
yellowStr = lambda s: colorStr(XMIPP_YELLOW, s)
cyanStr = warnStr = cyanStr = lambda s: colorStr(XMIPP_CYAN, s)


def findColor(color):
    '''This function will search if there are color characters present
    on string and return the color and positions on string'''
    for k, v in colorMap.iteritems():
        x, y = colorStr(v, "_..._").split("_..._")
        fx = color.find(x)
        fy = color.find(y)