Skip to main content

Implementation of "Reducing variability in along-tract analysis with diffusion profile realignment".

Project description

Diffusion profile realignment (dpr)

An example and assorted implementation from the manuscript Reducing variability in along-tract analysis with diffusion profile realignment. Have a look at the example on how to use the package and run it on a small example dataset.

A quick example from the command line

There is also a command line version for easy usage, here in an example for the AFD metric on the left arcuate fasciculus. The text file is already ordered in increasing order for each subject, which have the same distance between every point and are already zero padded accordingly.

We also supply the --exploredti option to remove the header column, --do_graph to save a png file with the results.

We finally resample everything to 75 points with --points 75.

The -f option overwrites the output files and the -v option prints useful informative messages throughout (and are optional).

dpr datasets/af_left_AFD.txt datasets/af_left_AFD_realigned.txt --exploredti --do_graph -f -v --points 75

The output datasets/af_left_AFD_realigned.txt is a text file where each line is a subject and each column is a different point of the along tract analysis.

We also get a png file datasets/af_left_AFD_realigned.png with the before/after realignment process.

Note how the zero padding present in the original data is decreasing the metrics as less and less subjects are present. The realigned metric is instead using padding with Nans, remember to consider/keep track of it in subsequent analysis as needed.

Visualizing the results

We can also draw the p-values (computed separately) over the bundle using the script dpr_make_fancy_graph. This requires the original coordinates, the truncated version between rois and the coordinates to the representative streamline.

dpr_make_fancy_graph datasets/af_left_pval_unaligned.txt datasets/af_left_coordinates.txt datasets/af_left_truncated_coordinates.txt datasets/af_left_average_coordinates.txt 0,2 pvals_unaligned.png --title 'p-values before realignment' -f
dpr_make_fancy_graph datasets/af_left_pval_realigned.txt datasets/af_left_coordinates.txt datasets/af_left_truncated_coordinates.txt datasets/af_left_average_coordinates.txt 0,2 pvals_realigned.png -f

And this is the results

Using docker (instead of installing everything)

Well, you will still need to install docker first, see https://runnable.com/docker/getting-started/. After that, from the folder containing the Dockerfile, build the container before running it

docker build -t dpr:v0.1.2 .

The two diffusion profile realignment scripts can now be run using

docker run dpr:v0.1.2 # the default command is to run dpr --help
docker run dpr:v0.1.2 dpr_make_fancy_graph --help

That's it for the basic version, don't hesitate to adapt everything to your needs.

As a more advanced example, to mount your own data folder inside the container (here we re-use the previous example), use

docker run -it -v /home/samuel/git/dpr/datasets:/mnt samuel/dpr:v0.1.2 dpr /mnt/af_left_AFD.txt /mnt/af_left_AFD_realigned.txt --exploredti --do_graph -f -v --points 75
docker run -it -v /home/samuel/git/dpr/datasets:/mnt samuel/dpr:v0.1.2 dpr_make_fancy_graph /mnt/af_left_pval_unaligned.txt /mnt/af_left_coordinates.txt /mnt/af_left_truncated_coordinates.txt /mnt/af_left_average_coordinates.txt 0,2 /mnt/pvals_unaligned.png --title 'p-values before realignment' -f

The result will be located in the folder you specified, here we used /home/samuel/git/dpr/datasets.

Datasets and reference

The main reference is

Samuel St-Jean, Maxime Chamberland, Max A. Viergever, Alexander Leemans,
Reducing variability in along-tract analysis with diffusion profile realignment,
NeuroImage, 2019. ISSN 1053-811

The data is also available at https://zenodo.org/record/2483169.

The manuscript is also available at https://www.sciencedirect.com/science/article/pii/S1053811919305014.

To refer to a specific version of the code, everything is also archived over at https://zenodo.org/record/3248894.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dpr-0.1.2.tar.gz (5.3 MB view details)

Uploaded Source

Built Distribution

dpr-0.1.2-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file dpr-0.1.2.tar.gz.

File metadata

  • Download URL: dpr-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for dpr-0.1.2.tar.gz
Algorithm Hash digest
SHA256 833251aed6c0f15d4d368c4afeb0d4af21f9ad997518b8edc5ab93d8904cc442
MD5 5e5257c4b9276c4346f6a2d7022365ee
BLAKE2b-256 8406ca8d8998ecb2c1f6baaffba73a10c17f4cc135123c1a95ac4ce6f857980d

See more details on using hashes here.

File details

Details for the file dpr-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dpr-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for dpr-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c31c7e1022ce2f6f63be5d6f9c78343d8b9fc62f9367fd6a043c5068ac0b6fe5
MD5 9c56b73ddb69f1b08bfe0843c928069e
BLAKE2b-256 1cf428c2b3e9d2b810fb249744e78088d440723121db53aa0fdf6344e5d61480

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page