import itertools


def getGridElements(grid: tuple) -> list:
    """
    Get elements of a 2-dimensional grid.

    Parameters
    ----------
    grid : tuple (int, int), optional (default=(1, 1))
        Size of the grid (rows, columns). If row/column zero, every pixel
        is one row/column.

    Returns
    -------
    list of tuples (int, int)
        List of grid elements

    """
    if grid is None or grid == (0, 0):
        return [(0, 0)]
    return list(itertools.product(range(grid[0]), range(grid[1])))