ANTsPy
ANTsPy copied to clipboard
The 2D registration results are dark
Describe the bug Hi, I was using ANTsPy to register 2D images, but I got 2 dark image as warped result and inverse warped result, I don't understand what's going on.
To Reproduce My code to register the images is as follow:
def img_to_single_component(name):
img = Image.open(name)
# img = img.resize((1080, 1080))
img = img.convert('P')
img1 = ants.from_numpy(np.array(img))
return img1
def antsRegistration(fi_path, mv_path, method, random_seed):
fi = img_to_single_component(fi_path)
mi = img_to_single_component(mv_path)
mytx = ants.registration(fixed=fi, moving=mi, type_of_transform=method, randome_seed=random_seed)
my_warped_image = ants.apply_transforms(fixed=fi, moving=mi, transformlist=mytx['fwdtransforms'],interpolator='nearestNeighbor')
my_inversed_warped_image = ants.apply_transforms(fixed=mi, moving=fi, transformlist=mytx['invtransforms'],interpolator='nearestNeighbor')
imageio.imwrite(f'{method}_Warped.png', my_warped_image.numpy())
imageio.imwrite(f'{method}_InverseWarped.png', my_inversed_warped_image.numpy())
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
This is the warped image I get, the method is "Affine" and the interpolation is set to be "nearestNeighbor"
Desktop (please complete the following information):
- OS: Windows 10 Pro 64