Example #1
0
def loadimg(file):
    """load sis image
    @param file: filename
    @rtype: (wx.Image, wx.Image)
    """
    img1, img2 = readsis.loadimg(file)
    return img1, img2
Example #2
0
def create_reference(sis_to_mean):
    meanpath = settings.referencefile

    for f in sis_to_mean[:]:
        if not f.endswith(".sis"):
            sis_to_mean.remove(f)

    if len(sis_to_mean) > 0:
        tot_K = None
        tot_Na = None

        for file in sis_to_mean:
            K, Na = loadimg(file)
            if tot_K != None:
                tot_K += K
            else:
                tot_K = K
            if tot_Na != None:
                tot_Na += Na
            else:
                tot_Na = Na

        tot_K /= len(sis_to_mean)
        tot_Na /= len(sis_to_mean)

        tot = numpy.concatenate(
            (numpy.ma.filled(tot_K, 0), numpy.ma.filled(tot_Na, 0)))
        tot = (tot + 1) * 6553.6

        write_raw_image(meanpath, tot)
Example #3
0
def load_image(filename):
    root, ext = os.path.splitext(filename)
    if ext.lower() == '.sis':
        print "read sis"
        return readsis.loadimg(filename)
    elif ext.lower() == '.png':
        print "read png"
        return load_image_png(filename)
Example #4
0
def load_image_giacomo(filename):
    root, ext = os.path.splitext(filename)
    if ext.lower() == '.sis':
        print "read sis"
        return readsis.loadimg(filename)
    elif ext.lower() == '.png':
        print "read brasilian png"
        img, img = load_image_png(filename)
        img = -np.log(img)
        return img, img