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

dipy.reconst.peak_direction_getter.PeaksAndMetricsDirectionGetter.initial_direction (dipy/reconst/peak_direction_getter.c:3075) IndexError: point outside data #1712

Closed
YerongLi opened this issue Dec 30, 2018 · 1 comment

Comments

@YerongLi
Copy link

commented Dec 30, 2018

Hi, when I used my own DWI with b-vectors I have got error when generating streamline with DWI affine (I've got no error when I took np.eye(4) as affine input):

csd_peaks = peaks_from_model(model=csd_model,
                             data=data,
                             sphere=sphere,
                             mask=mask,
                             relative_peak_threshold=.5,
                             min_separation_angle=25,
                             parallel=True)

tensor_model = TensorModel(gtab, fit_method='WLS')
tensor_fit = tensor_model.fit(data, mask)

fa = tensor_fit.fa

tissue_classifier = ThresholdTissueClassifier(fa, 0.1)

seeds = random_seeds_from_mask(fa > 0.3, seeds_count=1)
streamline_generator = LocalTracking(csd_peaks, tissue_classifier,
                                     seeds, affine=affine,
                                     step_size=0.5)

streamlines = Streamlines(streamline_generator)

I met following errors and warnings, could anyone help me resolve this?

/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
/home/yl148/.local/lib/python3.6/site-packages/dipy/direction/peaks.py:562: RuntimeWarning: invalid value encountered in double_scalars
  return np.sqrt(numer / denom)
Traceback (most recent call last):
  File "../src/localTracking.py", line 156, in <module>
    
  File "/home/yl148/.local/lib/python3.6/site-packages/nibabel/streamlines/array_sequence.py", line 93, in __init__
    self.extend(iterable)
  File "/home/yl148/.local/lib/python3.6/site-packages/nibabel/streamlines/array_sequence.py", line 238, in extend
    for e in elements:
  File "/home/yl148/.local/lib/python3.6/site-packages/dipy/tracking/utils.py", line 968, in move_streamlines
    for sl in streamlines:
  File "/home/yl148/.local/lib/python3.6/site-packages/dipy/tracking/local/localtracking.py", line 108, in _generate_streamlines
    directions = dg.initial_direction(s)
  File "dipy/reconst/peak_direction_getter.pyx", line 75, in dipy.reconst.peak_direction_getter.PeaksAndMetricsDirectionGetter.initial_direction (dipy/reconst/peak_direction_getter.c:3075)
IndexError: point outside data
srun: error: bc6u23n3: task 0: Exited with exit code 1
@gabknight

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2019

Hi @YerongLi,

Sorry for the late response. The problem is the missing affine parameter in random_seeds_from_mask(.). Thus, your seeds are located in image space while you perform the tracking in real space with LocalTracking. Using affine=np.eye(4) will perform the tracking in the image space, which is OK, but might show miss-alignment of the streamlines to images in other visualisation software.

@gabknight gabknight closed this Apr 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.