Filtering with Savitzky-Golay

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Filtering with Savitzky-Golay

Pedro J CamelloDr Pedro J Camello
Hi all,

I´m trying to determine speed of calcium signals propagations.
Fluorescence increases as a wave from one pole of the cells to another.
I wonder if any of you has made this or similar task. I was thinking of
some kind of filtering. I wanted to use a Savintzky-Golay filter, but I
found no plugin for it.

Any help will be wellcome.
Thanks

--
Dr Pedro J Camello
Dpt Physiology
Faculty of Veterinary Sciences
University of Extremadura
10071 Caceres
Spain
Ph: 927257100 Extension 1321
Fax:927257110
Reply | Threaded
Open this post in threaded view
|

Re: Filtering with Savitzky-Golay

Gabriel Landini
Pedro wrote:

> I wanted to use a Savintzky-Golay filter, but I
> found no plugin for it.

This sounds like an interesting filter.
This page:

http://research.microsoft.com/users/jckrumm/SavGol/SavGol.htm

describes the filter and gives (at the bottom)  the two-dimensional
Savitzky-Golay filters for different patch sizes and polynomial orders.

Would it be just a matter of loading the convolver with those values?
If so, then it may be quite straightforward.

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Filtering with Savitzky-Golay

Gabriel Landini
On Saturday 03 March 2007, I wrote:
> This page:
> http://research.microsoft.com/users/jckrumm/SavGol/SavGol.htm
> describes the filter and gives (at the bottom)  the two-dimensional
> Savitzky-Golay filters for different patch sizes and polynomial orders.

Hi,
Following the example from that page, I loaded the convolution matrices in the
IJ convolver as found in

http://research.microsoft.com/users/jckrumm/SavGol/SavGol.cpp.htm

According to the page, to smooth, one needs to use the C00 filter, and to get
the partial derivatives filter with C10 and C01, and so on. These correspond
to the X0Y0, X1Y0 and X0Y1 in the file above.

The X0Y0 filters do some kind of smoothing, but not knowing what to expect, I
am not sure whether this is the correct way of doing it.

Then I realised something curious: the X0Y0 filters (the ones that I think one
uses for smoothing), are the same for orders 2 and 3, and the same for orders
4 and 5 for a particular kernel size.

I mailed the author enquiring about this, but I haven't heard back yet.

Could anybody with access to MatLab (and the Symbolic Math Toolbook and a bit
of free time) check the output of the script:

http://research.microsoft.com/users/jckrumm/SavGol/SavGolMatLab.m.htm

and see if this is the same as the

http://research.microsoft.com/users/jckrumm/SavGol/SavGol.cpp.htm

Or if I misunderstood the way these filters are applied, I would be grateful
to hear how one should use them.

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Filtering with Savitzky-Golay

Michael Schmid
Hi Gabriel,

cleaning up my e-mails, I just stumbled over your old
message to the ImageJ mailing list:

> Then I realised something curious: the X0Y0 filters (the ones that  
> I think one
> uses for smoothing), are the same for orders 2 and 3, and the same  
> for orders
> 4 and 5 for a particular kernel size.

I think this is ok. If you fit a polynomial of 3rd order into
data points spaced symmetrically around x=0, the third order
term will have an average of zero, thus it will never influence
the 0 order term (i.e., the constant offset).

Same for the 5th order term, if you add 5th order to a 4th order
poynomial.

Anyway, my 5 cents about Savitzky-Golay:

Looking at the Savitzky-Golay smoothing kernels, they have
negative values at the edge. This means that they are not
really the kind of functions one would usually like to have for
smoothing. Also, to get the derivative of a function, the
Savitzky-Golay kernels have positive edge values on the
negative side, and vice versa.
So, to get the derivative, if the standard 3x3 Sobel kernels
produce too much noise, I would do some other type of smoothing.


Michael
________________________________________________________________

On 4 Mar 2007, at 12:57, Gabriel Landini wrote:

> On Saturday 03 March 2007, I wrote:
>> This page:
>> http://research.microsoft.com/users/jckrumm/SavGol/SavGol.htm
>> describes the filter and gives (at the bottom)  the two-dimensional
>> Savitzky-Golay filters for different patch sizes and polynomial  
>> orders.
>
> Hi,
> Following the example from that page, I loaded the convolution  
> matrices in the
> IJ convolver as found in
>
> http://research.microsoft.com/users/jckrumm/SavGol/SavGol.cpp.htm
>
> According to the page, to smooth, one needs to use the C00 filter,  
> and to get
> the partial derivatives filter with C10 and C01, and so on. These  
> correspond
> to the X0Y0, X1Y0 and X0Y1 in the file above.
>
> The X0Y0 filters do some kind of smoothing, but not knowing what to  
> expect, I
> am not sure whether this is the correct way of doing it.
>
> Then I realised something curious: the X0Y0 filters (the ones that  
> I think one
> uses for smoothing), are the same for orders 2 and 3, and the same  
> for orders
> 4 and 5 for a particular kernel size.
Reply | Threaded
Open this post in threaded view
|

Re: Filtering with Savitzky-Golay

Gabriel Landini
On Friday 04 May 2007 14:11:00 Michael Schmid wrote:
> cleaning up my e-mails, I just stumbled over your old
> message to the ImageJ mailing list:

Thanks for the reply!

> > Then I realised something curious: the X0Y0 filters (the ones that
> > I think one
> > uses for smoothing), are the same for orders 2 and 3, and the same
> > for orders
> > 4 and 5 for a particular kernel size.
>
> I think this is ok. If you fit a polynomial of 3rd order into
> data points spaced symmetrically around x=0, the third order
> term will have an average of zero, thus it will never influence
> the 0 order term (i.e., the constant offset).

I see. So I wonder why are they given for the odd sized kernels if they are
not really different than the even ones... (I may be missing something).

> Looking at the Savitzky-Golay smoothing kernels, they have
> negative values at the edge. This means that they are not
> really the kind of functions one would usually like to have for
> smoothing. Also, to get the derivative of a function, the
> Savitzky-Golay kernels have positive edge values on the
> negative side, and vice versa.
> So, to get the derivative, if the standard 3x3 Sobel kernels
> produce too much noise, I would do some other type of smoothing.

Thanks again. If anybody wants to try these, I input the values listed in the
cpp program (from the original webpage) into a Convolve() macro string.
They do smooth the image... but I am not sure in which instances they would be
of particular use.

Cheers,

Gabriel