<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Donald and Rob,<br>
    <br>
    indeed didn't fix it but at least I have a better idea about how
    MRtrix handles these things. And I found a (ugly) workaround for my
    issue :)<br>
    Thank you!<br>
    <br>
    Best,<br>
    Peter<br>
    <br>
    <div class="moz-cite-prefix">On 10/22/2012 02:47 AM, Donald Tournier
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAPP9hqSr-AzR9FyKO7eg86+XNu8PSW11v1KH8h=apZgz8_812g@mail.gmail.com"
      type="cite">Hi Peter,
      <div><br>
      </div>
      <div>Sorry, just noticed you mention your images are LPS, in which
        case the primary source of mismatch will probably be the data
        layout, as suggested by Rob. The way this was handled for
        overlays in FSL was to convert all of the images using mrconvert
        (from NIfTI straight back to NIfTI), including the image that
        you're tryiing to overlay onto. This will modify the sform/qform
        as I mentioned previously, and convert all your data to RAS (as
        per the NIfTI standard, and MRtrix's internal coordinate
        system). I have no idea whether this will fix all the issues
        (unlikely), but worth a shot...</div>
      <div><br>
      </div>
      <div>Cheers,</div>
      <div><br>
      </div>
      <div>Donald.</div>
      <div><br>
        <br>
        <div class="gmail_quote">On 22 October 2012 11:37, Donald
          Tournier <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Peter,
            <div><br>
            </div>
            <div>Further to Rob's response, the issue really is that in
              MRtrix, the directions are stored be with respect to
              real/scanner coordinates (technically, the RAS equivalent
              of the DICOM patient-centered coordinate system), not the
              image axes as (I assume) they are in FSL. The directions
              probably won't match unless the image transform is
              identity - a straight non-oblique axial scan. To make
              matters worse, as far as I know (someone correct me if I'm
              wrong), FSL's coordinate system is LAS, whereas MRtrix is
              RAS, so even for a straight axial scan the x-axis will
              probably be flipped. </div>
            <div><br>
            </div>
            <div>And then on top of that, there is a good chance that
              the sform/qform of the original NIfTI data corresponds to
              some other orientation (sagittal / coronal), in which case
              Rob's comments about the data layout would also be
              relevant. Note that MRtrix currently writes out NIfTI
              images in a near-axial layout (the data layout will always
              be +0,+1,+2,+3), regardless of the original qform/sform of
              the original images, and will modify the transform (or the
              new qform/sform for NIfTI) accordingly. You will only
              notice a mismatch due to the data layout issue if trying
              to overlay MRtrix-derived images/data onto your original
              NIfTI data (in FSL only, MRtrix should handle this
              appropriately). There was a discussion about the overlay
              in FSL issue a while back on this mailing list. </div>
            <div><br>
            </div>
            <div>Also, just to clarify: with MRtrix it's not possible to
              produce NIfTI images with the volume contiguous in RAM
              (Rob's '-layout +1,+2,+3,+0' suggestion), since this is
              not generally supported by that format (technically that's
              not quite correct, it is possible to specify the data type
              as being a vector, in which case this particular scenario
              could be supported, but since arbitrary strides (layout)
              are not supported under NIfTI, it's not a special case
              that I thought was worth the trouble to implement).</div>
            <div><br>
            </div>
            <div>Essentially, this is the inverse problem to that of
              using bvals/bvecs files with MRtrix: you need to convert
              from scanner coordinates to image coordinates to view the
              directions in FSL...</div>
            <div><br>
            </div>
            <div>Not entirely sure this helps you, but at least you
              should have a clearer understanding of why this is
              happening.</div>
            <div>Cheers,</div>
            <div><br>
            </div>
            <div>Donald.</div>
            <div>
              <div>
                <div class="h5"><br>
                  <br>
                  <div class="gmail_quote">
                    On 21 October 2012 12:22, Robert Smith <span
                      dir="ltr">&lt;<a moz-do-not-send="true"
                        href="mailto:r.smith@brain.org.au"
                        target="_blank">r.smith@brain.org.au</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div>Peter<br clear="all">
                      </div>
                      <div><br>
                      </div>
                      <div>MRtrix is extremely flexible with regards to
                        how the image data are aligned in memory; if you
                        run the mrinfo command on your image and check
                        the 'data layout' field, you'll most likely see
                        that the ordering of the data in memory in those
                        axes is reversed (i.e. has a '-' sign).</div>
                      <div>Unfortunately FSL doesn't always interpret
                        this in the same way as MRtrix does. There is
                        also some ambiguity in the Nifti file format
                        regarding how the image transform should be
                        stored/interpreted.</div>
                      <div>In my experience, when using MRtrix and FSL
                        in conjunction, the safest option is to run the
                        mrconvert command on your image, with the
                        following option: '-layout +0,+1,+2'. This makes
                        the data layout as unambiguous as possible.</div>
                      <div>In your case with a 4D image, I would try
                        '-layout +1,+2,+3,+0'; this makes the 4th
                        dimension (the fibre orientations) contiguous in
                        memory, so reading the image data for a single
                        voxel is as fast as possible.</div>
                      <div><br>
                      </div>
                      <div>Hope this fixes your problem; if not let me
                        know.<br clear="all">
                      </div>
                      <div>Rob</div>
                      <br>
                      --<br>
                      <br>
                      Robert Smith<br>
                      PhD Candidate <br>
                      <div><br>
                        The Florey Institute of Neuroscience and Mental
                        Health<br>
                        Melbourne Brain Centre - Austin Campus<br>
                        245 Burgundy Street<br>
                        Heidelberg Vic 3084<br>
                      </div>
                      Ph: +61 3 9035 7128<br>
                      Fax: +61 3 9035 7301<br>
                      <a moz-do-not-send="true"
                        href="http://www.florey.edu.au" target="_blank">www.florey.edu.au</a>
                      <div>
                        <div><br>
                          <br>
                          <br>
                          <br>
                          <div class="gmail_quote">On Fri, Oct 19, 2012
                            at 9:42 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 class="gmail_quote"
                              style="margin:0 0 0 .8ex;border-left:1px
                              #ccc solid;padding-left:1ex">
                              <div bgcolor="#FFFFFF" text="#000000"> One
                                more problem. If i apply the peak
                                extraction to my image file the output
                                nifti peaks seem to have two inverted
                                dimensions. Do you internally change the
                                image geometry somehow? My image has a
                                left-posterior-superior orientation.<br>
                                <br>
                                Best<span><font color="#888888"><br>
                                    Peter</font></span>
                                <div><br>
                                  <br>
                                  <div>On 10/18/2012 10:22 PM, Luis
                                    Concha wrote:<br>
                                  </div>
                                </div>
                                <div>
                                  <div>
                                    <blockquote type="cite">Once you get
                                      your peaks image, you can use
                                      fslroi to extract each set of
                                      peaks. For example, if you found
                                      tree peaks per voxel, the 4th
                                      dimension of your file should have
                                      9 elements (3 peaks, each with xyz
                                      components). So, to get the first
                                      peak, you would invoke:<br>
                                      <br>
                                      fslroi my_peaks.nii first_peak 0 3<br>
                                      <br>
                                      and to get the second largest
                                      peak:<br>
                                      fslroi my_peaks.nii second_peak 2
                                      3<br>
                                      <br>
                                      and finally the third:<br>
                                      fslroi my_peaks.nii third_peak 6 3<br>
                                      <br>
                                      (I am sure you can substitute
                                      fslroi for mrcat for similar
                                      operations)<br>
                                      <br>
                                      You can visualize them as lines in
                                      fslview.<br>
                                      <br>
                                      Luis<br>
                                      <br>
                                      <br>
                                      <br>
                                      <div class="gmail_quote">On Thu,
                                        Oct 18, 2012 at 3:11 PM, David
                                        Raffelt <span dir="ltr">&lt;<a
                                            moz-do-not-send="true"
                                            href="mailto:d.raffelt@brain.org.au"
                                            target="_blank">d.raffelt@brain.org.au</a>&gt;</span>
                                        wrote:<br>
                                        <blockquote class="gmail_quote"
                                          style="margin:0 0 0
                                          .8ex;border-left:1px #ccc
                                          solid;padding-left:1ex">Hi
                                          Peter, 
                                          <div>I would suggest using
                                            more directions than SH
                                            coefficients in your FOD
                                            image. Check out the
                                            find_SH_peaks help for more
                                            information on how the peaks
                                            are saved. What it does not
                                            mention though is that the
                                            output peaks are ordered by
                                            size (largest first). Sorry
                                            I'm not familiar with the
                                            FSL peak file format,
                                            however I'm sure it would be
                                            fairly trial to code
                                            a conversion tool up. A good
                                            place to start would be
                                            dir2amp, since this code
                                            reads in the directions file
                                            and loops over each peak.</div>
                                          <div>Cheers,</div>
                                          <div>Dave
                                            <div>
                                              <div><br>
                                                <br>
                                                <div class="gmail_quote">On
                                                  19 October 2012 00:43,
                                                  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
                                                    class="gmail_quote"
                                                    style="margin:0 0 0
                                                    .8ex;border-left:1px
                                                    #ccc
                                                    solid;padding-left:1ex">
                                                    <div
                                                      bgcolor="#FFFFFF"
                                                      text="#000000"> Hi
                                                      Dave,<br>
                                                      <br>
                                                      seems to work
                                                      fine. Do you have
                                                      any recommendation
                                                      how many
                                                      directions to
                                                      generate using
                                                      gendir? And can
                                                      you give me the
                                                      exact
                                                      specification of
                                                      the find_SH_peaks
                                                      output image so
                                                      that I can read it
                                                      somehow using my
                                                      own code? Or is
                                                      there a conversion
                                                      to the FSL peak
                                                      file format?<br>
                                                      <br>
                                                      Best,<br>
                                                      Peter
                                                      <div>
                                                        <div><br>
                                                          <br>
                                                          <br>
                                                          <div>On
                                                          10/18/2012
                                                          11:37 AM,
                                                          David Raffelt
                                                          wrote:<br>
                                                          </div>
                                                          <blockquote
                                                          type="cite">Hi
                                                          Peter,
                                                          <div>You can
                                                          use the
                                                          find_SH_peaks
                                                          command. Note
                                                          that you also
                                                          have to supply
                                                          a set of
                                                          directions as
                                                          input, which
                                                          are used as
                                                          seeds for the
                                                          peak finding.
                                                          You can
                                                          generate these
                                                          using the
                                                          gendir
                                                          command.</div>
                                                          <div> <br>
                                                          </div>
                                                          <div>Note that
                                                          dir2amp can be
                                                          used to
                                                          convert these
                                                          directions to
                                                          peak
                                                          amplitudes.</div>
                                                          <div>Cheers,</div>
                                                          <div>Dave</div>
                                                          <div><br>
                                                          </div>
                                                          <div><br>
                                                          </div>
                                                          <div><br>
                                                          <br>
                                                          <div
                                                          class="gmail_quote">On
                                                          18 October
                                                          2012 19:06,
                                                          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
                                                          class="gmail_quote"
                                                          style="margin:0
                                                          0 0
                                                          .8ex;border-left:1px
                                                          #ccc
                                                          solid;padding-left:1ex">Hi
                                                          all, I
                                                          wondered if it
                                                          is possible to
                                                          directly
                                                          output the
                                                          fiber
                                                          directions and
                                                          not only the
                                                          SH
                                                          representation
                                                          of the ODFs.
                                                          If this is not
                                                          possible, can
                                                          anyone tell me
                                                          how the SH
                                                          file looks
                                                          like so that I
                                                          can read it
                                                          and extract
                                                          the peaks
                                                          myself?<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>
                                                          <br
                                                          clear="all">
                                                          <div><br>
                                                          </div>
                                                          -- <br>
                                                          <div><b><font
color="#ff6600">Dr David Raffelt</font></b></div>
                                                          <div><font
                                                          color="#ff6600">Post
                                                          Doctoral
                                                          Fellow</font></div>
                                                          <div><br>
                                                          </div>
                                                          <div>The
                                                          Florey
                                                          Institute of
                                                          Neuroscience
                                                          and Mental
                                                          Health</div>
                                                          <div>Melbourne
                                                          Brain Centre -
                                                          Austin Campus</div>
                                                          <div>245
                                                          Burgundy
                                                          Street</div>
                                                          <div>Heidelberg
                                                          Vic 3084
                                                          <div>Ph: <a
                                                          moz-do-not-send="true"
value="+61390357024">+61 3 9035 7024</a></div>
                                                          </div>
                                                          <div><a
                                                          moz-do-not-send="true"
value="+61390357024">www.florey.edu.au</a></div>
                                                          <br>
                                                          </div>
                                                          </blockquote>
                                                          <br>
                                                        </div>
                                                      </div>
                                                      <span><font
                                                          color="#888888">
                                                          <pre cols="72">-- 
Dipl.-Inform. Peter Neher
German Cancer Research Center
(DKFZ, Deutsches Krebsforschungszentrum in der Helmholtz-Gemeinschaft, Stiftung des ö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 moz-do-not-send="true" href="mailto:p.neher@dkfz-heidelberg.de" target="_blank">p.neher@dkfz-heidelberg.de</a>, Web: <a moz-do-not-send="true" href="http://www.dkfz.de" target="_blank">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>
                                                        </font></span></div>
                                                  </blockquote>
                                                </div>
                                                <br>
                                                <br clear="all">
                                                <div><br>
                                                </div>
                                                -- <br>
                                                <div><b><font
                                                      color="#ff6600">Dr
                                                      David Raffelt</font></b></div>
                                                <div><font
                                                    color="#ff6600">Post
                                                    Doctoral Fellow</font></div>
                                                <div><br>
                                                </div>
                                                <div>The Florey
                                                  Institute of
                                                  Neuroscience and
                                                  Mental Health</div>
                                                <div>Melbourne Brain
                                                  Centre - Austin Campus</div>
                                                <div>245 Burgundy Street</div>
                                                <div>Heidelberg Vic 3084
                                                  <div>Ph: <a
                                                      moz-do-not-send="true"
value="+61390357024">+61 3 9035 7024</a></div>
                                                </div>
                                                <div><a
                                                    moz-do-not-send="true"
                                                    value="+61390357024">www.florey.edu.au</a></div>
                                                <br>
                                              </div>
                                            </div>
                                          </div>
                                          <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>
                                          <br>
                                        </blockquote>
                                      </div>
                                      <br>
                                    </blockquote>
                                    <br>
                                    <pre cols="72">-- 
Dipl.-Inform. Peter Neher
German Cancer Research Center
(DKFZ, Deutsches Krebsforschungszentrum in der Helmholtz-Gemeinschaft, Stiftung des ö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 moz-do-not-send="true" href="mailto:p.neher@dkfz-heidelberg.de" target="_blank">p.neher@dkfz-heidelberg.de</a>, Web: <a moz-do-not-send="true" href="http://www.dkfz.de" target="_blank">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>
                                  </div>
                                </div>
                              </div>
                              <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>
                              <br>
                            </blockquote>
                          </div>
                          <br>
                        </div>
                      </div>
                      <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>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                  -- <br>
                </div>
              </div>
              <font color="#ff6600" size="1"><b>Dr Jacques-Donald
                  Tournier<br>
                </b></font>
              <div><font color="#ff6600" size="1">Research Fellow</font></div>
              <div class="im">
                <div><font size="1"><br>
                  </font></div>
                <div><font size="1">The Florey Institute of Neuroscience
                    and Mental Health</font></div>
                <div><font size="1">Melbourne Brain Centre - Austin
                    Campus</font></div>
                <div><font size="1">245 Burgundy Street</font></div>
                <div><font size="1">Heidelberg  Vic  3084</font></div>
              </div>
              <div><font size="1">Ph:  +61 3 9035 7033</font></div>
              <div><font size="1">Fax:  +61 3 9035 7307</font></div>
              <div><font size="1"><a moz-do-not-send="true"
                    href="http://www.florey.edu.au" target="_blank">www.florey.edu.au</a></font></div>
              <br>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <font color="#ff6600" size="1"><b>Dr Jacques-Donald Tournier<br>
          </b></font>
        <div><font color="#ff6600" size="1">Research Fellow</font></div>
        <div><font size="1"><br>
          </font></div>
        <div><font size="1">The Florey Institute of Neuroscience and
            Mental Health</font></div>
        <div><font size="1">Melbourne Brain Centre - Austin Campus</font></div>
        <div><font size="1">245 Burgundy Street</font></div>
        <div><font size="1">Heidelberg  Vic  3084</font></div>
        <div><font size="1">Ph:  +61 3 9035 7033</font></div>
        <div><font size="1">Fax:  +61 3 9035 7307</font></div>
        <div><font size="1"><a moz-do-not-send="true"
              href="http://www.florey.edu.au" target="_blank">www.florey.edu.au</a></font></div>
        <br>
        <br>
      </div>
    </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 ö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>