how to modify a metric in itk

There is a whole class hierarchy. Take a look at this discussion for modification of mutual information metric.