<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Ren&eacute;,<br>
    <br>
    thank you for your reply! Unfortunately that did not fix my problem.
    I attached an image of the ODF I get with my method (negative Lobes
    are dark blue). The red lines indicate the peaks extracted from the
    SH coefficient file using "find_SH_peaks". These peaks are correct
    but the ODF is somehow rotated. The ODF should actually represent a
    simple 90&deg; crossing of two fibers corresponding to the two peaks.<br>
    <br>
    Here a code snippet of my SH basis calculation. Maybe someone can
    directly identify the issue:<br>
    <br>
    <small>j=0;<br>
      for (int l=0; l&lt;=ShOrder; l=l+2)<br>
      &nbsp;&nbsp;&nbsp; for (m=-l; m&lt;=l; m++)<br>
      &nbsp;&nbsp;&nbsp;&nbsp; {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // evaluation of legendre polynome<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float mag =
      sqrt((double)(2*l+1)/(4.0*M_PI)*factorial&lt;double&gt;(l-abs(m))/factorial&lt;double&gt;(l+abs(m)))

      * legendre_p&lt;double&gt;(l,abs(m),cos(sphCoords(0)));<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m&lt;0)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_ShBasis(j) = sqrt(2.0)*mag*cos(-m*sphCoords(1));<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (m==0)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_ShBasis(j) = mag;<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_ShBasis(j) = pow(-1.0,
      m)*sqrt(2.0)*mag*sin(m*sphCoords(1));<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j++;<br>
      &nbsp;&nbsp;&nbsp; }</small><br>
    <br>
    I also tried it without the sqrt(2.0) and pow(-1.0, m) terms, but
    that does not change anything. <br>
    <br>
    Best,<br>
    Peter<br>
    <br>
    <div class="moz-cite-prefix">On 01/03/2013 01:01 PM, Ren&eacute; Besseling
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHEtoki2DuVdNE+tKJk2SR+KcfptZ_KTeWBUzT_TLuRVnbuWcQ@mail.gmail.com"
      type="cite">
      <div>Hi Peter,</div>
      <div>&nbsp;</div>
      <div>I ran into this before; it has to do with the MRtrix SH basis
        being orthogonal but not orthonormal, see the following quote
        from an e-mail from Donald.</div>
      <div>&nbsp;</div>
      <div>Best regards and happy new year to you too,</div>
      <div><br>
        Ren&eacute;</div>
      <div><br>
        Quote Donald:</div>
      <div>
        <div>"To answer your question: the matlab code does use an
          orthonormal basis, but MRtrix unfortunately does not. Main
          reason is that I didn't bother checking that the basis was
          orthonormal in the MRtrix code until relatively recently, and
          it's now too late to change it without making all current data
          sets ambiguous (i.e. how do you know whether a data set uses
          the orthonormal basis or not?). I have since changed the
          matlab code though, which is why there is a difference.</div>
        <div><br>
        </div>
        <div>It's pretty easy to convert between them: the m=0 terms are
          not affected, while the m!=0 terms are all scaled by a factor
          of <span class="il">sqrt</span>(<span class="il">2</span>) in
          MRtrix compared with Matlab. Easy to fix, but very annoying I
          have to admit."</div>
        <div><br>
          <br>
        </div>
      </div>
      <div class="gmail_quote">On Thu, Jan 3, 2013 at 12:54 PM, Peter
        Neher <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:p.neher@dkfz-heidelberg.de" target="_blank">p.neher@dkfz-heidelberg.de</a>&gt;</span>
        wrote:<br>
        <blockquote style="margin:0px 0px 0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"
          class="gmail_quote">Hi everyone and happy new year!<br>
          <br>
          I am trying to import the SH coefficient file (output of
          csdeconv) into my own program but the ODFs are not displayed
          correctly. The same method worked fine for the FSL coefficient
          files so I guess you are calculating the SH basis in a
          different way (the file format seems to be the same as the FSL
          file format). MRview renders the ODFs correctly, so I wanted
          to compare may code to the MRview code. Can you tell me the
          location in the source code where I can find your calculation
          and evaluation of the SH basis?<br>
          <br>
          Best,<br>
          Peter<br>
          _______________________________________________<br>
          Mrtrix-discussion mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:Mrtrix-discussion@www.nitrc.org"
            target="_blank">Mrtrix-discussion@www.nitrc.org</a><br>
          <a moz-do-not-send="true"
            href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion"
            target="_blank">http://www.nitrc.org/mailman/listinfo/mrtrix-discussion</a><br>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Dipl.-Inform. Peter Neher
German Cancer Research Center
(DKFZ, Deutsches Krebsforschungszentrum in der Helmholtz-Gemeinschaft, Stiftung des &ouml;ffentlichen Rechts)
Division of Medical and Biological Informatics
Im Neuenheimer Feld 280, D-69120 Heidelberg

Phone: 49-(0)6221-42-3552, Fax: 49-(0)6221-42-2345
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:p.neher@dkfz-heidelberg.de">p.neher@dkfz-heidelberg.de</a>, Web: <a class="moz-txt-link-abbreviated" href="http://www.dkfz.de">www.dkfz.de</a>

The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.</pre>
  </body>
</html>