Skip to content

Commit

Permalink
DOC: Blog-Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
deka27 committed Jul 20, 2024
1 parent d8d1a28 commit 2754c54
Show file tree
Hide file tree
Showing 84 changed files with 1,878 additions and 0 deletions.
Binary file added _static/images/gsoc/2015/rafael/AWF_v1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/Code_ODF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/DSC03995.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/F5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/MK_comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/Picture1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/Picture2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/images/gsoc/2015/rafael/Picture2A.png
Binary file added _static/images/gsoc/2015/rafael/Picture3.png
Binary file added _static/images/gsoc/2015/rafael/Picture4.png
Binary file added _static/images/gsoc/2015/rafael/Picture5.png
Binary file added _static/images/gsoc/2015/rafael/Picture6.png
Binary file added _static/images/gsoc/2015/rafael/Picture7.png
Binary file added _static/images/gsoc/2015/rafael/Picture8.png
Binary file added _static/images/gsoc/2015/rafael/Step1.png
Binary file added _static/images/gsoc/2015/rafael/Step2.png
Binary file added _static/images/gsoc/2015/rafael/Vij_equation.png
Binary file added _static/images/gsoc/2015/rafael/denoise_b0.png
Binary file added _static/images/gsoc/2015/rafael/denoise_b2000.png
Binary file added _static/images/gsoc/2015/rafael/dki_peaks.png
Binary file added _static/images/gsoc/2015/rafael/eigenvalues.png
Binary file added _static/images/gsoc/2015/rafael/gODF_equa.png
Binary file added _static/images/gsoc/2015/rafael/piesno_DKI.png
Binary file added _static/images/gsoc/2015/rafael/piesno_mask.png
Binary file added _static/images/gsoc/2016/bishakh/dipy1.png
Binary file added _static/images/gsoc/2016/bishakh/dipy10.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy11.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy12.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy13.png
Binary file added _static/images/gsoc/2016/bishakh/dipy14.jpg
Binary file added _static/images/gsoc/2016/bishakh/dipy2.png
Binary file added _static/images/gsoc/2016/bishakh/dipy3.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy4.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy5.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy6.png
Binary file added _static/images/gsoc/2016/bishakh/dipy7.png
Binary file added _static/images/gsoc/2016/bishakh/dipy8.jpeg
Binary file added _static/images/gsoc/2016/bishakh/dipy9.jpeg
56 changes: 56 additions & 0 deletions posts/2015/2015_05_17_Rafael.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
First post after acceptance! =)
===============================

.. post:: May 17 2015
:author: Rafael Henriques
:tags: google
:category: gsoc

Personal Note
-------------

Hi all,

I am please to inform that my project proposal was accepted to the Google Summer of Code!

Congrats to everyone that was also accepted!!! This definitely will be an exciting summer!

As I mentioned on my last post, I will be implementing some exiting MRI techniques which allows us to see brain connectivity in vivo - how awesome is that?

The following weeks I will give you more details about this. Keep tuned and you could explore the brain with me!

Greetings from Cambridge (UK),

`Rafael N.H. <https://github.com/RafaelNH>`__
PhD Student at the University of Cambridge


Before the Student Coding Period
--------------------------------

I am currently working on some simulations that will be useful for testing the imaging techniques that I will be implementing.

I start this work before applying to the GSoC (https://github.com/nipy/dipy/pull/582), and in the last weeks I have been improving it. At the moment, simulations are almost complete - codes are running without errors and they are written in PEP8 standards. Now I only have to add some automatic debugging scripts using Nose python testing.

During the following week, I will discuss the work done so far with my mentors (in particular I want to discuss some minor changes on the current scripts) and fix problems that I am facing in creating the automatic debugging scripts.

Minor details to discuss with mentors:

1) Suggestion on changes on the default values of the simulations modules

2) Discuss if is better to remove some unnecessary inputs or have redundant computing steps.

3) Discuss the definition of some important variables that will be used in future steps.

Problems to fix during this week:

1) Resolve problems in recognizing paths where the new version of modules are locally located.

2) Fix error when trying to run Nose:

.. code-block:: zsh
:linenos:
Cannot run $ nosetests test_voxel.py
ERROR: Failure: ImportError (No module named runspeed)
60 changes: 60 additions & 0 deletions posts/2015/2015_05_24_Rafael.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Time to start mapping brain connections and looking to brain properties in vivo
===============================================================================

.. post:: May 24 2015
:author: Rafael Henriques
:tags: google
:category: gsoc

Hi all,

Tomorrow we are starting the coding period :), so it is time for some details about my project and tell you what was done in the community bonding period.

1) How can we study brain connections and brain's tissue properties in vivo? - A simple introduction for non experts

Trajectory of neuronal connections (tractography) and quantification of tissue properties in the living human brain can be obtain from measures of water diffusion using MRI scans. To give you an example how this is done, I will first start by describing one of the simplest technique - the diffusion tensor imaging (DTI).

By combining the information of several diffusion weighted images, DTI models the water diffusion for each image element using a tensor which can be represented by an ellipsoid (see Figure below).

.. figure:: /_static/images/gsoc/2015/rafael/tensor_ellipsoids.png
:alt: tensor_ellipsoids
:width: 400px
:align: center

Figure 1. Diffusion tensors computed from all voxels of a real brain image. This image was produced using Dipy as described in Dipy's website.

From figure 1 we can see that diffusion is larger is some directions. In fact the direction of larger diffusion can be related to the direction of brain's white matter fibers. The axon myelin sheaths restricts the water diffusion and thus diffusion is smaller on the directions perpendicular to fibers. On the other hand, the diffusion parallel to fibers is less restricted and therefore matching the direction of fibers.

Based on this, 3D virtual reconstruction of brain connection can be obtain using specific tracking algorithms - a procedure which is named fiber tracking. An example of this 3D maps obtain from a real brain dataset is shown below.

.. figure:: /_static/images/gsoc/2015/rafael/corpuscallosum_axial.png
:alt: corpuscallosum_axial
:width: 400px
:align: center

Figure 2. Example of corpus callosum fibers. These fibers connect the left and right fiber hemispheres. This image was produced using Dipy as described in Dipy's website.

Nowadays, DTI is still one of the diffusion weighted techniques most used in both clinical applications and in many research studies, however it is not always accurate. DTI cannot account properly for the crossing of different populations of white-matter fiber connections. Moreover, it ignores the non-Gaussian properties of diffusion in biological tissues which can be used to derive interesting and important measures of tissue properties.


1) Project proposal

In this project, I will be implementing an alternative the diffusion-weighted technique named the diffusion kurtosis imaging (DKI) in an open source software project, the Diffusion Imaging in Python (Dipy). DKI overcomes the two major limitations of DTI:
It quantifies the non-Gaussian properties of water diffusion in biological tissues by modelling the kurtosis tensor (KT) which can be used to derive important tissue measures as the density of axonal fibers.
Relative to the diffusion tensor, KT is also shown to offer a better characterization of the spatial arrangement of tissue microstructure and can be used as a basis for more robust tractography. Particularly, DKI based tractography is sensitive to resolve crossing fibers.

3) What is done so far

As an update of what I posted previously (see Post #2), I finished the work on DKI's simulations - procedures that will be useful for testing the codes that I will be implementing during this summer. In particular, as my mentor suggested, I added some automatic debugging scripts using Nose python testing. These scripts are now insuring that the kurtosis tensor is symmetry (as expected) and that simulations are able to currently produce the diffusion tensor and kurtosis tensor in both cases of well aligned and crossing fibers.

Many thanks to my mentor for teaching me how to work with nose python testing. In particular, the useful tip running the nose tests and knowing which lines the testing scripts are covering by using the following command:

.. code-block:: zsh
:linenos:
nosetests -v dipy/sims/tests/test_voxel.py --with-coverage --cover-package=dipy
4) Next steps

After merging the DKI simulations to Dipy's master brunch, I will start working on the DKI reconstruction modules, based on some preliminary preparation work previously submitted by other dipy contributors. At the end of the week, I intend to finish the first part of the DKI reconstruction modules - the KT estimation from diffusion-weighted signals. For this I will implement the standard ordinary linear least-squares (OLS) solution of DKI.
98 changes: 98 additions & 0 deletions posts/2015/2015_06_05_Rafael.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
First report (1st week of coding, challenges and ISMRM conference)
==================================================================

.. post:: June 05 2015
:author: Rafael Henriques
:tags: google
:category: gsoc

The coding period started in a challenging way.

As I mentioned on my previous post, I started the coding period by merging the work done during the community bonding period to the main Dipy master repositories. This was not as trivial as expected since some latest updates on the Dipy master repositories was causing conflicts with my codes.

Rebasing
--------

To solve this conflicts, I used git rebase (I want to thank my mentor Dr Ariel Rokem for his useful tips on how to do this). For more details on rebasing you can find a nice tutorial here. To summarize, below you can find the essential steps to rebase a branch:

1) make sure that the master branch of your computer have the latest changes, for this:

.. code-block:: zsh
:linenos:
git checkout master
git pull upstream master
2) start rebasing by moving the work done on your branch to the updated version of the master:

.. code-block:: zsh
:linenos:
git checkout your_branch
git rebase master
3) If there is a conflict, automatic rebasing stops so you can manually update the files. The parts of the script with conflict will be pointed as the lines between markers >>>> and ====.

4) After manually resolving a conflict, you can add the corrected files and continue rebasing using:

.. code-block:: zsh
:linenos:
git add file
git rebase --continue
5) When rebasing is accomplished, you can update the changes to your fork by typing:

.. code-block:: zsh
:linenos:
git push -f origin your_branch
After rebasing Problem #1
^^^^^^^^^^^^^^^^^^^^^^^^^

After rebasing, I noticed some problem on Dipy's master compilation. Fortunately, with the help of all the amazing Dipy team, this problem was quickly addressed (for more information see here).

After rebasing Problem #2 - the right order to reconstruct the diffusion tensor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is a good example why testing modules are so important.

After solving problem #1, one of my testing modules was failing since the simulated diffusion tensors were given unexpected results (to know what is a diffusion tensor read my previous post).

Basically on my simulations, the diffusion tensors are reconstructed from eigenvalues and eigenvectors decomposition. After some hours of debugging, I realized the cause of the logic error. The eigenvalues given by an updated master's function was transpose relatively to its previous version. So, for the ones also working with second order tensors, make sure that when reconstructing the tensor from its eigenvalues and eigenvectors decomposition you use the matrix multiplication in the following order:

.. code-block:: zsh
:linenos:
import numpy as np
from numpy import dot
::

Tensor = dot(dot(R.T, np.diag(mevals)), R)

where
::

R = [eigenvector1, eigenvector2, eigenvector3]

and
::

mevals = [eigenvalue1, eigenvalue2, eigenvalue3]

ISMRM Conference
----------------

As I mentioned on my proposal, this week I also attended the 23rd annual meeting of the International Society of Magnetic Resonance in Medicine (ISMRM). The conference was very productive. In particular, I had some nice discussions with the top experts on diffusion kurtosis imaging (DKI) and their feedback will be taken into account so that my work during the summer of code is done according to the most recent state of art of the field.

It was also great to personally meet the Dipy developers and promoting the open source software. I had very nice feedback from different research groups and there were many new researchers interested in using Dipy and/or willing to collaborated with its development. Soon I will post some photos of the conference =).

Next steps
----------

My mentor suggested a small change on the example codes for the DKI simulation usage. I am currently finalizing this, so soon I will be posting the final version of the DKI simulations.

In the following days, I will also create a pull request with the work started on DKI reconstructions modules. As mentioned on my proposal, the implementation of these modules are the objective for my midterm evaluation.
118 changes: 118 additions & 0 deletions posts/2015/2015_06_19_Rafael.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
Progress Report (DKI simulations merged and DKI real data fitted)
=================================================================

.. post:: June 19 2015
:author: Rafael Henriques
:tags: google
:category: gsoc

I have done great progresses on the 2 last weeks of coding!!! In particular, two major achievements were accomplished:

- By solving the couple of problems mentioned on my previous post, the DKI simulations were finally merged to the Dipy's master repository.
- The first part of the reconstruction modules to process DKI in real brain data was finalized.

The details of these two achievements and the project's next step are posted on the below sections.

1) DKI simulations on Dipy's master repository
----------------------------------------------

Just to give an idea of the work done, I am posting an example of how to use the DKI simulations that I developed. More details on the mathematical basis of these simulations can be found `here <https://pubmed.ncbi.nlm.nih.gov/25676915/>`__.

1.1) Import python modules and defining MRI parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
First of all, we have to import relevant modules (see code lines below). The main DKI simulations function multi_tensor_dki can be imported from the Dipy simulations' sub-module dipy.sims.voxel (line 19 shown below).

.. image:: /_static/images/gsoc/2015/rafael/Picture1.png
:align: center

.. raw:: html

<br>

To perform the simulations, some parameters of the MRI acquisition have to be considered. For instance, the intensity of the MRI's diffusion-weighted signal depends on the diffusion-weighting used on the MRI scanner (measured as the b-value) and the directions that the diffusion measurement are done (measured as the b-vectores). This information, for example, can be obtain from Dipy's real dataset samples.

.. image:: /_static/images/gsoc/2015/rafael/Picture2.png
:align: center

.. raw:: html

<br>

Dipy's dataset 'small_64D' was acquired with only one diffusion-weighting intensity. Since DKI requires data from more than one non zero b-value, a second b-values is artificially added.

.. image:: /_static/images/gsoc/2015/rafael/Picture3.png
:align: center

.. raw:: html

<br>

To convert the artificial produced b-values and b-vectors to the format assumed by Dipy's functions, the function gradient_table has to be called.

.. image:: /_static/images/gsoc/2015/rafael/Picture4.png
:align: center

1.2) Defining biological parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Having all the scanner parameters set, the biophysical parameters of the simulates have to be defined.

Simulations are based on multi-compartmental models, which allow us to take into account brain's white matter heterogeneity. For example, to simulate two crossing fibers with two different media (representing intra and extra-cellular media), a total of four heterogeneous components are taken into account. The diffusion parameters of each compartment are defined below (the first two compartments correspond to the intra and extra cellular media for the first fiber population while the others correspond to the media of the second fiber population).

.. image:: /_static/images/gsoc/2015/rafael/Picture5.png
:align: center

.. raw:: html

<br>

The orientation of each fiber is saved in polar coordinates. To simulate crossing fibers at 70 degrees
the compartments of the first fiber are aligned to the x-axis while the compartments of the second fiber are aligned to the x-z plane with an angular deviation of 70 degrees from the first one.

.. image:: /_static/images/gsoc/2015/rafael/Picture6.png
:align: center

.. raw:: html

<br>

Finally, the volume fractions of the compartment are defined.

.. image:: /_static/images/gsoc/2015/rafael/Picture7.png
:align: center

1.3) Using DKI simulation main function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Having defined the parameters for all tissue compartments, the elements of the diffusion tensor (dt), the elements of the kurtosis tensor (kt) and the DW signals simulated from the DKI model (signal_dki) can be obtained using the function multi_tensor_dki.

.. image:: /_static/images/gsoc/2015/rafael/Picture8.png
:align: center

.. raw:: html

<br>

As I mentioned in my previous post, these simulations are useful for testing the performance of DKI reconstruction codes that I am currently working on. In particular, when we apply the reconstruction modules to the signal_dki, the estimated diffusion and kurtosis tensors have to match the ground truth kt and dt produced here.

2) Progresses on the development of the DKI reconstruction module
-----------------------------------------------------------------

Finalizing DKI reconstruction module is the milestone that I proposed to achieved before the mid-term evaluation. Basically, the work done on this is on schedule!

Since DKI is an extension of DTI, classes of the DKI modules were defined from inheritance of the classes defined on Dipy's DTI module (a nice post can be found `here <http://www.jesshamrick.com/2011/05/18/an-introduction-to-classes-and-inheritance-in-python/>`__ for more details on class inheritance). Having established this inheritance, DKI modules are compatible to all standard diffusion statistical measures previously defined in Dipy.

I carried on with the development of the DKI module by implementing the estimation of the diffusion and kurtosis tensors from the DKI model. Two strategies were implemented - the DKI's ordinary linear least square (OLS) solution, which corresponds to a simple but less computational demanding approach, and the weighted DKI's linear least square (WLS) solution, which is considered to be one of the most robust estimation approaches in the `recent DKI literature <https://www.sciencedirect.com/science/article/abs/pii/S1053811913005223>`__.

Currently, I am validating DKI implementation using the nose testing modules. Both implementations of the OLS and WLS solutions seem to produce the ground truth diffusion and kurtosis tensors when applied on the diffusion signal simulated from my DKI simulation modules. In addition, DKI modules are also producing the expected standard diffusion parameter images when applied to real data (see Figure 1).

.. figure:: /_static/images/gsoc/2015/rafael/Diffusion_tensor_measures_from_DTI_and_DKI.png
:alt: Diffusion_tensor_measures_from_DTI_and_DKI
:align: center

Figure 1. Comparison between real brain parameter maps of the diffusion fractional anisotropy (FA), mean diffusivity (MD), axial diffusivity (AD), and radial diffusivity (RD) obtain from the DKI modules (upper panels) and the DTI module (lower panels).

From the figure, we can see that the DT standard diffusion measures from DKI are noisier than the DTI measurements. `This is a well known pitfall of DKI <http://repositorio.ul.pt/bitstream/10451/8511/1/ulfc104137_tm_Rafael_Henriques.pdf>`__. Since it involves the fit of a larger number of parameters, DKI is more sensitive to noise than DTI. Nevertheless, diffusion measures from DKI were shown to have a `better precision <https://pubmed.ncbi.nlm.nih.gov/20878760/>`__ (i.e. less sensitive to bias). Moreover, as I have been mentioning on my previous posts, DKI allows the estimation of the standard kurtosis measures.

3) Next Steps
-------------

Before the mid-term evaluation, a first version of the DKI reconstruction will be completed with the implementation of the standard kurtosis measures, as the mean, axial and radial kurtosis from the already estimated kurtosis tensors. Details of the usage of the DKI reconstruction modules and the meaning of the standard kurtosis measures will be summarized on my next post.
Loading

0 comments on commit 2754c54

Please sign in to comment.