Skip to content
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

Change direction getter dictionary keys from floats[3] to int #1372

Closed
gabknight opened this issue Oct 31, 2017 · 1 comment
Closed

Change direction getter dictionary keys from floats[3] to int #1372

gabknight opened this issue Oct 31, 2017 · 1 comment
Assignees

Comments

@gabknight
Copy link
Contributor

Description

Following discussion in PR #1342.

Dipy currently uses the 3 float defining the direction as the dictionary key to get the neighboring directions (cdf = self._adj_matrix[tuple(*direction)]). This call is slow and is done at each tracking steps. The solution would be to replace the 3 floats by an int. The 3 floats are already associated to an int as each direction is one of the vertices of the sphere.

A potential solution would be to keep track of both the floats and index on the sphere during the tracking, instead of solely the direction. This is fine for all direction getters that used a discrete sphere. However, not all direction getters use a discrete sphere (e.g. EuDX / PeaksAndMetricsDirectionGetter). We will need to be careful and well encapsulate this behavior in the direction getter.

File

dipy/direction/probabilistic_direction_getter.py

Functions

ProbabilisticDirectionGetter.get_direction(.)
DeterministicMaximumDirectionGetter.get_direction(.)

@gabknight
Copy link
Contributor Author

We remove the adj_matrix when optimizing the tracking in PR #2805.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant