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://samuelstjean.github.io/dpr
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.
Metadata
Release files for dpr 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dpr-0.2.3.tar.gz | 5.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dpr-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 MB
Release files / dpr-0.2.3.tar.gz
| Download URL | dpr-0.2.3.tar.gz |
|---|---|
| Size | 5.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31cc87f14d6f5997e2d837642d29d18ba43a4d6ddf390f238b57875cd331c577
|
|
BLAKE2b-256 checksum How to use checksums |
3a86ed191143fd8e544738416f70a6f50745a28d3a018eaf7f9a43934a392118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / dpr-0.2.3-py3-none-any.whl
| Download URL | dpr-0.2.3-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15729abafde5122d49934563a3bc7771249ccc63a0956082145e3a702b9b1906
|
|
BLAKE2b-256 checksum How to use checksums |
4e0cd6ae6f0d3b0d3c582e4f5cb1eb3b18b507e69fc72149748cf1ed15b667ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log