scripts/gen_checkerboard.py
def make_box(n_inlines, n_crosslines, n_depth, box_size):
    """
    Makes a 3D box in checkerboard pattern.

    :param n_inlines: dim x
    :param n_crosslines: dim y
    :param n_depth: dim z
    :return: numpy array
    """
    # inline by crossline by depth
    zero_patch = np.ones((box_size, box_size)) * WHITE
    one_patch = np.ones((box_size, box_size)) * BLACK

    stride = np.hstack((zero_patch, one_patch))

    # come up with a 2D inline image
    nx, ny = stride.shape

    step_col = int(np.ceil(n_crosslines / float(ny)))
    step_row = int(np.ceil(n_inlines / float(nx) / 2))

    # move in the crossline direction
    crossline_band = np.hstack((stride,) * step_col)
    # multiplying by negative one flips the sign
    neg_crossline_band = -1 * crossline_band

    checker_stripe = np.vstack((crossline_band, neg_crossline_band))

    # move down a section
    checker_image = np.vstack((checker_stripe,) * step_row)

    # trim excess
    checker_image = checker_image[0:n_inlines, 0:n_crosslines]

    # now make a box with alternating checkers
    checker_box = np.ones((n_inlines, n_crosslines, box_size * 2))
    checker_box[:, :, 0:box_size] = checker_image[:, :, np.newaxis]
    # now invert the colors
    checker_box[:, :, box_size:] = -1 * checker_image[:, :, np.newaxis]

    # stack boxes depth wise
    step_depth = int(np.ceil(n_depth / float(box_size) / 2))
    final_box = np.concatenate((checker_box,) * step_depth, axis=2)

    # trim excess again
    return final_box[0:n_inlines, 0:n_crosslines, 0:n_depth]

    Makes a 3D box in checkerboard pattern.

    :param n_inlines: dim x
    :param n_crosslines: dim y
    :param n_depth: dim z
    :return: numpy array
    
Makes a 3D box in checkerboard pattern.
Makes a 3D box in checkerboard pattern .
def make_box(n_inlines, n_crosslines, n_depth, box_size):
    zero_patch = np.ones((box_size, box_size)) * WHITE
    one_patch = np.ones((box_size, box_size)) * BLACK
    stride = np.hstack((zero_patch, one_patch))
    nx, ny = stride.shape
    step_col = int(np.ceil(n_crosslines / float(ny)))
    step_row = int(np.ceil(n_inlines / float(nx) / 2))
    crossline_band = np.hstack((stride,) * step_col)
    neg_crossline_band = -1 * crossline_band
    checker_stripe = np.vstack((crossline_band, neg_crossline_band))
    checker_image = np.vstack((checker_stripe,) * step_row)
    checker_image = checker_image[0:n_inlines, 0:n_crosslines]
    checker_box = np.ones((n_inlines, n_crosslines, box_size * 2))
    checker_box[:, :, 0:box_size] = checker_image[:, :, np.newaxis]
    checker_box[:, :, box_size:] = -1 * checker_image[:, :, np.newaxis]
    step_depth = int(np.ceil(n_depth / float(box_size) / 2))
    final_box = np.concatenate((checker_box,) * step_depth, axis=2)
     again
    return final_box[0:n_inlines, 0:n_crosslines, 0:n_depth]
def make_box ( n_inlines , n_crosslines , n_depth , box_size ) : zero_patch = np . ones ( ( box_size , box_size ) ) * WHITE one_patch = np . ones ( ( box_size , box_size ) ) * BLACK stride = np . hstack ( ( zero_patch , one_patch ) ) nx , ny = stride . shape step_col = int ( np . ceil ( n_crosslines / float ( ny ) ) ) step_row = int ( np . ceil ( n_inlines / float ( nx ) / 2 ) ) crossline_band = np . hstack ( ( stride , ) * step_col ) neg_crossline_band = - 1 * crossline_band checker_stripe = np . vstack ( ( crossline_band , neg_crossline_band ) ) checker_image = np . vstack ( ( checker_stripe , ) * step_row ) checker_image = checker_image [ 0 : n_inlines , 0 : n_crosslines ] checker_box = np . ones ( ( n_inlines , n_crosslines , box_size * 2 ) ) checker_box [ : , : , 0 : box_size ] = checker_image [ : , : , np . newaxis ] checker_box [ : , : , box_size : ] = - 1 * checker_image [ : , : , np . newaxis ] step_depth = int ( np . ceil ( n_depth / float ( box_size ) / 2 ) ) final_box = np . concatenate ( ( checker_box , ) * step_depth , axis = 2 ) return final_box [ 0 : n_inlines , 0 : n_crosslines , 0 : n_depth ]
Makes a 3D box in checkerboard pattern.
Makes a 3D box in checkerboard pattern .
"""
    Makes a 3D box in checkerboard pattern.

    :param n_inlines: dim x
    :param n_crosslines: dim y
    :param n_depth: dim z
    :return: numpy array
    """ # inline by crossline by depth # come up with a 2D inline image # move in the crossline direction # multiplying by negative one flips the sign # move down a section # trim excess # now make a box with alternating checkers # now invert the colors # stack boxes depth wise # trim excess again
None
n_inlines
None
n_crosslines
None
n_depth
None
box_size