Skip to content

Bug: Horizon throws errors when changing intensity range and then changing volumes #3359

Open
@pjsjongsung

Description

Description

From dipy_horizon, when you change the intensity range of the value and then try changing volumes, it throws an error. I believe some value for the range of intensity is being transferred, which exceeds the max value of the next volume, throwing an error.

Traceback (most recent call last):
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/fury/interactor.py", line 402, in _callback
callback(self, prop, *args)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/fury/ui/core.py", line 341, in mouse_move_callback
self.on_left_mouse_button_dragged(i_ren, obj, self)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/fury/ui/elements.py", line 753, in handle_move_callback
self.on_moving_slider(self)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/dipy/viz/horizon/tab/slice.py", line 293, in _change_volume
self.on_volume_change(self._tab_id, value)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/dipy/viz/horizon/tab/base.py", line 322, in synchronize_volumes
slices_tab.update_volume(value)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/dipy/viz/horizon/tab/slice.py", line 419, in update_volume
self._volume.obj.value = volume
^^^^^^^^^^^^^^^^^^^^^^
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/fury/ui/elements.py", line 668, in value
self.on_value_changed(self)
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/dipy/viz/horizon/tab/slice.py", line 299, in _change_volume
valid_vol = self._visualizer.change_volume(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/dipy/viz/horizon/visualizer/slice.py", line 185, in change_volume
value_range = np.percentile(vol_data, [perc_0, perc_1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jimmy/miniconda3/envs/python312/lib/python3.12/site-packages/numpy/lib/function_base.py", line 4282, in percentile
raise ValueError("Percentiles must be in the range [0, 100]")
ValueError: Percentiles must be in the range [0, 100]

Way to reproduce

Run dwi on dipy_horizon, move intensity and change volume index

OS versions=Linux-5.4.0-195-generic-x86_64-with-glibc2.31
python version=3.12.2
dipy=1.10.0.dev0+804.c7eec93
numpy=1.26.4
fury=0.10.0

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions