AW: [Insight-users] How to measure the smoothness of one curve?

Luis Ibanez luis.ibanez at kitware.com
Wed Jun 16 01:09:20 EDT 2004



Hi Jiang,


1) The concept of the Spectrum of a curve goes
    back to Ptolomey (150 C.E.) when he attempted to
    explain the retrograde movement of the planets
    with the hypotesis that they follow circular
    orbits whose center is, in its turn, following
    another circular movement.

http://www.phys.unt.edu/Astronomy/online_course_files/sample_pages/04_1.html

    The main orbit was called a "Deferent" and the
    traveling orbit was called an "Epicycle". Unfortunately
    this approach couldn't completely account for the
    observer motion of planets like mars.  If was then
    suggested that an additional small epicycle should
    be added to the existing one in order to account
    for the apparent perturbations.

    At the time Greek philosophers believed strongly
    in pure geometrical forms, along with the human
    centered notion of the perfection of celestial
    objects. As a consequence the notion of an elliptical
    motion was out of question as a posibility for
    describing the orbit of a planet. Ellipses were
    introduced by Kepler for describing planetary
    motion in 1609.

    For Ptolomey, of course this didn't took yet the
    form of the Spectrum of a curve, maybe just because
    Fourier was not to be born until 1768     :-)

    However, in theory, the notion of decomposing
    a complex movement into a series of simple circular
    periodical movements is equivalent to the decomposition
    of the parametric coordinates of a curve into a
    Fourier series.

    When you take a curve and parameterize it with
    a parameter "t" (e.g. the curvelength), then you
    can express the coordinates of a point in the curve
    in terms of three funcitons X(t), Y(t) and Z(t).
    In that way, for every "t" you get coordinates
    (x,y,z).  If now you take the three functions and
    expand them in Fourier series you get something like


         X(t) = Sum( Fx(v) * exp( -i * v * t ) )

     where

          exp( i * k ) = cos(k) + i * sin(k)


     The values of Fx(v) are the "Fourier spectrum" of
     the curve X(t).  If the curve is "smooth" that means
     that it lacks rapid variations which are typically
     associated with high frequencies. In other words the
     function Fx(v) will have high values for low values of
     v (the frequency) and it will have low values for high
     values of v ( high frequencies).

     You may want to consult any book on signal processing
     in order to get familiar with spectral analysis.



2)  If your curve is represented as "1" pixels in an image
     it should be straight forward to generate a ChainCode
     path for it. You simply select a starting pixels, and
     from it you visit the immediate neighbors. The direction
     in which you encounter a neighbor at "1", gets entered
     in to the chain. This is a classical representation of
     contours in image processing, you will find details on
     introductory books such as Rozenfeld, or even in Graphics
     Gems.



3)  What you want from the FourierSeriesPath is not the
     results of the Evaluate() function but the internal
     coefficients of the Series.

     In other words, what you want is the Fourier Decomposition
     of the signal, not using the Fourier series as an
     interpolator, which is what the Evaluate() method does.

     Note that for computing the decomposition you could use
     the FFT classes in VNL.


     For evaluating the Bias of the Fourier spectrum you
     can use any measure that differentiates between a high
     content of low frequencies and a low content of low
     frequencies.  You probably want to get more familiar
     with spectral analysis. Here are some links you may
     find useful:

     http://mathworld.wolfram.com/FourierSeries.html

     Here are sites with interactive Java applets

     http://www.jhu.edu/~signals/fourier2/

http://www.digital-school.com/English/Mathematics/Fourier_Series/Fourier_Series.htm


     That will give you a feeling on how the frequency
     content relates to smoothness in the curve.





Regards,




    Luis




---------------
Jiang wrote:

> Hi Luis,
> Thank you very much for your answer. I have checked the documentation
> about FourierSeriesPath and related classes in Doxygen html document,
> and some test codes in InsightToolkit-1.4.0/Testing/Code/Common
> itkFourierSeriesPathTest.cxx
> InsightToolkit-1.4.0/Testing/Code/BasicFilters
> itkChainCodeToFourierSeriesPathFilterTest.cxx
> 
> Now I have some questions. I hope you can help me and give me some
> hints.
> 
> 1. I have no idea about curve's spectrum in the Fourier domain. Could
> you introduce me some literatures about it? Why can it reveal the
> smoothness of the curve?
> 
> 2. I checked the code of itkChainCodeToFourierSeriesPathFilterTest.cxx
> and found that this example gets the FourierSeriesPath by inputting
> vertices to itk::PolyLineParametricPath, then using
> itk::PathToChainCodePathFilter and ChainCodeToFourierSeriesPathFilter to
> convert the chain of vertices to FourierSeriesPath. In my case, the
> curve is presented by one image. This image is binary value image. For
> example, pixel with "1" means that it is one point of the curve. Pixel
> with "0" means that it is not the point of the curve. How can I convert
> this curve to FourierSeriesPath? I think the example of
> itkChainCodeToFourierSeriesPathFilterTest.cxx is not so convenient to my
> case.
> 
> 3. In the example of itkFourierSeriesPathTest.cxx, it computes:"
> Evaluating at 0, 0.5, and 1.0:" path->Evaluate();" Evaluating to an
> index at 0, 0.5, and 1.0:" path->EvaluateToIndex(); and" Evaluating the
> derivative at 0, 0.5, and 1.0:" path->EvaluateDerivative(). I want to
> know which one is used for computing the bias of Fourier Spectrum as you
> said?
> 
> Many thanks to you again!
> 
> 
> Jiang
> -----Ursprüngliche Nachricht-----
> Von: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Gesendet: Mittwoch, 2. Juni 2004 02:34
> An: Jiang
> Cc: ITK
> Betreff: Re: [Insight-users] How to measure the smoothness of one curve?
> 
> 
> Hi Jiang,
> 
> 
> An elegant way of characterizing the smoothness of a
> curve is to analyze its spectrum in the Fourier domain.
> 
> 
> To that end you could use the class:
> 
>     itkFourierSeriesPath
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1FourierSeriesPath.ht
> ml
> 
> 
> and in order to convert your current curve into an
> itkFourierSeriesPath, you can use the class
> ChainCodeToFourierSeriesPathFilter
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1ChainCodeToFourierSe
> riesPathFilter.html
> 
> 
> A smoothed curve will have High values for the Fourier
> coefficients corresponding to low frequencies and Low
> values for the high frequency coefficients.
> 
> 
> You probably want to compute some generic index such
> as the bias of the Fourier spectrum in order to indicate
> whether the curve contains a majority of high frequencies
> or low frequencies.
> 
> 
> This class is designed for working with curves in
> N-Dimensional space.
> 
> 
>     Regards,
> 
> 
> 
>       Luis
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





More information about the Insight-users mailing list