New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reproducibility in PFT tracking #1596
Comments
@GuillaumeTh This will be nice to have, but this isn't limited to PFT. This should be implemented for all tracking algorithms. I think this should go in tracking/local/direction_getter as a function setting the random state, which should be called in LocalTracking and ParticleFilteringTracking before starting the tracking from an initial seed position. The random seed should not only be based on the voxel_id, otherwise all streamline started at the same voxel will be identical or biased in one direction. Maybe voxel id and seed_count? This could also be floating point 3D position of the seed, thus an identical seed will then always give an identical streamline, but then this removes the option to generate e.g. 1k streamlines from the very same seeding position. I'm not sure here how this should be done... |
I think the random seed for each seed tracking could be what you said. I will try to have a draft and check if it's easy to do or not. |
Ok thx let me know if I can help with this. I wouldn't "reset" the random seed in the middle of streamline being traced (localtracking.pyx:502), as this would biais the overall reconstruction. |
So I tested something and It seems to work. Finally I changed the function Before the initial_direction, I setted the numpy.random and random seed. With these modifications, I am reproducible at 99% if the masks are reproducible at 99%. |
So @gabknight, I can create a PR if you want to see. @skoudoro Are you ok to review this functionality ? |
No problem @GuillaumeTh, but first, I just need to fix our problem with Travis. |
@skoudoro Can I create the PR with the Travis problem ? |
yes, #1601 fix it. When this PR is merged, you can rebase yours |
After some tests with @jchoude on the PFT tracking, we saw a issue. If we run twice the algorithm with maps slightly differents (1 voxel), the tracking is not reproducible.
I think it could be cool to have a reproducibility of 99% on the tracking if the maps are reproducible at 99%.
We need to set the random seed follow the voxel and the global random seed( random.seed(voxel_id * random_seed) ).
I checked the files where we need this and they are:
tracking/utils.py -> random_seeds_from_mask
tracking/local/localtrack.pyx -> _pft line 482 and line 502
direction -> probabilitic_direction_getter.pyx line 120
What do you think about this feature @gabknight
The text was updated successfully, but these errors were encountered: