Question on .coef output file

Hello,

Really like the SPHARM-PDM tool, and thanks in advance for your time with this query.

I have the .coef file of coefficients, but it seems that they only contain coefficients for positive and zero m values. For example, for SPHARM degree 15 (which I take to mean it goes up to l=15), I get a (256x3) set of numbers, and for degree 3 I get (16x3). From the answer on the Github page (pasted below), the columns are the (x, y, z) coordinates, and accounting for one row for the m=0 coefficients, and two rows (one real, one imaginary) for the other m values, this matches the total number of rows only if I count m values of 0 and above. Could you please let me know what I have misunderstood here? Many thanks.

On the issues section on Github there is a reply that says the coeffs are ordered like:

GetCoefAt(unsigned int l, unsigned int m, unsigned int coord, double *coef)
{
  if( m == 0 )
  {
    coef[0] = m_Coefs[l * l][coord];
    coef[1] = 0;
  }
  else
  {
    coef[0] = m_Coefs[l * l + 2 * m - 1][coord];
    coef[1] = m_Coefs[l * l + 2 * m][coord];
  }
}

Hi guys, I just wondered if anyone could help with this one please?
Many thanks.

Hi, yes, that correct. Only the positive m are used in our SPHARM implementation. See also

  1. Styner M, Oguz I, Xu S, Brechbühler C, Pantazis D, Levitt JJ, Shenton ME, Gerig G. Framework for the Statistical Shape Analysis of Brain Structures using SPHARM-PDM. Open Science Workshop at MICCAI - Insight Journal. 2006. PMCID: PMC3062073
    Also look at Table 1

So we are only using the positive “m” coeffs with both the real and the imaginary part (i.e. we do not compute the negative “m” coeffs, where m is the order within a given degree).

Martin

Great, thank you very much for your help. And then for reconstruction am I right in thinking I take the real parts of the {x, y, z} series? And that this would come out fully real in the limit of spharm degree -> infinity

Best look at the reconstruction code in the GitHub:


(generate a mesh from a SPHARM object, calls Evaluate)

https://github.com/NIRALUser/SPHARM-PDM/blob/master/Libraries/Shape/Numerics/SphericalHarmonicPolynomial.txx (look at function Evaluate)

Best
Martin