fury-gl / fury

FURY - Free Unified Rendering in pYthon.
https://fury.gl
Other
226 stars 165 forks source link

actor.slicer function segmentation faults when using a int64 data type as input #851

Open pjsjongsung opened 7 months ago

pjsjongsung commented 7 months ago

Description

If fury.actor.slicer is passed a int64 type image, it throws a segmentation fault. Not a critical bug, but could be confusing to users if they encounter this.

Way to reproduce

from fury.actor import slicer
import numpy as np
temp = np.ones((20, 20, 20)).astype(np.int64)
slicer(temp, np.eye(4))

Operating system is ubuntu 20.04. Tested with python 3.9 and 3.10

Preetam-Das26 commented 5 months ago

I would like to work on this issue. @pjsjongsung

xantric commented 4 months ago

is this issue still reproducible? @pjsjongsung ... The given code works perfectly fine for me

skoudoro commented 4 months ago

Yes, I just reproduce it @IshanKamboj. I am using macOS, maybe it is specific to the OS which would be strange. I tried with different python version and still the issue

xantric commented 4 months ago

Yes, I just reproduce it @IshanKamboj. I am using macOS, maybe it is specific to the OS which would be strange. I tried with different python version and still the issue

Ohh it works perfectly fine on windows. I think the issue is specific to linux/macOS.

pjsjongsung commented 4 months ago

Could it be related to python version? I just tested on python 3.8 and 3.10 on windows and still get the fault.

skoudoro commented 4 months ago

We both tested on different python version / OS and we still get segfault.

only @IshanKamboj do not get a segfault. Maybe he can share its full setup. (OS, python version, all packages versions / environment, etc...)

xantric commented 4 months ago

I am using windows 11 as my OS and python version : 3.10.11

Following are the package versions: fury==0.10.0 vtk==9.3.0 numpy==1.26.2 scipy==1.11.4 Pillow==10.0.1 pygltflib==1.16.1 packaging==23.2 aiohttp==3.9.1

robinroy03 commented 4 months ago

I reproduced the segmentation fault on both Ubuntu(WSL) and Windows 11.

Ubuntu(WSL) mentions segmentation fault on terminal but windows powershell terminates the code abruptly.

from fury.actor import slicer
import numpy as np
temp = np.ones((20, 20, 20)).astype(np.int64)
slicer(temp, np.eye(4))
print("this won't be printed")

The last line won't be printed on Windows if tried. The code crashes. Running $? after the python script on windows powershell will show False, meaning the code crashes.

PS C:\Users\Robin Roy\Desktop> python testing_bug.py
PS C:\Users\Robin Roy\Desktop> $?
False

People using Windows who run into this will certainly find it super confusing to debug.

xantric commented 4 months ago

@robinroy03 is right ... The code ends abruptly and does not show segmentation fault on the terminal in windows.

@skoudoro so to solve this we can just check if data array is passed as int64 and raise a ValueError inside the slicer function in actor.py