I am trying to define a multi-modal similarity measure for registration between 3 volumes, two ultrasounds and one MRI. Is there already a template for defining custom similarity measurements? otherwise, would you please guide me how to use the SDK to optimally implement the similarity measurements? which classes should derive from, etc.
you can register new similarity measures in the SimilarityMeasureFactory. However, the SimilarityMeasureImpl base class only operates on two images. I would recommend to create your own algorithm that derives from LinearImageRegistration (assuming you only need rigid/affine transformations) and receives your 3 images as input. Also create your own SimilarityMeasureImpl class and add it to SimilarityMeasureFactory. LinearImageRegistration will construct your similarity measure with two images only, but you can add a member method that will assign the third volume. Then override the LinearImageRegistration::evaluate method, where you have access to your similarity measure through m_sm and could pass it the pointer to the third volume, before calling the base implementation of evaluate.
Another way would be to create a custom DataComponent that contains the pointer to one of the ultrasound images and assign the component to the other ultrasound image. Then your similarity measure could fish the pointer to the missing volume from the DataComponent. This way you don’t need to override LinearImageRegistration but can use the regular ImageRegistration. You have to be careful though when deleting images.