def get_dim_of_affine_transform(Ab):
    """Returns the number of dimensions corresponding to an affine transformation  of the
    form y=Ax+b stored in a column vector. For A =[a1,a2,a3], the parameter vector is simply
    [a1;a2;a3;b], i.e., all columns stacked on top of each other.

    :param Ab: parameter vector
    :return: dimensionality of transform (1,2,or 3)
    """
    nr = len(Ab)
    if nr==2:
        return 1
    elif nr==6:
        return 2
    elif nr==12:
        return 3
    else:
        raise ValueError('Only supports dimensions 1, 2, and 3.')