Beispiel #1
0
    """Generator for posting to DVID."""
    pdb.set_trace()
    for col, row, z, data in nrrd.iterate_data(header, inputnrrd, handle):
        data = np.ascontiguousarray(data)
        data = data.astype(dtype)
        res = method(handle, data, (z, row, col), False, compress)
        print res


with open(args.file, "rb") as inputnrrd:
    header = nrrd.read_header(inputnrrd)
    headerJson = json.dumps(header)

    service = DVIDNodeService(addr, uid)
    kvname = 'headers'
    if service.create_keyvalue(kvname):
        service.put(kvname, args.file, headerJson)
    else:
        service.put(kvname, args.file, headerJson)
        # we should check if the key is there and warn the user to avoid overwriting when not desired

    data = np.ascontiguousarray(nrrd.read_data(header, inputnrrd, args.file))

    reshaper = []

    for dim in data.shape:
        if dim % 32 != 0:
            newmax = (dim / 32 + 1) * 32
        else:
            newmax = dim
        reshaper += [(0, newmax - dim)]