def rasterizeSegment(start_x, start_y, end_x, end_y):
    """Implementation of Bresenham's line rasterization routine. 
    This is a slightly modified version of the Python implementation
    one Rosetta code: https://rosettacode.org/wiki/Bitmap/Bresenham%27s_line_algorithm#Python
    
    Args: 
        start_x: the x-coordinate of the start point of the segment
        start_y: the y-coordinate of the start point of the segment
        end_x: the x-coordinate of the end point of the segment
        end_y: the y-coordinate of the end point of the segment
    Returns: 
        A list [(x, y)] of the image pixel coordinates along the line
    """
    result = []
    dx = abs(end_x - start_x)
    dy = abs(end_y - start_y)
    x, y = start_x, start_y
    sx = -1 if start_x > end_x else 1
    sy = -1 if start_y > end_y else 1
    if dx > dy:
        err = dx / 2.0
        while x != end_x:
            result.append((x, y))
            err -= dy
            if err < 0:
                y += sy
                err += dx
            x += sx
    else: 
        err = dy / 2.0
        while y != end_y:
            result.append((x, y))
            err -= dx
            if err < 0:
                x += sx
                err += dy
            y += sy
    result.append((x, y))
    return result