elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Multiple metrics and regularization

Open alvarez-pa opened this issue 3 years ago • 3 comments

Hello all,

I would like to use a combination of two image-based metrics and a regularization term for the elastic registration of CT lung images. This is defined in the elastix parameter file as follows:

(Registration "MultiMetricMultiResolutionRegistration")
(Metric "AdvancedNormalizedCorrelation" "AdvancedNormalizedCorrelation" "TransformBendingEnergyPenalty")

(FixedImagePyramid "FixedRecursiveImagePyramid" "FixedRecursiveImagePyramid")
(MovingImagePyramid "MovingRecursiveImagePyramid" "MovingRecursiveImagePyramid")
(ImageSampler "Random" "Random")
(Interpolator "BSplineInterpolator" "BSplineInterpolator")

I provide elastix with two moving images (-m0 -m1) and two fixed images (-f0 -f1) as well as the typical input/output parameters, but I obtain an error at execution:

Description: itk::ERROR: itk::ERROR: MultiMetricMultiResolutionRegistration(0000025A5C22BED0): The NumberOfInterpolators should equal 1 or equal the NumberOfMetrics

If I try to add interpolator, image sampler and image pyramid descriptions for the penalty term it gives me another error:

Description: itk::ERROR: FixedRecursivePyramid(000002A2B81755C0): Input Primary is required but not set.

I have implemented this multi metric with penalization feature by adding some logic to count separately the "image based", "transformation based" and "point set based" metrics. This allows to check for the number of image pyramids and interpolators according to the specified metrics, since it seems to me that such components are needed only for the "image based" metrics.

I will make a pull request with a link to this issue to facilitate tracking.

Best,

alvarez-pa avatar Jun 15 '21 12:06 alvarez-pa

@alvarez-pa Thank you for your carefully written issue and pull request, Pablo! We will have a closer look this month. As it appears such a fundamental issue, we may need some more time.

N-Dekker avatar Jun 21 '21 12:06 N-Dekker

Hello all,

I seem to have run into the same issue! I want to provide Elastix with multi-channel data (-f0 ... -f5 and -m0 ... -m5) and want to use two regularizers (transform bending penalty and corresponding points penalty) alongside an image similarity metric (normalized mutual information).

I understand it might be hard to merge the fix described within a stable release. I was wondering if @alvarez-pa had a compiled binary with his local fix that could be shared. Thanks in advance!

Cheers, Ishaan

ishaanb92 avatar Oct 27 '23 13:10 ishaanb92

Hello @ishaanb92,

I do not have access anymore to the machine where I compiled Elastix with the fix to this problem. Therefore, I unfortunately cannot give you any binaries. However, you may try to recompile the code yourself with the fix applied.

If you decide to recompile, you may proceed in two ways:

  • You compile an old version of Elastix containing the fix. You will find the code in my github repository: https://github.com/alvarez-pa/elastix/tree/fix_enhance.
  • You apply the fix to a more recent version of Elastix. You can see what changes are needed here: https://github.com/SuperElastix/elastix/pull/482/files.

There may be other ways, but those are the two I am aware of. I hope it helps.

Best, Pablo

alvarez-pa avatar Nov 03 '23 13:11 alvarez-pa