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.

To install the package, just run

pip install dpr

The documentation is available at https://dpr.readthedocs.io.

The matlab version

There is also a shiny new version written in matlab, with an assorted example, available in the matlab folder. Feel free to check out and edit the functions as needed for your own usage.

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

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 open access 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.2.1.tar.gz (5.3 MB view details)

Uploaded Source

Built Distribution

dpr-0.2.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dpr-0.2.1.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for dpr-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6413b3aa1fddf097872015f2cbcc6371dfb1c5cb177ebc38b52aecf2d7c536c5
MD5 65a0ed80c2855a826283fac807f780ad
BLAKE2b-256 6811a4424134201b4f75dce625c432e0a75be137c0a862e73b523e20da00855b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dpr-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for dpr-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f03a543e5ab3f4498f329923e742be1223fcc87a301eeb453eea7d75026ebc7
MD5 01f66198998ee723a61bea7f349dd125
BLAKE2b-256 fdd07e5ab2362aebcb5d53de7d61dce3b24d99e91aa8dfcbd7e8ebcc983c1617

See more details on using hashes here.

Supported by

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