Ejemplo n.º 1
0
def fetchImage(imgID):
    html = "<B>View Image From Tiff File</B><BR>"
    # Get the stack ID from input ID:
    if imgID in reverseLookUpStacks:
        stackID = reverseLookUpStacks[imgID]
        mD = metaData[stackID]
        html += getInfo(imgID, mD, stackID)
        html += "<BR><BR>"
        html += "<TABLE><TR><TD>Channel</TD><TD>Segment</TD><TD>Score</TD><TD>Image</TD><TD>Look for similarities</TD></TR>"
        # Get score info:
        with open(replacer(pathToScoreFile, stackID, "", "", "")) as fI:
            scoreInfo = pickle.load(fI)
        # Now show each neuron as a row entry:
        for thisChan in scoreInfo:
            for thisLab in scoreInfo[thisChan]:
                html += "<TR><TD>" + chanDict[thisChan] + "</TD><TD>" + str(
                    thisLab
                ) + "</TD><TD>" + '{0:.3f}'.format(
                    scoreInfo[thisChan][thisLab]['singleScore']
                ) + "</TD><TD><IMG src='../getProj?id=" + stackID + "&chan=" + thisChan + "&flip=&lab=" + str(
                    thisLab
                ) + "' height='20%'></TD><TD><a href='../webFindSim?id=" + stackID + "&chan=" + thisChan + "&lab=" + str(
                    thisLab
                ) + "&flip='>Original</a>  <a href='../webFindSim?id=" + stackID + "&chan=" + thisChan + "&lab=" + str(
                    thisLab) + "&flip=F'>Flip</a></TD></TR>"
        html += "</TABLE>"
    else:
        html += "Not found:<BR>" + imgID
    return html
Ejemplo n.º 2
0
def get_image():
    thisID = request.args.get('id')
    thisChan = request.args.get('chan')
    thisLab = request.args.get('lab')
    thisFlip = request.args.get('flip')
    fileOut = replacer(pathToProj, thisID, thisChan, thisFlip, thisLab)
    return send_file(fileOut, mimetype='image/gif')
Ejemplo n.º 3
0
def searchSim():
    thisID = request.args.get('id')
    thisChan = request.args.get('chan')
    thisLab = request.args.get('lab')
    thisFlip = request.args.get('flip')
    thisType = sC.getTypeForID(thisID)
    html = "<B>Searching for similar cells</B><BR>"
    tU = metaData[thisID]
    html += getInfo(thisID, tU, thisID)
    html += "<TABLE><TR><TH>Original/Flip:</TH><TH>Channel:</TH><TH>Label:</TH></TH></TR>"
    html += "<TR><TD>" + flipDict[thisFlip] + "</TD><TD>" + chanDict[
        thisChan] + "</TD><TD>" + thisLab + "</TD></TR></TABLE>"
    if thisType != -1:
        thisOne = {
            STACKTYPE: thisType,
            ID: thisID,
            FLIP: thisFlip,
            CHAN: thisChan,
            LAB: thisLab
        }
        simList = sC.findSimilar(thisOne, 0.25, False)
        if len(simList) > 0:
            simListRef = mU150.findSimilar(thisOne, simList)
            if simListRef[1] != -1:
                html += "<TABLE><TR><TD>Channel</TD><TD>Flipped Or Not</TD><TD>Matching Score</TD><TD>Alignment Score</TD><TD>Image</TD><TD>GMR</TD></TR>"
                for i in range(10):
                    thisInfo = simListRef[0][i]
                    fI = open(
                        replacer(pathToScoreFile, thisInfo[0][0], "", "", ""))
                    scoreInfo = pickle.load(fI)
                    fI.close()
                    html += "<TR><TD>" + chanDict[
                        thisInfo[0][1]] + "</TD><TD>" + flipDict[
                            thisInfo[0][2]] + "</TD><TD>" + str(
                                thisInfo[1]
                            ) + "</TD><TD>" + '{0:.3f}'.format(
                                scoreInfo[thisInfo[0][1]][int(
                                    thisInfo[0][3])]['singleScore']
                            ) + "</TD><TD><IMG src='../getProj?id=" + thisInfo[
                                0][0] + "&chan=" + thisInfo[0][
                                    1] + "&flip=" + thisInfo[0][
                                        2] + "&lab=" + str(
                                            thisInfo[0][3]
                                        ) + "' height='20%'></TD><TD>" + metaData[
                                            thisInfo[0]
                                            [0]]['fileGMRa'] + "</TD></TR>"
                html += "</TABLE>"
            else:
                html += "Search failed due to input data not found in skel150NBlastProc"
        else:
            html += "Search failed due to input data not found in smootheProc"
    else:
        html += "Search failed due to input data not found in smootheProc"
    return html
Ejemplo n.º 4
0
def viewList(mU150,simList,metaData,pathToScoreFile):
    thisType = BRAIN
    html = ""
    if len(simList)>0:
        html+= "<TABLE><TR><TD>Channel</TD><TD>Flipped Or Not</TD><TD>Matching Score</TD><TD>Alignment Score</TD><TD>Image</TD><TD>GMR</TD></TR>"   
        for j in range(300 if 300<len(simList) else len(simList)):
            jKey = simList[j][0]
            thisScore = simList[j][1]+simList[j][0]
            thisInfo = mU150.infoC[thisType][jKey]
            resPath = replacer(pathToScoreFile,thisInfo[0],"","","")
            thisAlScore = ""
            if os.path.isfile(resPath):
                with open(resPath) as fI:
                    scoreInfo = pickle.load(fI)
                    if int(thisInfo[3]) in scoreInfo[thisInfo[2]]:
                        thisAlScore = '{0:.3f}'.format(scoreInfo[thisInfo[2]][int(thisInfo[3])]['singleScore']) 
            html+="<TR><TD>"+chanDict[thisInfo[2]]+"</TD><TD>"+flipDict[thisInfo[1]]+"</TD><TD>"+str(thisScore)+"</TD><TD>"+str(thisAlScore)+"</TD><TD><IMG src='../getProj?id="+thisInfo[0]+"&chan="+thisInfo[2]+"&flip="+thisInfo[1]+"&lab="+str(thisInfo[3])+"' height='20%'></TD><TD>"+metaData[thisInfo[0]]['fileGMRa']+"</TD></TR>"
        html+="</TABLE>"
    return html