Пример #1
0
def applyPredThresh(pixels):
    # zero removal for quantile computation
    nonzp = pixels[np.any(pixels, 1)]        
    counts = {c:np.bincount(nonzp[:,c], minlength=256) for c in colors}
    qs     = {c : 
              countQuantiles(counts[c], iles) for c in colors}

    # clunky:
    qDict = {"R8D": qs[R][0], "R9D": qs[R][1],
             "G8D": qs[G][0], "G9D": qs[G][1],
             "B8D": qs[B][0], "B9D": qs[B][1]}

    predictedThreshes = \
             dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
    # print ",".join("%5.4f" % t for t in predictedThresholds.values())
    thresholdNDArray(pixels, predictedThreshes, dropSaturated=True)
Пример #2
0
def applyPredThresh(pixels):
    # zero removal for quantile computation
    nonzp = pixels[np.any(pixels, 1)]
    counts = {c: np.bincount(nonzp[:, c], minlength=256) for c in colors}
    qs = {c: countQuantiles(counts[c], iles) for c in colors}

    # clunky:
    qDict = {
        "R8D": qs[R][0],
        "R9D": qs[R][1],
        "G8D": qs[G][0],
        "G9D": qs[G][1],
        "B8D": qs[B][0],
        "B9D": qs[B][1]
    }

    predictedThreshes = \
             dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
    # print ",".join("%5.4f" % t for t in predictedThresholds.values())
    thresholdNDArray(pixels, predictedThreshes, dropSaturated=True)
            {"15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "15m60xendser301.TIF",
             "120m60xac17ser24.TIF",
             "120m60xac17ser27.TIF"}:
            print ".....skipping:"
            continue
        
        currentImage = Image.open(imageDataPath+exampleFilename)
        pixels = fromimage(currentImage).reshape((numImagePoints,3))        
        # zero removal
        if REMOVE_ZEROS:
            pixels = pixels[np.any(pixels, 1)]        
        counts = {c:np.bincount(pixels[:,c], minlength=256) for c in colors}
        qs     = {c : 
                  countQuantiles(counts[c], iles) for c in colors}
        # import pdb; pdb.set_trace()
        
        # clunky:
        qDict = {"R8D": qs[R][0], "R9D": qs[R][1],
                 "G8D": qs[G][0], "G9D": qs[G][1],
                 "B8D": qs[B][0], "B9D": qs[B][1]}

        predictedThresholds = \
                 dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
        print ",".join("%5.4f" % t for t in predictedThresholds.values())
        thresholdNDArray(pixels, predictedThresholds)

        stackArray = np.concatenate((stackArray, pixels))
        
Пример #4
0
             "120m60xac17ser24.TIF",
             "120m60xac17ser27.TIF"}:
            print ".....skipping:"
            continue

        currentImage = Image.open(imageDataPath + exampleFilename)
        pixels = fromimage(currentImage).reshape((numImagePoints, 3))
        # zero removal
        if REMOVE_ZEROS:
            pixels = pixels[np.any(pixels, 1)]
        counts = {c: np.bincount(pixels[:, c], minlength=256) for c in colors}
        qs = {c: countQuantiles(counts[c], iles) for c in colors}
        # import pdb; pdb.set_trace()

        # clunky:
        qDict = {
            "R8D": qs[R][0],
            "R9D": qs[R][1],
            "G8D": qs[G][0],
            "G9D": qs[G][1],
            "B8D": qs[B][0],
            "B9D": qs[B][1]
        }

        predictedThresholds = \
                 dict((c, applyCurrentLM(qDict, c)) for c in colorNames)
        print ",".join("%5.4f" % t for t in predictedThresholds.values())
        thresholdNDArray(pixels, predictedThresholds)

        stackArray = np.concatenate((stackArray, pixels))
            currentImage = Image.open(imageDataPath+exampleFilename)
            pixels = fromimage(currentImage).reshape((numImagePoints,3))        
            if applyPredThresholds:
                # zero removal for quantile computation
                pixels = pixels[np.any(pixels, 1)]        
                counts = {c:np.bincount(pixels[:,c], 
                                        minlength=256) for c in colors}
                qs     = {c:countQuantiles(counts[c], iles) for c in colors}

                # clunky:
                qDict = {"R8D": qs[R][0], "R9D": qs[R][1],
                         "G8D": qs[G][0], "G9D": qs[G][1],
                         "B8D": qs[B][0], "B9D": qs[B][1]}

                predThreshes = dict((c, applyCurrentLM(qDict, 
                                                       c)) for c in colorNames)
                # print ",".join("%5.4f" % t for t in predThresholds.values())
                thresholdNDArray(pixels, predThreshes, dropSaturated=True)

            expArray = np.concatenate((expArray, pixels))
#########################################
# all to here is necessary to get joined series
#########################################

    org = simplifyOrgStain(cnd["Organelle"], cnd["Stain"])
    t = timeToIdx(cnd["Time"])

    print org, t

    # convert image stack to counts and add to histograms
    for c1, c2 in colorPairs: