Show slices as tiled image

    :param data3d: Input data
    :param contour: Data for contouring
    :param seeds: Seed data
    :param axis: Axis for sliceing
    :param slice_step: Show each "slice_step"-th slice, can be float
    :param shape: tuple(vertical_tiles_number, horisontal_tiles_number), set shape of output tiled image. slice_step is
    estimated if it is not set explicitly
    :param first_slice_offset: set offset of first slice
    :param first_slice_offset_to_see_seed_with_label: find offset to see slice with seed with defined label
    :param slice_number: int, Number of showed slices. Overwrites shape and slice_step.

def show_slices(data3d, contour=None, seeds=None, axis=0, slice_step=None,
                shape=None, show=True,
                flipH=False, flipV=False,
                first_slice_offset=0,
                first_slice_offset_to_see_seed_with_label=None,
                slice_number=None
                ):
    """
    Show slices as tiled image

    :param data3d: Input data
    :param contour: Data for contouring
    :param seeds: Seed data
    :param axis: Axis for sliceing
    :param slice_step: Show each "slice_step"-th slice, can be float
    :param shape: tuple(vertical_tiles_number, horisontal_tiles_number), set shape of output tiled image. slice_step is
    estimated if it is not set explicitly
    :param first_slice_offset: set offset of first slice
    :param first_slice_offset_to_see_seed_with_label: find offset to see slice with seed with defined label
    :param slice_number: int, Number of showed slices. Overwrites shape and slice_step.
    """

    if slice_number is not None:
        slice_step = data3d.shape[axis] / slice_number
    # odhad slice_step, neni li zadan
    # slice_step estimation
    # TODO make precise estimation (use np.linspace to indexing?)
    if slice_step is None:
        if shape is None:
            slice_step = 1
        else:
            slice_step = ((data3d.shape[axis] - first_slice_offset ) / float(np.prod(shape)))



    if first_slice_offset_to_see_seed_with_label is not None:
        if seeds is not None:
            inds = np.nonzero(seeds==first_slice_offset_to_see_seed_with_label)
            # print(inds)
            # take first one with defined seed
            # ind = inds[axis][0]
            # take most used index
            ind = np.median(inds[axis])
            first_slice_offset = ind % slice_step


    data3d = _import_data(data3d, axis=axis, slice_step=slice_step, first_slice_offset=first_slice_offset)
    contour = _import_data(contour, axis=axis, slice_step=slice_step, first_slice_offset=first_slice_offset)
    seeds = _import_data(seeds, axis=axis, slice_step=slice_step, first_slice_offset=first_slice_offset)

    number_of_slices = data3d.shape[axis]
    # square image
    #     nn = int(math.ceil(number_of_slices ** 0.5))

    #     sh = [nn, nn]

    # 4:3 image
    meta_shape = shape
    if meta_shape is None:
        na = int(math.ceil(number_of_slices * 16.0 / 9.0) ** 0.5)
        nb = int(math.ceil(float(number_of_slices) / na))
        meta_shape = [nb, na]

    dsh = __get_slice(data3d, 0, axis).shape
    slimsh = [int(dsh[0] * meta_shape[0]), int(dsh[1] * meta_shape[1])]
    slim = np.zeros(slimsh, dtype=data3d.dtype)
    slco = None
    slse = None
    if seeds is not None:
        slse = np.zeros(slimsh, dtype=seeds.dtype)
    if contour is not None:
        slco = np.zeros(slimsh, dtype=contour.dtype)
    #         slse =
    #     f, axarr = plt.subplots(sh[0], sh[1])

    for i in range(0, number_of_slices):
        cont = None
        seeds2d = None
        im2d = __get_slice(data3d, i, axis, flipH=flipH, flipV=flipV)
        if contour is not None:
            cont = __get_slice(contour, i, axis, flipH=flipH, flipV=flipV)
            slco = __put_slice_in_slim(slco, cont, meta_shape, i)
        if seeds is not None:
            seeds2d = __get_slice(seeds, i, axis, flipH=flipH, flipV=flipV)
            slse = __put_slice_in_slim(slse, seeds2d, meta_shape, i)
        #         plt.axis('off')
        #         plt.subplot(sh[0], sh[1], i+1)
        #         plt.subplots_adjust(wspace=0, hspace=0)

        slim = __put_slice_in_slim(slim, im2d, meta_shape, i)
    #         show_slice(im2d, cont, seeds2d)
    show_slice(slim, slco, slse)
    if show:
        plt.show()