ANTsPy: ITK ERROR: CenteredTransformInitializer: Fixed Image has not been set
hi
i have problem with registration with ants. i install ants with pip in windows os but when I try this code below for registration I get error that is mentioned: my code:
registration_path = r"E:\python_venv/medvispy/mri_skull_plugin/savepath"
input_sample_path = "E:\python_venv\input_sample2/MR_N1.nii"
database_path = r"E:\python_venv/medvispy/mri_skull_plugin/plugin"
fname1 = ants.image_read(str(input_sample_path))
for i in range(1, 8):
print(f"image {i} out of 8")
fname2 = ants.image_read(str(database_path / "MR_N{}.nii".format(i)))
print("error here")
mytx4 = ants.registration(fixed=fname1, moving=fname2,
type_of_transform="SyN",
outprefix=str(registration_path / "diffToMR_N{}_".format(i)),
reg_iterations=[100, 70, 50, 10], # -m 100x70x50x10 \
)
print(mytx4)
result1 = mytx4["warpedmovout"].to_nibabel()
result2 = mytx4["warpedfixout"].to_nibabel()
nib.save(result2, str(registration_path / "N{}_invToMRN1.nii".format(i)))
nib.save(result1, str(registration_path / "N{}_diffToMRN1.nii".format(i)))
but the result is for each one of registration some thing like below:
file 0000018600E3C1C0 does not exist .
Exception Object caught:
itk::ExceptionObject (0000000A275EBBC0)
Location: "unknown"
File: D:\a\ANTsPy\ANTsPy\itksource\Modules\Registration\Common\include\itkCenteredTransformInitializer.hxx
Line: 31
Description: ITK ERROR: CenteredTransformInitializer(000001867F47D310): Fixed Image has not been set
{'warpedmovout': ANTsImage (LPI)
Pixel Type : float (float32)
Components : 1
Dimensions : (116, 142, 102)
Spacing : (0.94, 0.94, 0.94)
Origin : (54.05, 66.27, -47.47)
Direction : [-1. 0. 0. 0. -1. 0. 0. 0. 1.]
, 'warpedfixout': ANTsImage (LPI)
Pixel Type : float (float32)
Components : 1
Dimensions : (116, 142, 102)
Spacing : (0.94, 0.94, 0.94)
Origin : (54.05, 66.27, -47.47)
Direction : [-1. 0. 0. 0. -1. 0. 0. 0. 1.]
, 'fwdtransforms': [], 'invtransforms': []}
and in no one of them save fwdtransforms
and invtransforms
I use same code ,library and python distribution in linux and every thing was alright but I need it in windows actually
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 27 (7 by maintainers)
I try this version [antspyx-0.3.8-cp39-win_amd64] and everything is smoothly and alright
yes it solved thanks alot
May need to install latest version - make sure other versions are purged ….
On Sun, Mar 26, 2023 at 6:03 PM amirreza @.***> wrote:
–
brian
Okay, heavily simplify the code to a single
ants.registration
call and repost.