-
Notifications
You must be signed in to change notification settings - Fork 164
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
Resample_images() crashes kernel #429
Comments
(I'm not ANTs devs, just a user encounter the same issue) Same here on Windows. Not only After tracing back to the source (searching keyword "failed with error code"), I found all these failed functions call
or in ANTsPy/ants/registration/interface.py Lines 218 to 222 in 38260eb
The argument
Next moment, I saw this error
However, somehow Windows does not read in the image/transform pointers correctly. By the way, i'm using Python |
Your diagnosis of the problem is correct … and we don’t develop on windows
….
A solution that may work is to figure out what windows uses as a pointer
address … and then implement a platform specific address system.
I have no idea if this would be portable or work across different window
systems …
On Sun, Feb 26, 2023 at 12:45 PM Dipterix Wang ***@***.***> wrote:
(I'm not ANTs devs, just a user encounter the same issue)
Same here on Windows. Not only resample_image, but also many other
functions raise errors, mostly XXXX failed with error code 1 or something
like file 000002BE70950FA0 does not exist.
After tracing back to the source (searching keyword "failed with error
code"), I found all these failed functions call ANTs c++ with system
calls. For example in ResampleImage
libfn = utils.get_lib_fn('ResampleImage')
libfn(processed_args)
or in antsRegistration
https://github.com/ANTsX/ANTsPy/blob/38260eb58f983541b2a614b5274975bc5d4f7d1f/ants/registration/interface.py#L218-L222
The argument processed_args contains ANTsImage, which seems to be turned
into memory pointers (I guess?) when passing to system calls. With
verbose=True, ANTsPy prints out the command:
antsRegistration -d 2 -r [000001F898A756B0,000001F898A75920,1] -m mattes[000001F898A756B0,000001F898A75920,1,32,regular,0.2] -t Affine[0.25] -c 2100x1200x1200x0 -s 3x2x1x0 -f 4x2x2x1 -x [NA,NA] -m mattes[000001F898A756B0,000001F898A75920,1,32] -t SyN[0.200000,3.000000,0.000000] -c [40x20x0,1e-7,8] -s 2x1x0 -f 4x2x1 -u 1 -z 1 -o [C:/Users/RUNNER~1/AppData/Local/Temp/Rtmp6VIw8G/working_dir/RtmpOGBhDO/file16ec59566cdb,000001F898A75930,000001F898A75890] -x [NA,NA] --float 1 --write-composite-transform 0 -v 1
Next moment, I saw this error
file 000001F898A756B0 does not exist .
Exception Object caught:
itk::ExceptionObject (0000007EB4F99020)
Location: "unknown"
However, somehow Windows does not read in the image/transform pointers
correctly.
By the way, i'm using Python 3.8.16 on AMD 64x
—
Reply to this email directly, view it on GitHub
<#429 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPE7UVPX4LG6MVL5SN3KTWZOJFNANCNFSM6AAAAAAU3IQXX4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
brian
|
Gotcha, if I save the files to the file system, can I call However, I don't know how to implement. |
@ninea-anasovi I created a patch to deal with this issue for my package: https://github.com/dipterix/rpyANTs/blob/main/inst/patches/win_patch.py Basically it allows the functions to store the data in temporary files instead of keeping them in memory. You can run this code via python import or just copy-paste them after importing Please edit accordingly: import ants
# now import win_patch.py to apply patch. You might want edit the following line
import win_patch.py |
I believe this should be fixed by #442 |
function resample_images crashes kernel
I am using python 3.9.4
Jupiter Notebook
Visual studio code
Libraries that I use are:
Matplotlib
Nibabel
Antspyx
First of all I could not install antspy with:
pip install antspyx
As numpy verson was 1.24.2
So I had to donwgrade my python.
After that I needed rigit co-registration of 2 3D images
It didn't worked so I tried to see ants.get_data('r16') and I realised it was 2D and tried to copy the code from documentation to test:
fi = ants.image_read(ants.get_ants_data('r16'))
mi = ants.image_read(ants.get_ants_data('r64'))
print(fi)
print(mi)
fi = ants.resample_image(fi, (60,60), 1, 0)
mi = ants.resample_image(mi, (60,60), 1, 0)
mytx = ants.registration(fixed=fi,moving=mi,type_of_transform ='Rigid' )
This Crashes kernel and I can not do anything unless I reload my VS code.
If I remove 2 lines with resample_image() then this is the error I see:
Please help me solve this issue.
Os: Windows 10
The text was updated successfully, but these errors were encountered: