コード例 #1
0
ファイル: sigset_to_csv.py プロジェクト: wolfram2012/MOSSE
    #                  action="store_true", dest="verbose",
    #                  help="Turn on more verbose output.")
    (options, args) = parser.parse_args()

    if len(args) != 2:
        parser.error(
            "This program requires two arguments: an input sigest and an output csv file."
        )

    return options, args


if __name__ == '__main__':
    options, args = parseOptions()

    sigset = bee.parseSigSet(args[0])

    rows = []
    header = ["sub_id", "rec_id", "filename", "modality", "file_format"]
    rows.append(header)
    for each in sigset:
        sub_id = each[0]
        rec_id = each[1][0]['name']
        filename = each[1][0]['file-name']
        modality = each[1][0]['modality']
        file_format = each[1][0]['file-format']
        row = [sub_id, rec_id, filename, modality, file_format]
        rows.append(row)

    f = csv.writer(open(args[1], 'wb'))
    f.writerows(rows)
コード例 #2
0
ファイル: sigset_to_csv.py プロジェクト: Pictobar/pyvision
    #parser.add_option("-v", "--verbose",
    #                  action="store_true", dest="verbose",
    #                  help="Turn on more verbose output.")
    (options, args) = parser.parse_args()
    
    if len(args) != 2:
        parser.error("This program requires two arguments: an input sigest and an output csv file.")

    return options, args



if __name__ == '__main__':
    options,args = parseOptions()

    sigset = bee.parseSigSet(args[0])
    
    rows = []
    header = ["sub_id","rec_id","filename","modality","file_format"]
    rows.append(header)
    for each in sigset:
        sub_id = each[0]
        rec_id = each[1][0]['name']
        filename = each[1][0]['file-name']
        modality = each[1][0]['modality']
        file_format = each[1][0]['file-format']
        row = [sub_id,rec_id,filename,modality,file_format]
        rows.append(row)

    f = csv.writer(open(args[1],'wb'))
    f.writerows(rows)
コード例 #3
0

def parseOptions():
    usage = "usage: %prog [options] <input.xml> <image_directory> <found.xml> [<missing.xml>]\nReads a sigset and removes any entries that cannot be associated with an image."
    
    parser = optparse.OptionParser(usage)
    #parser.add_option("-v", "--verbose",
    #                  action="store_true", dest="verbose",
    #                  help="Turn on more verbose output.")
    (options, args) = parser.parse_args()
    
    if len(args) not in [3,4]:
        parser.error("This program requires at least three arguments: an input sigest, an image directory, and an output sigset.")

    return options, args



if __name__ == '__main__':
    options,args = parseOptions()

    sigset = bee.parseSigSet(args[0])
    imdir = args[1]
    found,missing = locateFiles(sigset,imdir)
    bee.saveSigset(found, args[2])
    if len(args) >= 4:
        bee.saveSigset(missing, args[3])