Skip to content

Commit 7e559a4

Browse files
author
Sameer
committed
Merge branch 'master' of github.com:sameerd/DiffusionTensorImaging
2 parents 3ba4af0 + 9a53855 commit 7e559a4

File tree

3 files changed

+50
-21
lines changed

3 files changed

+50
-21
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.ipynb linguist-documentation

README.md

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,70 @@
11
# Single Shell Free Water Elimination Diffusion Tensor Model
22

3-
This is a Python implementation of a Single Shell Free Water Elimination Model
4-
the follows the papers listed in the references section below. **This software
5-
is written for educational purposes only and is untested. Please do not use it
6-
for anything important without doing your own testing.**
3+
This is a Python implementation of a Free Water Elimination Model for the
4+
analysis of Single Shell Diffusion Tensor MRI Images. We would like to
5+
[separate out the signal decay of extracellular free water from water that is
6+
in the vicinity of cellular
7+
tissue](http://pnl.bwh.harvard.edu/portfolio-item/free-water/). This is an
8+
ill-posed problem because there are infinitely many solutions. So constraints
9+
are imposed via the time evolution of a gradient flow on a Riemannian manifold
10+
to get a unique solution. The resulting optimization problem is solved via
11+
gradient descent. **This software is written for educational purposes only**.
712

8-
There is a separate effort by @mvgolub and @RafaelNH to put in an expanded
9-
single shell model into the [Dipy](http://nipy.org/dipy/index.html)
10-
respository. Please follow along at the [Dipy Issue Tracker
11-
#827](https://github.com/nipy/dipy/issues/827). When the Dipy version is ready,
12-
it is likely to be better tested, more user friendly, efficient and have more
13-
features than the version in this repository.
13+
14+
| ![Free water corrected FA](./fw_fa.png) |
15+
|:---:|
16+
| *Fig 1. Free Water corrected Fractional Anisotropy* |
1417

1518
## Software requirements
1619

20+
This code was developed with the following packages.
21+
1722
* Python 3.6.3
1823
* [Dipy 0.14.0](http://nipy.org/dipy/index.html)
1924

2025
## Getting Started
2126

22-
* `git checkout` this repository
27+
* Download with git. `git checkout https://github.com/sameerd/DiffusionTensorImaging.git`
2328
* Follow one of the two examples
24-
* The [Example.ipynb](notebooks/Example.ipynb) Jupyter Notebook has an overview of how to use this repository
25-
* The [example.py](notebooks/example.py) file has an example of how to use this code in a script or pipeline
26-
* Check for model convergence
29+
* [example.py](example.py) : python script that can be used in a pipeline with local data.
30+
* [Example.ipynb](notebooks/Example.ipynb) : Jupyter Notebook with an interactive overview of how to use this repository with publicly available data
31+
* Check that the first panel (marked `loss` below) converges
2732

28-
![Loss function](./loss_function.png)
33+
| ![Loss function](./loss_function.png) |
34+
|:---:|
35+
| *Fig 2. Loss function panels* |
2936

30-
Currently the code has conveience functions to return the `free water map`, the free water corrected `mean diffusivity`, and the free water corrected `Fractional Anisotropy`.
31-
32-
![Free water corrected FA](./fw_fa.png)
3337

38+
If the model isn't converging, you can try reducing the time step `dt` or
39+
increase the number of iterations. Once you are sure about convergence, you can
40+
use the code's convenience functions to return the `free water map`, the free
41+
water corrected `mean diffusivity`, and the free water corrected `Fractional
42+
Anisotropy` (see Fig 1. above).
3443

3544
## Documentation
3645

3746
* This [README](README.md) file has an overview of how to use this repository.
38-
* The mathematics behind the implementation is written out in the [SingleShellFreewater.pdf](./doc/SingleShellFreeWater.pdf) file.
39-
* The core of the implementation is in the [freewater.py](./pymods/freewater.py) file.
47+
* The [SingleShellFreewater.pdf](./doc/SingleShellFreeWater.pdf) file helps describe what the code is doing in the language of mathematics and ties it to the reference papers.
48+
* The core of the implementation is in the [freewater.py](./pymods/freewater.py) file and the interface class in [freewater\_runner.py](./pymods/freewater_runner.py).
49+
50+
## Caveats
51+
* **This software is untested. Please do your own testing before using it.**
52+
53+
* There is a separate effort by @mvgolub and @RafaelNH to put in an expanded
54+
single shell model into the [Dipy](http://nipy.org/dipy/index.html)
55+
repository. Please follow along at the [Dipy Issue Tracker
56+
#827](https://github.com/nipy/dipy/issues/827). When the Dipy version is ready,
57+
it is likely to be better tested, more user friendly, efficient and have more
58+
features than the version in this repository.
59+
60+
## Memory Usage
61+
62+
On a recent test, a volume of size 100x100x10 with approximately 200 gradient
63+
directions consumed around 3GB of memory and took approximately 30 minutes to
64+
run using a 2GHz AMD opteron 6100 Series processor. A more realistically sized
65+
larger volume will take longer to run and consume more memory. Try to make sure
66+
that there is enough memory to prevent swapping to disk.
67+
4068

4169
## References
4270

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
data = applymask(cropped_volume, mask_boolean )
5151

5252
fw_runner = FreewaterRunner(data, gtab)
53-
fw_runner.LOG = True # turn off logging for this example
53+
fw_runner.LOG = True # turn on logging for this example
5454
fw_runner.run_model(num_iter=100, dt=0.001)
5555

5656
# save the loss function to the working directory

0 commit comments

Comments
 (0)