def dimensions(img,return_as_dict=False):
    """
    function which returns the dimensions and data_type of a given image

    input::
        img (np.ndarray):
            input image

    return::
        dimensions (tuple): of the form (rows, cols, bands, dtype)
    """
    rows = img.shape[0]
    cols = img.shape[1]
    if img.ndim == 3:
        bands = img.shape[2]
    else:
        bands = 1
    dims = (rows, cols, bands, img.dtype)

    if return_as_dict:
        dims = dict(zip(('rows','cols','bands','dtype'), dims))

    return dims