SCI Seg3D Mailing List

Text archives Help


[Seg3D] Re: [Fwd: Re: Re: computing the spline in the Spline Tool]


Chronological Thread 
  • From: Ayla Khan <ayla@sci.utah.edu>
  • To: seg3d@sci.utah.edu
  • Subject: [Seg3D] Re: [Fwd: Re: Re: computing the spline in the Spline Tool]
  • Date: Fri, 11 Dec 2009 14:56:02 -0700

Hi all,

We can implement a new spline algorithm and set up an interface to select the type of spline calculation. It's worth mentioning that Teem implements a set of spline functions that we could use. Unfortunately, I couldn't find any documentation for them. Instead, here are the relevant source files:

src/Externals/teem/src/limn/limn.h
src/Externals/teem/src/limn/splineEval.c
src/Externals/teem/src/limn/test/tspline.c
src/Externals/teem/src/limn/splineMisc.c
src/Externals/teem/src/limn/splineMethods.c

The interface is in limn.h, which includes the settings for the types of spline calculations that are supported.
The spline calculations are in splineEval.c. Utility functions can be found in splineMethods.c and splineMisc.c.

The test program tspline.c has an example of how to use the spline functions.

Ayla

On Dec 10, 2009, at 11:07 AM, Dana Brooks wrote:

somehow managed to reply to the wrong one here, the one that went just to Ram'on instead of to the list.

Dana

-------- Original Message --------
Subject:        Re: [Seg3D] Re: computing the spline in the Spline Tool
Date:   Thu, 10 Dec 2009 13:06:04 -0500
From:   Dana Brooks <brooks@ece.neu.edu>
Reply-To:       brooks@ece.neu.edu
To:     Ramón Casero Cañas <ramon.casero@comlab.ox.ac.uk>
References: <FFA70C60-C40A-4DE1-BEF2-D33B1C55489F@sci.utah.edu> <4B0D8F2F.9020105@comlab.ox.ac.uk > <AFBB7B6B-E80D-4AFA-8B0F-ED923C305D01@sci.utah.edu> <4B20F78D.4040806@comlab.ox.ac.uk > <4B2112F9.7030602@ece.neu.edu> <4B212831.3050805@comlab.ox.ac.uk>



Ramón, hi,

a couple quick points ... the 'cubic' argument invokes pchip, which is a piecewise cubic Hermite interpolant that Mathworks calls "shape- preserving". I have not looked through the detailed mathworks information on this but I know (from teaching a relevant course!) that there is a detailed explanation of how this interpolant works in Cleve Moler's book that is available on-line (http://www.mathworks.com/moler/index_ncm.html ). Basically the free boundary conditions are imposed in a way that prevents the spline extrema from going "outside" where the points lie ....

second, it seems to me looking quickly through the code that interp1 is just an interface to various kinds of interpolants. The spine toolbox has other ways to get to the same things --- so cscvn does the natural spline, and csape gives you a choice of end conditions including both period and not-a-knot ---and now that I check the documentation, it says that cscvn calls csape .... (good software engineering practice, re-using the same code :-) )

I'm not sure what the best way to implement this in our own (SCI) code at this point, but I am sure you and Kristen can figure that out!

Dana

Ramón Casero Cañas wrote:
Dana Brooks wrote:
Ramón, hi,

first, to be clear, using interp1 with the 'cubic' input is not a spline, it's a Hermite interpolation with a particular condition that Mathworks seems to like. I think you know that but just want to be sure it is clear.


Hi Dana,

Thanks for the clarification, although from the documentation, it seems that 'cubic' means using piecewise cubic Hermite polynomials [1], and I think the whole curve is usually called a 'cubic Hermite spline' [2].


second, I believe that you are correct that the end conditions are different. Combing through Matlab help and looking at the interp1 code, it seems that interp1 uses a non-a-knot end condition while cscvn uses the natural (or periodic) end condition. I would guess that it should not be too hard to modify our spline code so that it can handle both types of end conditions, but that's easy for me to say ....

Yes, I think you are right.

Maybe it would be convenient to eventually have a small library with functions that provide the different end conditions, interpolants, etc.?

For the moment, I think we can be very happy with something that works and is consistent with other implementations :) Even if the Spline Tool is implemented with the cscvn() spline, it will be very easy to add an option to the interface to choose between cscvn() and interp1() behaviour.

[1] http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html
[2] http://en.wikipedia.org/wiki/Cubic_Hermite_spline

R.



-----------------------------
Ayla Khan
ayla@sci.utah.edu
(801) 585-0333







Archive powered by MHonArc 2.6.16.

Top of page