Closed IlvaHou55 closed 4 months ago
I think you want reg_iterations=(X)
for X iterations at full resolution. If you have reg_iterations = (X,Y,Z)
it will do three levels: X downsampled 4x, Y downsampled 2x, and Z at full resolution. You may also want type_of_transform='SyNOnly'
to disable affine registration.
I'm not sure how you set the other convergence parameters.
MI is not the best choice for detecting images with zero difference. if you want to add such a check you might do:
if mean( imgF - imgM ) == 0 : return identity else : do registration
as others said, mutual information is a probabilistic measurement with built-in uncertainty. i would not worry about sub-voxel displacements coming out of it.
also - I would recommend using ANTsPy I/O as follows:
import ants
img=ants.image_read("MRI_4.nii").iMath("Normalize")
img2=ants.image_read("MRI_4.nii").iMath("Normalize")
reg=ants.registration(img,img2,'SyN')
# check mag of def
warp=ants.image_read( reg['fwdtransforms'][0] ).split_channels()
for k in range(3):
print(warp[k].abs().max())
# 0.115857765
# 0.25167125
# 0.15904859
voxel size is 1mm so these max displacements are far under that. you should read these as effectively zero.
@cookpa Thank you for your reply. Why would you want to disable the affine transformation?
Just trying to isolate the variability in SyN.
@cookpa I see, but for my application I need them both, so think it is fair if I use them both in this test case.
@stnava Thank you for your reply. Would you always normalize the images before registration?
if they have negative values, then yes
Hi everyone,
Two days ago I opened this issue on the global ANTs page. I encountered that with
ants.registration(fixed=fixedmri, moving=fixedmri, type_of_transform='SyN')
my original image and registered image were quite different, where you would expect no transformation because two identical images are used for the fixed and moving image.Please see the thread for a reproducible example.
Now I wondered how I could reproduce the example of @cookpa in ANTsPy:
I thought of:
grad_step=0.1
because of-t SyN[0.1]
aff_sampling=64
andsyn_sampling=64
because of-m Mattes[ MRI_4.nii , MRI_4.nii , 1, 64, Regular ]
reg_iterations=(25, 1e-8, 10)
because of-c [ 25, 1e-8 ,10 ]
However, regarding the smoothing and downsampling, the ANTsPy docs state 'we will set the smoothing and multi-resolution parameters based on the length of this (reg_iterations) vector.' Does this mean I cannot manually set these parameters to zero-smoothing and zero-downsampling?
Thank you in advance.