Exemplo n.º 1
0
def main():

    pickledir = sys.argv[1]
    FileNames = libutil.get_file_names(pickledir, filter='.pickle')
    FileNames.sort()

    outdir = './properties'
    libutil.makedir(outdir)

    s1path_out = open(os.path.join(outdir, "sideonepath.txt"), 'w')
    s2path_out = open(os.path.join(outdir, "sidetwopath.txt"), 'w')
    midline_out = open(os.path.join(outdir, "midline.txt"), 'w')
    nosetip_out = open(os.path.join(outdir, "nosetip.txt"), 'w')
    tailtip_out = open(os.path.join(outdir, "tailtip.txt"), 'w')
    intensity_test = open(os.path.join(outdir, "intensitystest.txt"), 'w')
    volume_test = open(os.path.join(outdir, "volumetest.txt"), 'w')
    int_vol_test = open(os.path.join(outdir, "int-vol-test.txt"), 'w')
    is_loop_test = open(os.path.join(outdir, "is_loop.txt"), 'w')

    for file in FileNames:
        NamePrefix = file.strip('.pickle')
        SeqNumber = int(NamePrefix.split('_')[-1])
        try:
            l = cPickle.load(open(file, 'rb'))
            nosetiptxt = "%6i, %4i, %4i \n" % (SeqNumber, l["head"][0],
                                               l["head"][1])
            tailtiptxt = "%6i, %4i, %4i \n" % (SeqNumber, l["tail"][0],
                                               l["tail"][1])
            intensitytxt = "%6i, %s \n" % (SeqNumber, l["intensitytest"])
            volumetxt = "%6i, %s \n" % (SeqNumber, l["volumetest"])
            int_vol_txt = "%6i, %s %s \n" % (SeqNumber, l["intensitytest"],
                                             l["volumetest"])
            is_loop_txt = "%6i, %s \n" % (SeqNumber, l["is_loop"])
            midlinetxt = format_list_of_points(l["midline"], SeqNumber)
            s1pathtxt = format_list_of_points2(l["s1path"], SeqNumber)
            s2pathtxt = format_list_of_points2(l["s2path"], SeqNumber)

        except:
            nosetiptxt = "%6i, -1, -1 \n" % SeqNumber
            tailtiptxt = "%6i, -1, -1 \n" % SeqNumber
            intensitytxt = "%6i, -1 \n" % SeqNumber
            volumetxt = "%6i, -1 \n" % SeqNumber
            int_vol_txt = "%6i -1, -1\n" % SeqNumber
            is_loop_txt = "%6i -1 \n" % SeqNumber
            midlinetxt = "%6i, -1 \n" % SeqNumber
            s1pathtxt = "%6i, -1 \n" % SeqNumber
            s2pathtxt = "%6i, -1 \n" % SeqNumber
            raise

        nosetip_out.write(nosetiptxt)
        tailtip_out.write(tailtiptxt)
        intensity_test.write(intensitytxt)
        volume_test.write(volumetxt)
        int_vol_test.write(int_vol_txt)
        is_loop_test.write(is_loop_txt)
        midline_out.write(midlinetxt)
        s1path_out.write(s1pathtxt)
        s2path_out.write(s2pathtxt)
Exemplo n.º 2
0
def main():

    pickledir=sys.argv[1]
    FileNames = libutil.get_file_names(pickledir,filter='.pickle')
    FileNames.sort()

    outdir = './properties'
    libutil.makedir(outdir)

    s1path_out = open(os.path.join(outdir,"sideonepath.txt"),'w')
    s2path_out = open(os.path.join(outdir,"sidetwopath.txt"),'w')
    midline_out = open(os.path.join(outdir,"midline.txt"),'w')
    nosetip_out = open(os.path.join(outdir,"nosetip.txt"),'w')
    tailtip_out = open(os.path.join(outdir,"tailtip.txt"),'w')
    intensity_test = open(os.path.join(outdir,"intensitystest.txt"),'w')
    volume_test = open(os.path.join(outdir,"volumetest.txt"),'w')
    int_vol_test = open(os.path.join(outdir,"int-vol-test.txt"),'w')   
    is_loop_test = open(os.path.join(outdir,"is_loop.txt"),'w')

    for file in FileNames:
        NamePrefix = file.strip('.pickle')
        SeqNumber = int(NamePrefix.split('_')[-1])
        try:
            l = cPickle.load(open(file,'rb')) 
            nosetiptxt = "%6i, %4i, %4i \n" % (SeqNumber,l["head"][0],l["head"][1]) 
            tailtiptxt = "%6i, %4i, %4i \n" % (SeqNumber,l["tail"][0],l["tail"][1]) 
            intensitytxt = "%6i, %s \n" %(SeqNumber,l["intensitytest"])
            volumetxt = "%6i, %s \n" %(SeqNumber,l["volumetest"])
            int_vol_txt = "%6i, %s %s \n" %(SeqNumber,l["intensitytest"],l["volumetest"])
            is_loop_txt = "%6i, %s \n" % (SeqNumber,l["is_loop"])
            midlinetxt = format_list_of_points(l["midline"],SeqNumber)
            s1pathtxt = format_list_of_points2(l["s1path"],SeqNumber)
            s2pathtxt = format_list_of_points2(l["s2path"],SeqNumber)

        except:
            nosetiptxt   = "%6i, -1, -1 \n" % SeqNumber
            tailtiptxt   = "%6i, -1, -1 \n" % SeqNumber
            intensitytxt = "%6i, -1 \n" % SeqNumber
            volumetxt = "%6i, -1 \n" % SeqNumber
            int_vol_txt = "%6i -1, -1\n" % SeqNumber
            is_loop_txt = "%6i -1 \n" %SeqNumber
            midlinetxt   = "%6i, -1 \n" % SeqNumber
            s1pathtxt    = "%6i, -1 \n" % SeqNumber 
            s2pathtxt    = "%6i, -1 \n" % SeqNumber
            raise

        nosetip_out.write(nosetiptxt)
        tailtip_out.write(tailtiptxt)
        intensity_test.write(intensitytxt)
        volume_test.write(volumetxt)
        int_vol_test.write(int_vol_txt)
        is_loop_test.write(is_loop_txt)
        midline_out.write(midlinetxt)
        s1path_out.write(s1pathtxt)
        s2path_out.write(s2pathtxt)
Exemplo n.º 3
0
def aggregate_output():
    for thresh in ChangeThreshes:
        alloutput = []
        tempoutfiles = libutil.get_file_names(SCRATCHDIR,'.thresh'+str(thresh)+'.pixtemp')
        for file in tempoutfiles:
            lines = open(file,'r').readlines()
            for line in lines:
                words = line.split(',')
                alloutput.append( ( int(words[0]),int(words[1]),int(words[2]) ) )
        alloutput.sort()
        write_output(alloutput,thresh)