ANTsPy icon indicating copy to clipboard operation
ANTsPy copied to clipboard

ANTsImage operators don't work on Windows for right-sided operations

Open cookpa opened this issue 1 year ago • 3 comments

@ncullen93 looks like #547 is not working on Windows

Traceback (most recent call last):
  File "D:\a\ANTsPy\ANTsPy\tests\test_core_ants_image.py", line 239, in test__radd__
    img2 = 6.9 + img
TypeError: unsupported operand type(s) for +: 'float' and 'ANTsImage'

cookpa avatar Feb 20 '24 18:02 cookpa

Thanks, I saw the windows build was failing and didnt realize it would fail the build if the tests fail. Now I know to check! It's a weird issue but I have tried to at least fix the tests. Couldn't find any reason why those operations would fail only in windows.

ncullen93 avatar Feb 20 '24 19:02 ncullen93

Yeah, it is a mystery to me as well. Works fine on Mac. As the error is with ANTsImage and not the numpy array, I infer that it's not finding the __radd__ function for some reason, rather than trying to run it and failing.

cookpa avatar Feb 20 '24 20:02 cookpa

This works on all platforms:

im = ants.image_read(ants.get_ants_data('r16'))
im2 = im + 1

This works on Mac and Linux, but fails on Windows:

im = ants.image_read(ants.get_ants_data('r16'))
im2 = 1 + im

cookpa avatar Feb 20 '24 21:02 cookpa