<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello<br>
      <br>
      If it can be useful ...<br>
      <br>
      attached is the code (to be place in your matlab path)<br>
      the main fonction to be called within matlab  is
      transform_bvec_to_mrtrix<br>
      <br>
      It uses spm function to select files and to read the nifti header.
      I added all spm function needed <br>
      but if you already have spm8 installed in your matlab file you
      just need to keep transform_bvec_to_mrtrix.m<br>
      tel me if something goes wrong<br>
      <br>
      <br>
      Romain<br>
      <br>
      Le 04/09/2012 12:32, Donald Tournier a Ã©crit :<br>
    </div>
    <blockquote
cite="mid:CAPP9hqShEVS59w0rcmHrCmaS5j2sutgJnkhRjwGVPL7PpYXsjw@mail.gmail.com"
      type="cite">Hi Romain,
      <div><br>
      </div>
      <div>This script sounds like it might be useful for other too. Any
        chance you could share it...? </div>
      <div><br>
      </div>
      <div>Cheers,</div>
      <div><br>
      </div>
      <div>Donald</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
        <div class="gmail_quote">On 4 September 2012 18:44, romain
          valabregue <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:romain.valabregue@upmc.fr" target="_blank">romain.valabregue@upmc.fr</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">
              <div>Dear all<br>
                <br>
                Just a short comment about the first point : Using nifti
                file for DWI data is very convenient especially when one
                use other software to do the dti preprocessing (eddy
                current correction and epi unwarping). Waiting for the
                next mrtrix version (where it may be available ?) I use
                fsl to do the dti preprocessing and I wrote a small
                matlab code that take the 4D nifti DTI volume with bval
                and bvecs and on the gradient table in mrtrix format
                (and I apply the rotation of the nifti file to the bvec)<br>
                <br>
                cheers<br>
                <br>
                Romain<br>
                <br>
                Le 28/08/2012 04:25, Donald Tournier a Ã©crit :<br>
              </div>
              <blockquote type="cite">Hi Chris,
                <div>
                  <div class="h5">
                    <div><br>
                    </div>
                    <br>
                    <div>On a different note: in the process of looking
                      at the data you sent over, I had a quick look
                      through your script. There's a few things I'd like
                      to mention, which I think others might also
                      want/need to hear. Here goes:</div>
                    <div><br>
                    </div>
                    <div><b>Using NIfTI to store the DWI data:</b></div>
                    <div><b><br>
                      </b></div>
                    I notice you're supplying a NIfTI image for the DWI,
                    and a separate gradient encoding file. While there's
                    nothing wrong with that per se, you need to make
                    double-sure that your encoding file is correct <i>for
                      each scan</i>. MRtrix assumes gradients are in the
                    scanner coordinate system (also typically assumed in
                    DICOM data - exception being GE), whereas FSL
                    expects assumes they are in the image axes
                    coordinate system. These two won't match if the
                    images are acquired in a non-axial or oblique plane,
                    and in general won't match between scans even if
                    acquired using the same protocol. This rotation
                    needs to be accounted for when converting between
                    bvecs/bvals and the MRtrix encoding file. I assume
                    you've probably already sorted that out, but thought
                    I'd flag this issue again just in case. 
                    <div> <br>
                    </div>
                    <div>I would strongly recommend that everyone
                      convert their data directly from the raw DICOM
                      images to .mif (or .mih) format, since the
                      gradient information will then be read directly by
                      MRtrix and stored in the appropriate format within
                      the image header - no need to supply the encoding
                      file separately, which gets rid of a potential
                      source of user error. </div>
                    <div><br>
                    </div>
                    <div><b>Use of -normalise option in csdeconv:</b></div>
                    <div><br>
                    </div>
                    <div>I strongly advise <i>against</i> the use of
                      the -normalise option of estimate_response.
                      Although the response function might be
                      normalised, the FODs derived using csdeconv will
                      not be (unless also processed using -normalised,
                      but that introduces other issues with CSF
                      contamination, <a moz-do-not-send="true"
href="http://www.nitrc.org/pipermail/mrtrix-discussion/2012-July/000472.html"
                        target="_blank">as discussed previously in this
                        thread</a>). Using a non-normalised response
                      function and non-normalised csdeconv actually
                      produces relatively well normalised FODs, since
                      the response is then scaled appropriately for the
                      DW signal.</div>
                    <div><br>
                    </div>
                    <div><b>Use of gen_WM_mask:</b></div>
                    <div><br>
                    </div>
                    <div>I also strongly advise against the use of
                      gen_WM_mask. It's a bit of a Heath Robinson hack
                      job, using fairly arbitrary heuristics to kinda
                      identify voxels that ought to correspond to white
                      matter - not really based on sound principles. I
                      included it in the original release as I thought
                      it would provide a good rough mask of WM to seed
                      from, but it's since become clear that it doesn't
                      work all that well, and produces variable results
                      depending on the SNR, b-value, and number of
                      directions. In hindsight, I shouldn't have
                      included in the release, and it won't be available
                      in future major releases.</div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div><b>Creating the mask:</b></div>
                    <div><br>
                      <div>The command you use creates a mask from a
                        single b=0 image. A more robust approach, now
                        recommended in the documentation, is to use the
                        average of all volumes in the DWI run -
                        basically improves the SNR:</div>
                      <div><br>
                      </div>
                      <div>
                        <div>$ average dwi.mif -axis 3 - | threshold - -
                          | median3D - - | median3D - mask.mif</div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div><b>Getting the single-fibre mask:</b></div>
                      <div><br>
                      </div>
                      <div>This is another command that has changed in
                        recent versions. No big deal, but the current
                        recommended command is:</div>
                      <div><br>
                      </div>
                      <div> $ erode mask.mif -npass 3 - | mrmult fa.mif
                        - - | threshold - -abs 0.7 sf.mif</div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>That's all I had to say. Just thought I'd
                        take the opportunity to clarify a few things...</div>
                      <div><br>
                      </div>
                      <div>Cheers,</div>
                      <div><br>
                      </div>
                      <div>Donald</div>
                      <div><br>
                      </div>
                      <div><br>
                        <div><br>
                          <div class="gmail_quote">On 27 August 2012
                            12:18, 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 Chris,
                              <div><br>
                              </div>
                              <div>I can't think of much that could
                                cause this problem, but the most obvious
                                one is supplying an empty single-fibre
                                mask at the estimate_response step.
                                Another reason might have been if any of
                                the single-fibre voxels has one or more
                                zero DW intensities - but I've just
                                looked at the code, and there are
                                safeguards in place to handle negative
                                or zero DW intensities, so I can't see
                                that it could be that either. If none of
                                this helps, maybe you can send me one of
                                the offending data sets so I can have
                                look?</div>
                              <div><br>
                              </div>
                              <div>Cheers,</div>
                              <div><br>
                                Donald.</div>
                              <div>
                                <div>
                                  <div><br>
                                    <br>
                                    <div class="gmail_quote">On 27
                                      August 2012 11:57, Chris Adamson <span
                                        dir="ltr">&lt;<a
                                          moz-do-not-send="true"
                                          href="mailto:chris.adamson@mcri.edu.au"
                                          target="_blank">chris.adamson@mcri.edu.au</a>&gt;</span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">Donald,<br>
                                        <br>
                                        I am getting NaN values in the
                                        response.txt file in rare cases.
                                        How can<br>
                                        I diagnose the problem/fix it?
                                        What should I look for in the
                                        data that<br>
                                        would cause a failure of the
                                        ellipse fitting?<br>
                                        <br>
                                        Chris.<br>
                                        --<br>
                                        Dr Christopher Adamson, PhD
                                        (Melb.), B Software Engineering
                                        (Hons.,<br>
                                        Monash)<br>
                                        Research Officer<br>
                                        Developmental Imaging, Critical
                                        Care and Neurosciences<br>
                                        <br>
                                        Murdoch Childrens Research
                                        Institute<br>
                                        The Royal Children’s Hospital<br>
                                        Flemington Road Parkville
                                        Victoria 3052 Australia<br>
                                        T 9906 6780<br>
                                        M XXXX XXX XXX<br>
                                        E <a moz-do-not-send="true"
                                          href="mailto:chris.adamson@mcri.edu.au"
                                          target="_blank">chris.adamson@mcri.edu.au</a><br>
                                        <a moz-do-not-send="true"
                                          href="http://www.mcri.edu.au"
                                          target="_blank">www.mcri.edu.au</a><br>
                                        <br>
______________________________________________________________________<br>
                                        This email has been scanned by
                                        the Symantec Email
                                        Security.cloud service.<br>
                                        For more information please
                                        visit <a moz-do-not-send="true"
href="http://www.symanteccloud.com" target="_blank">http://www.symanteccloud.com</a><br>
______________________________________________________________________<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>
                                  </div>
                                </div>
                                <span><font color="#888888">-- <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>
                                  </font></span></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>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
Mrtrix-discussion mailing list
<a moz-do-not-send="true" href="mailto:Mrtrix-discussion@www.nitrc.org" target="_blank">Mrtrix-discussion@www.nitrc.org</a>
<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>
</pre>
                  </div>
                </div>
              </blockquote>
              <br>
            </div>
            <br>
            _______________________________________________<br>
            Mrtrix-discussion mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Mrtrix-discussion@www.nitrc.org">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>
        <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>
  </body>
</html>