ingenuitas/SimpleCV — pull request #331 by jayrambhia (2013-03-26 05:59:20+00:00)
Title: Linescan functionalities added (Addresses Issue #321, #323 #325)

Issues Resolved:

#321, #323, #325

Functionality Added:

Image.replaceLineScan()
LineScan.detrend()
LineScan.medianFilter()

### Image.replaceLineScan():

**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.

**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.

### LineScan.medianFilter()

**SUMMARY**

Apply median filter on the data

**PARAMETERS**

* *kernel_size* - Size of the filter (should be odd int) - int

**RETURNS**

A LineScan object with the median filter applied to the values.

**EXAMPLE**

>>> ls = img.getLineScan(x=10)
>>> mf = ls.medianFilter()
>>> plt.plot(ls)
>>> plt.plot(mf)

### LineScan.detrend()

**SUMMARY**

Detren the data

**RETURNS**

A LineScan object with detrened data.

**EXAMPLE**

>>> ls = img.getLineScan(x=10)
>>> dt = ls.detrend()
>>> plt.plot(ls)
>>> plt.plot(dt)

There's some problem with `BSpline`. Getting only zeros.