Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Reproducibility in PFT tracking #1596
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
What do you think about this feature @gabknight
@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...
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%.