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

BF - fix eudx tracking for npeaks=1 #1888

merged 7 commits into from Jul 10, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -75,8 +75,12 @@ cdef class PeaksAndMetricsDirectionGetter(DirectionGetter):
raise IndexError("point outside data")

# Check to see how many peaks were found in the voxel
for numpeaks in range(self._ind.shape[3]):
if self._ind[ijk[0], ijk[1], ijk[2], numpeaks] < 0:
for i in range(self.peak_values.shape[3]):
# Test if the value associated to the peak is > 0
if self._qa[ijk[0], ijk[1], ijk[2], i] > 0:
numpeaks = numpeaks + 1
This conversation was marked as resolved by arokem

This comment has been minimized.

Copy link

arokem Jul 9, 2019


Thanks! This is certainly clearer.


numpeaks = sum(self._qa[ijk[0], ijk[1], ijk[2], i] > 0) 

work here?

This comment has been minimized.

Copy link

gabknight Jul 10, 2019

Author Contributor

No, > doesn't work for arrays. Am I missing something?

Error compiling Cython file:
         numpeaks = sum(self._qa[ijk[0], ijk[1], ijk[2], :] > 0)

dipy/reconst/peak_direction_getter.pyx:85:59: Invalid types for '>' (double[::1], long)

Would have been more clear :)

This comment has been minimized.

Copy link

arokem Jul 10, 2019


Oh well. Thanks for checking.


# Create directions array and copy peak directions from vertices
@@ -63,9 +63,20 @@ def get_direction(dg, point, dir):

# Check that points are rounded to get initial direction
point -= .5
id = peaks.initial_direction(point)
# id should be a (1, 3) array
npt.assert_array_almost_equal(id, [expected_dir])
initial_dir = peaks.initial_direction(point)
# It should be a (1, 3) array
npt.assert_array_almost_equal(initial_dir, [expected_dir])

peaks1 = peaks_from_model(SillyModel(), data, default_sphere,
point = np.array([1, 1, 1], dtype=float)

# it should have one direction
npt.assert_array_almost_equal(len(peaks1.initial_direction(point)), 1)
npt.assert_array_almost_equal(len(peaks.initial_direction(point)), 1)

if __name__ == "__main__":
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.