-
Notifications
You must be signed in to change notification settings - Fork 35
Multistart optimization for challenging registration problems
stnava edited this page Jun 24, 2016
·
1 revision
The starting point of a registration is important for the local optimization's convergence.
Multistart does a registration from different starting points in order to overcome some of this sensitivity.
Below is an example of how to, relatively quickly, search over a few starting points in rotation space.
Key points:
-
downsample your input data in order to speed up the search
-
sample the sphere uniformly but relatively sparsely
-
search the best parameters with a standard registration process
This example also shows how to create an ANTsR transform from the parameter matrix.
library( ANTsR )
ffull=antsImageRead( "reference_vol.nii.gz" )
mfull=antsImageRead( "failed_C57L_J_.nii.gz" )
# mfull=antsImageRead( "failed_CAST_EIJ_.nii.gz")
f = resampleImage( ffull %>% smoothImage(1), rep(1.0,3), interpType=0 )
m = resampleImage( mfull %>% smoothImage(1), rep(1.0,3), interpType=0 )
print( f )
nout = 5
thetas = seq( from = 0, to = 360, length.out = nout )[1:(nout-1)]
mytx = "/tmp/best.mat"
mival<-invariantImageSimilarity( f, m,
thetas=thetas, thetas2=thetas, thetas3=thetas,
localSearchIterations=10, txfn=mytx )
print( mival )
bestInd = which.min( mival[[1]][,1] )
txparams = as.numeric( mival[[1]][ bestInd,2:(ncol( mival[[1]] )-3) ] )
txfixedparams = as.numeric( mival[[1]][ bestInd,(ncol( mival[[1]] )-3+1):ncol( mival[[1]] )] )
www = antsApplyTransforms( ffull, mfull, transformlist=mytx )
# now refine via image registration with this initial map
areg = antsRegistration( f, m, typeofTransform="Affine", initialTransform=mytx)
www2 = antsApplyTransforms( ffull, mfull, transformlist=areg$fwdtransforms )
# now build a transform and apply it
affTx = createAntsrTransform( type = "AffineTransform", dimension = 3,
parameters = txparams,
fixed.parameters = txfixedparams )
www3 = applyAntsrTransformToImage( affTx, mfull, ffull )