'**SUMMARY**
This function takes in a channel of an image or grayscale by default
and then pulls out a series of pixel values as a linescan object
than can be manipulated further.
**PARAMETERS**
* *x* - Take a vertical line scan at the column x.
* *y* - Take a horizontal line scan at the row y.
* *pt1* - Take a line scan between two points on the line the line scan values always go in the +x direction
* *pt2* - Second parameter for a non-vertical or horizontal line scan.
* *channel* - To select a channel. eg: selecting a channel RED,GREEN or BLUE. If set to -1 it operates with gray scale values
**RETURNS**
A SimpleCV.LineScan object or None if the method fails.
**EXAMPLE**
>>>> import matplotlib.pyplot as plt
>>>> img = Image(\'lenna\')
>>>> a = img.getLineScan(x=10)
>>>> b = img.getLineScan(y=10)
>>>> c = img.getLineScan(pt1 = (10,10), pt2 = (500,500) )
>>>> plt.plot(a)
>>>> plt.plot(b)
>>>> plt.plot(c)
>>>> plt.show()'

def getLineScan(self, x=None, y=None, pt1=None, pt2=None, channel=(-1)):

    if (channel == (-1)):
        img = self.getGrayNumpy()
    else:
        try:
            img = self.getNumpy()[:, :, channel]
        except IndexError:
            print 'Channel    missing!'
            return None
    retVal = None
    if ((x is not None) and (y is None) and (pt1 is None) and (pt2 is None)):
        if ((x >= 0) and (x < self.width)):
            retVal = LineScan(img[x, :])
            retVal.image = self
            retVal.pt1 = (x, 0)
            retVal.pt2 = (x, self.height)
            retVal.col = x
            x = (np.ones((1, self.height))[0] * x)
            y = range(0, self.height, 1)
            pts = zip(x, y)
            retVal.pointLoc = pts
        else:
            warnings.warn('ImageClass.getLineScan    -    that    is    not    valid    scanline.')
            return None
    elif ((x is None) and (y is not None) and (pt1 is None) and (pt2 is None)):
        if ((y >= 0) and (y < self.height)):
            retVal = LineScan(img[:, y])
            retVal.image = self
            retVal.pt1 = (0, y)
            retVal.pt2 = (self.width, y)
            retVal.row = y
            y = (np.ones((1, self.width))[0] * y)
            x = range(0, self.width, 1)
            pts = zip(x, y)
            retVal.pointLoc = pts
        else:
            warnings.warn('ImageClass.getLineScan    -    that    is    not    valid    scanline.')
            return None
        pass
    elif ((isinstance(pt1, tuple) or isinstance(pt1, list)) and (isinstance(pt2, tuple) or isinstance(pt2, list)) and (len(pt1) == 2) and (len(pt2) == 2) and (x is None) and (y is None)):
        pts = self.bresenham_line(pt1, pt2)
        retVal = LineScan([img[(p[0], p[1])] for p in pts])
        retVal.pointLoc = pts
        retVal.image = self
        retVal.pt1 = pt1
        retVal.pt2 = pt2
    else:
        warnings.warn('ImageClass.getLineScan    -    that    is    not    valid    scanline.')
        return None
    retVal.channel = channel
    return retVal
