'**SUMMARY**
This function easily lets you replace the linescan in the image.
Once you get the LineScan object, you might want to edit it. Perform
some task, apply some filter etc and now you want to put it back where
you took it from. By using this function, it is not necessary to specify
where to put the data. It will automatically replace where you took the
LineScan from.
**PARAMETERS**
* *linescan* - LineScan object
* *x* - put  line scan at the column x.
* *y* - put line scan at the row y.
* *pt1* - put 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.Image
**EXAMPLE**
>>> img = Image(\'lenna\')
>>> a = img.getLineScan(x=10)
>>> for index in range(len(a)):
... a[index] = 0
>>> newimg = img.replaceLineScan(a)
>>> newimg.show()
# This will show you a black line in column 10.'

def replaceLineScan(self, linescan, x=None, y=None, pt1=None, pt2=None, channel=None):

    if ((x is None) and (y is None) and (pt1 is None) and (pt2 is None) and (channel is None)):
        if (linescan.channel == (-1)):
            img = np.copy(self.getGrayNumpy())
        else:
            try:
                img = np.copy(self.getNumpy()[:, :, linescan.channel])
            except IndexError:
                print 'Channel    missing!'
                return None
        if (linescan.row is not None):
            if (len(linescan) == self.width):
                ls = np.clip(linescan, 0, 255)
                img[:, linescan.row] = ls[:]
            else:
                warnings.warn('LineScan    Size    and    Image    size    do    not    match')
                return None
        elif (linescan.col is not None):
            if (len(linescan) == self.height):
                ls = np.clip(linescan, 0, 255)
                img[linescan.col, :] = ls[:]
            else:
                warnings.warn('LineScan    Size    and    Image    size    do    not    match')
                return None
        elif (linescan.pt1 and linescan.pt2):
            pts = self.bresenham_line(linescan.pt1, linescan.pt2)
            if (len(linescan) != len(pts)):
                linescan = linescan.resample(len(pts))
            ls = np.clip(linescan[:], 0, 255)
            idx = 0
            for pt in pts:
                img[(pt[0], pt[1])] = ls[idx]
                idx = (idx + 1)
        if (linescan.channel == (-1)):
            retVal = Image(img)
        else:
            temp = np.copy(self.getNumpy())
            temp[:, :, linescan.channel] = img
            retVal = Image(temp)
    elif (channel is None):
        retVal = self.setLineScan(linescan, x, y, pt1, pt2, linescan.channel)
    else:
        retVal = self.setLineScan(linescan, x, y, pt1, pt2, channel)
    return retVal
