コード例 #1
0
 def fmt_span(k):
     try:
         return parse_list(k, 2)
     except ValueError as e:
         msg = "Using full span because {}"
         print(msg.format(str(e)))
         return [0]
コード例 #2
0
 def fmt_span(k, size):
     try:
         return parse_list(k, 2)
     except ValueError:
         return [0, size]
コード例 #3
0
    make_path(out_path)

    def fmt_span(k, size):
        try:
            return parse_list(k, 2)
        except ValueError:
            return [0, size]

    # Create a file manager
    mgmt = Boss2np(in_path)

    # Get full shape
    full_shape = mgmt.full_shape
    z_max, y_max, x_max = full_shape
    # Get all the deltas
    z_off, y_off, x_off = parse_list(args['delta'], 3)

    # Get the span across Z
    z_span = np.int64(fmt_span(args['z'], z_max))
    y_span = np.int64(fmt_span(args['y'], y_max))
    x_span = np.int64(fmt_span(args['x'], x_max))
    # Get all the spans
    full_spans = [
        list(np.clip(z_span + z_off, 0, z_max)),
        list(np.clip(y_span + y_off, 0, y_max)),
        list(np.clip(x_span + x_off, 0, x_max)),
    ]

    # Get the input resolution
    resolution = parse_list(args['scale'], 3)
    z_scale = 2**resolution[0]
コード例 #4
0
    # Format input and output paths
    in_path = format_path(args['files'])
    out_path = format_path(args['out'])
    make_path(out_path)

    def fmt_span(k):
        try:
            return parse_list(k, 2)
        except ValueError as e:
            msg = "Using full span because {}"
            print(msg.format(str(e)))
            return [0]

    # Get all the deltas
    z_off, y_off, x_off = parse_list(args['delta'], 3)

    # Get the input spans
    in_spans = [
        list(z_off + np.int64(fmt_span(args['z']))),
        list(y_off + np.int64(fmt_span(args['y']))),
        list(x_off + np.int64(fmt_span(args['x']))),
    ]

    # Create tif generator
    tif_gen = tif2np(in_path, in_spans)
    # Get the shape and data type
    full_shape, input_type = tif_gen.next()

    # Get the full z_span
    full_z0 = in_spans[0][0]