Multi-metric registration

ANTsPy and ANTsR inherit the ability to do multi-metric registration.

Such registrations assume that the feature images are in the same physical space and at least roughly aligned.

One may then use registration to optimize a multiple similarity metric objective function as in:

First, import ants, read some images and create some features.

In [1]:
import ants
image = ants.image_read(ants.get_ants_data('r16'))
image2 = ants.image_read(ants.get_ants_data('r27'))
g1 = ants.iMath_grad( image )
g2 = ants.iMath_grad( image2 )

Perform a baseline registration with a single feature and create a couple of new metrics. Each metric is defined by a name ("CC"), the input fixed (image), input moving (image2), a weight value (e.g. 2) and a sampling parameter ( for CC this defines a radius of 9x9 e.g. 4 extra pixels on all sides of the center pixel. Five entries are needed in total.

In [6]:
reg1 = ants.registration( image, image2, 'SyNOnly' )
demonsMetric = ['demons', g1, g2, 1, 1]
ccMetric = ['CC', image, image2, 2, 4 ]

Append the first metric to the metric list. In actuality this means that reg2 will be driven by both a demons metric and the default metric.

In [7]:
metrics = list( )
metrics.append( demonsMetric )
reg2 = ants.registration( image, image2, 'SyNOnly',
    multivariate_extras = metrics )

Add a third metric and run this new registration.

In [8]:
metrics.append( ccMetric )
reg3 = ants.registration( image, image2, 'SyNOnly',
    multivariate_extras = metrics )

Quantify the results in terms of mutual information of the registration results using the original image intensity.

In [9]:
print( ants.image_mutual_information( image, image2 ) )
print( ants.image_mutual_information( image, reg1['warpedmovout'] ) )
print( ants.image_mutual_information( image, reg2['warpedmovout'] ) )
print( ants.image_mutual_information( image, reg3['warpedmovout'] ) )


In [ ]: