def num_grid_points(density_file_name):
    """
    This function extracts the number of points in each cartesian direction.
    Parameters
    ----------
    density_file_name : string
        This input is the full path of the .dx file from which to get data.
    Returns
    -------
    num_x : int
        This output is the number of points in the x-directions.

    num_y : int
        This output is the number of pointsg in the y-direction.

    num_z : int
        This output is the number of points in the z-direction.
    """

    file_handle = open(density_file_name, mode='r')
    size_line = file_handle.readlines()[0]
    data = size_line.split()

    num_x = int(data[5])
    num_y = int(data[6])
    num_z = int(data[7])

    return num_x, num_y, num_z