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

system crased/blue screen error/multithread error #764

Open
holyswordZZQ opened this issue Jan 4, 2025 · 3 comments
Open

system crased/blue screen error/multithread error #764

holyswordZZQ opened this issue Jan 4, 2025 · 3 comments

Comments

@holyswordZZQ
Copy link

Describe the bug

my system got crashed (blue screen) while doing this code:mytx = ants.registration(fixed=fi_img, moving=mov_img, type_of_transform = 'SyN' )
To reproduce

any data is ok to reproduce this bug in the following codes:
import ants
ori_path=r'C:\Users\AQi\Desktop\LPVNet_JLUdata\LPVNet_MS'
os.environ["ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS"] = "1"
for file in os.listdir(ori_path):
if file.endswith('.nii.gz'):
print('zzz')
mov_img = ants.image_read(os.path.join(ori_path, file))
print('aaa')
fi_img=ants.image_read(r"C:\Users\AQi\Desktop\MNI152_T1_1mm.nii.gz")
print('bbb')
mytx = ants.registration(fixed=fi_img, moving=mov_img, type_of_transform = 'SyN' )
print('ccc')
warped_out= mytx['warpedmovout']
print(warped_out)
ants.image_write(warped_out, os.path.join(r'C:\Users\AQi\Desktop\LPVNet_JLUdata\processed\MS', file))
break

Expected behavior

I want to make a standard registrition process.
Screenshots

ANTsPy installation (please complete the following information):

  • Hardware [ PC I9-14900KF]
  • OS: [Windows ]
  • System details [ OS 名称: Microsoft Windows 11 专业版
    OS 版本: 10.0.22631 暂缺 Build 22631 系统类型: x64-based PC ]
  • Sub-system: [ ]
  • ANTsPy version: [0.3.8 ]
  • Installation type: [ https://github.com/ANTsX/ANTsPy/releases/download/v0.3.8/antspyx-0.3.8-cp310-cp310-win_amd64.whl ]

Additional context
This is my new PC and it perform well on my old ones. On this PC, I tried to install the latest version 0.5.4 from pip. Without set the os.environ, the code would only output 'zzz' which means even data reading failed. After downgrade to 0.3.8, it would work when os.environ was set, but without this my system crashed. (Actually on 0.5.4 sometimes it also crashed without setting os.environ). I think it may be sth wrong with my PC but I dont know why, please help me.

@cookpa
Copy link
Member

cookpa commented Jan 4, 2025

Have you installed the latest MSVC runtime libraries on your new machine?

https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022

I'm not sure what threading would have to do with it, but you should set

os.environ["ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS"] = "1"

before the call to import ants

@holyswordZZQ
Copy link
Author

Member

I'm sure I had installed this libraries, and os.environ was set before import. This error occured very strange. If the os.environ was not set, sometimes the first time I run the code is normal, everything was ok. But when I quickly run it for the second time, like, in about 5 minutes, the crash would happen ( for version 0.5.4, the image reading code would fail, the same, the first time run it would be ok).

@cookpa
Copy link
Member

cookpa commented Jan 5, 2025

I have no idea what's going on here. Maybe you can try running the tests? From a command line, with ANTsPy installed:

export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1
ANTsPy/tests/run_tests.sh

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

No branches or pull requests

2 participants