def plot_images(model, moving, static):
    'Visualize some images after training.\n\n    Parameters\n    ----------\n    model\n        The trained model.\n    moving : tf.Tensor, shape (N, H, W, C)\n        A batch of moving images.\n    static : tf.Tensor, shape (1, H, W, C)\n        The static image.\n    '
    (nb, nh, nw, nc) = moving.shape
    multiples = tf.constant([nb, 1, 1, 1], tf.int32)
    static = tf.tile(static, multiples)
    inputs = tf.concat([moving, static], axis=(- 1))
    deformation = model(inputs, training=False)
    grid = regular_grid([nb, nh, nw])
    grid_new = (grid + deformation)
    grid_new = tf.clip_by_value(grid_new, (- 1), 1)
    moved = grid_sample(moving, grid_new)
    moved = (moved.numpy().squeeze(axis=(- 1)) * 255.0)
    moved = moved.astype(np.uint8)
    moving = (moving.numpy().squeeze(axis=(- 1)) * 255.0)
    moving = moving.astype(np.uint8)
    static = (static.numpy().squeeze(axis=(- 1)) * 255.0)
    static = static.astype(np.uint8)
    fig = plt.figure(figsize=((3 * 1.7), (nb * 1.7)))
    titles_list = ['Static', 'Moved', 'Moving']
    images_list = [static, moved, moving]
    for i in range(nb):
        for j in range(3):
            ax = fig.add_subplot(nb, 3, (((i * 3) + j) + 1))
            if (i == 0):
                ax.set_title(titles_list[j], fontsize=20)
            ax.set_axis_off()
            ax.imshow(images_list[j][i], cmap='gray')
    plt.tight_layout()
    plt.show()
Visualize some images after training.

Parameters
----------
model
    The trained model.
moving : tf.Tensor, shape (N, H, W, C)
    A batch of moving images.
static : tf.Tensor, shape (1, H, W, C)
    The static image.
def plot_images(model, moving, static):
    'Visualize some images after training.\n\n    Parameters\n    ----------\n    model\n        The trained model.\n    moving : tf.Tensor, shape (N, H, W, C)\n        A batch of moving images.\n    static : tf.Tensor, shape (1, H, W, C)\n        The static image.\n    '
    (nb, nh, nw, nc) = moving.shape
    multiples = tf.constant([nb, 1, 1, 1], tf.int32)
    static = tf.tile(static, multiples)
    inputs = tf.concat([moving, static], axis=(- 1))
    deformation = model(inputs, training=False)
    grid = regular_grid([nb, nh, nw])
    grid_new = (grid + deformation)
    grid_new = tf.clip_by_value(grid_new, (- 1), 1)
    moved = grid_sample(moving, grid_new)
    moved = (moved.numpy().squeeze(axis=(- 1)) * 255.0)
    moved = moved.astype(np.uint8)
    moving = (moving.numpy().squeeze(axis=(- 1)) * 255.0)
    moving = moving.astype(np.uint8)
    static = (static.numpy().squeeze(axis=(- 1)) * 255.0)
    static = static.astype(np.uint8)
    fig = plt.figure(figsize=((3 * 1.7), (nb * 1.7)))
    titles_list = ['Static', 'Moved', 'Moving']
    images_list = [static, moved, moving]
    for i in range(nb):
        for j in range(3):
            ax = fig.add_subplot(nb, 3, (((i * 3) + j) + 1))
            if (i == 0):
                ax.set_title(titles_list[j], fontsize=20)
            ax.set_axis_off()
            ax.imshow(images_list[j][i], cmap='gray')
    plt.tight_layout()
    plt.show()