def columns_to_nd(array2reshape, layers, rows, columns):

    """
    Reshapes an array from columns layout to [n layers x rows x columns]
    """

    if layers == 1:
        return array2reshape.reshape(columns, rows).T
    else:
        return array2reshape.T.reshape(layers, rows, columns)