Checkerboard mixer.

    Parameters
    ----------
    img_spec1 : str or nibabel image-like object
        MR image (or path to one) to be visualized

    img_spec2 : str or nibabel image-like object
        MR image (or path to one) to be visualized

    patch_size : int or list or (int, int) or None
        size of checker patch (either square or rectangular)
        If None, number of voxels/patch are chosen such that,
            there will be 7 patches through the width/height.

    view_set : iterable
        Integers specifying the dimensions to be visualized.
        Choices: one or more of (0, 1, 2) for a 3D image

    num_slices : int or iterable of size as view_set
        number of slices to be selected for each view
        Must be of the same length as view_set,
            each element specifying the number of slices for each dimension.
            If only one number is given, same number will be chosen for all dimensions.

    num_rows : int
        number of rows (top to bottom) per each of 3 dimensions

    rescale_method : bool or str or list or None
        Range to rescale the intensity values to
        Default: 'global', min and max values computed based on ranges from both images.
        If false or None, no rescaling is done (does not work yet).

    background_threshold : float or str
        A threshold value below which all the background voxels will be set to zero.
        Default : 0.05. Other option is a string specifying a percentile: '5%', '10%'.
        Specify None if you don't want any thresholding.

    annot : str
        Text to display to annotate the visualization

    padding : int
        number of voxels to pad around each panel.

    output_path : str
        path to save the generate collage to.

    figsize : list
        Size of figure in inches to be passed on to plt.figure() e.g. [12, 12] or [20, 20]

    Returns
    -------
    fig : figure handle
        handle to the collage figure generated.

def checkerboard(img_spec1=None,
                 img_spec2=None,
                 patch_size=10,
                 view_set=(0, 1, 2),
                 num_slices=(10,),
                 num_rows=2,
                 rescale_method='global',
                 background_threshold=0.05,
                 annot=None,
                 padding=5,
                 output_path=None,
                 figsize=None, ):
    """
    Checkerboard mixer.

    Parameters
    ----------
    img_spec1 : str or nibabel image-like object
        MR image (or path to one) to be visualized

    img_spec2 : str or nibabel image-like object
        MR image (or path to one) to be visualized

    patch_size : int or list or (int, int) or None
        size of checker patch (either square or rectangular)
        If None, number of voxels/patch are chosen such that,
            there will be 7 patches through the width/height.

    view_set : iterable
        Integers specifying the dimensions to be visualized.
        Choices: one or more of (0, 1, 2) for a 3D image

    num_slices : int or iterable of size as view_set
        number of slices to be selected for each view
        Must be of the same length as view_set,
            each element specifying the number of slices for each dimension.
            If only one number is given, same number will be chosen for all dimensions.

    num_rows : int
        number of rows (top to bottom) per each of 3 dimensions

    rescale_method : bool or str or list or None
        Range to rescale the intensity values to
        Default: 'global', min and max values computed based on ranges from both images.
        If false or None, no rescaling is done (does not work yet).

    background_threshold : float or str
        A threshold value below which all the background voxels will be set to zero.
        Default : 0.05. Other option is a string specifying a percentile: '5%', '10%'.
        Specify None if you don't want any thresholding.

    annot : str
        Text to display to annotate the visualization

    padding : int
        number of voxels to pad around each panel.

    output_path : str
        path to save the generate collage to.

    figsize : list
        Size of figure in inches to be passed on to plt.figure() e.g. [12, 12] or [20, 20]

    Returns
    -------
    fig : figure handle
        handle to the collage figure generated.

    """

    img_one, img_two = _preprocess_images(img_spec1,
                                          img_spec2,
                                          rescale_method=rescale_method,
                                          bkground_thresh=background_threshold,
                                          padding=padding)

    display_params = dict(interpolation='none', aspect='auto', origin='lower',
                          cmap='gray', vmin=0.0, vmax=1.0)

    mixer = partial(_checker_mixer, checker_size=patch_size)
    collage = Collage(view_set=view_set, num_slices=num_slices, num_rows=num_rows,
                      figsize=figsize, display_params=display_params)
    collage.transform_and_attach((img_one, img_two), func=mixer)
    collage.save(output_path=output_path, annot=annot)

    return collage