Closed MAeolus closed 8 months ago
Maybe try
affine_img = affmat.apply_to_image(mov_img, reference=fix_img, interpolation='linear')
Maybe try
affine_img = affmat.apply_to_image(mov_img, reference=fix_img, interpolation='linear')
Thanks! It works. By the way, I've found that it works when interpolation='linear' but when interpolation='nearestNeighbor' there will have
Traceback (most recent call last): File "./reg_affine-V3-batch.py", line 107, in <module> affine_img = affmat.apply_to_image(mov_img, reference=fix_img, interpolation='nearestNeighbor') # apply to the same moving image File "/public/data/admin/anaconda3/envs/py37/lib/python3.7/site-packages/ants/core/ants_transform.py", line 178, in apply_to_image img_ptr = tform_fn(self.pointer, image.pointer, reference.pointer, interpolation) RuntimeError: /project/itksource/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx:540: ITK ERROR: ResampleImageFilter(0x16eb8850): Interpolator not set
Is nearest neighbor interpolation not supported yet?
It might be case sensitive, try nearestneighbor
It might be case sensitive, try
nearestneighbor
Problem solved! Thanks.
Describe the bug Hello, I'm trying to apply the transforms generated by ants.registration to the same moving image using apply_to_image to get the same warped image of ants.registration, however, it returns an image with every voxel intensity equal to zero.
To Reproduce Here's what I'm trying to do:
reg_img is totally fine but affine_img returned by apply_to_image is just a matrix of zeros while they are supposed to be the same.
antspyx== 0.4.2
Any idea why this occurs? Thanks a lot!