SCI Seg3D Mailing List

Text archives Help


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


Chronological Thread 
  • From: Dana Brooks <brooks@ece.neu.edu>
  • To: seg3d@sci.utah.edu
  • Subject: [Seg3D] Re: computing the spline in the Spline Tool
  • Date: Thu, 10 Dec 2009 10:25:45 -0500

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.

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

best,

Dana

=====
Dana H. Brooks
Professor, ECE Dept
PI, BioMedical Imaging and Signal Processing Lab
Northeastern University
Boston, MA USA
=====

Ramón Casero Cañas wrote:

This is from a recent offline discussion with Kristen about the best way to remove the dependency to Qt in the currently experimental new Spline Tool.


Currently, I'm using the LGPL library Qwt to compute the spline coefficients and sample the spline. But this library has a dependency to Qt, something we would like to eliminate.

The current Spline Tool computation is done to mimic the results from Matlab's function CSCVN().


There are two possible solutions on the table right now:

1) Write a derivative work of Qwt to remove the dependency to Qt

2) As Kristen has pointed out:

"Another alternative would be to use the spline computation
implemented in src/Dataflow/Modules/Fields/GeneratePlanarElectrode.cc
and src/Dataflow/Modules/Fields/GenerateWireElectrode.cc that is
coded to behave similarly to Matlab's spline computation interp1."


I have checked 2), and it doesn't seem feasible, because the coefficients computed by cscvn and interp1 are different. That is, they compute different splines even if both use the same knot vector. I suppose this have to be because of different end-conditions.

To illustrate this, I have attached a figure comparing the interpolation produced by cscv() to the interpolation of interp1() using cubic and Hermite polynomials.

Also, attached is the Matlab script used to generate it.

Best regards,

Ramon.


------------------------------------------------------------------------




Archive powered by MHonArc 2.6.16.

Top of page