Cleaning elastix results

Hello,

I’ve been trying to use elastix to register some organs but I have a few issue.
After registration, the results need “cleaning” (see picture where I registered a liver onto itself)


I can fix it by doing some closing/dilating.

The issue is that I have other structure inside the organ I want to apply the transform to and I fear that my cleaning is changing the volume.

Has anybody encountered a similar issue ?
Any tips on how to fix this ?

A warped organ should not look like this. Do you do 3D/3D registration?

Did you apply the transform using Transforms module?

Could you please show the dispacement field (in Transforms module, visualization section) and copy the screenshot here? We would see if the field makes sense (smooth and not folding onto itself).

I applied the transform given by elastix using the transform module and I got good results.
I don’t know why the volume given by the elastix module is different.
In my project, I’m calling elastix directly (without going through slicer) and I have the same issue.
Do you know what the transform modul does differently that I could implement on my side.

How did you make the Elastix module transform a segment? What inputs and outputs have you specified?

I put the same volume as input and output.
It’s a the segmentation of a liver, stocked as a .nii, that I imported in slicer as a volume.


I was using the output volume area on for the screenshot I provided in my first message
My guess is that the transform module does some kind of pre/post processing that is absent in the elastix module.

You cannot choose the same volume as input and output, because you cannot use a label volume directly as fixed or moving volume. The registration would not reliably converge due to large homogeneous regions in the label image. You could compute distance maps from binary images and use thise as registration inputs (this is implemented in Segment Registration) or maybe use some special metric that includes a similar processing (but I don’t know if Elastix provides something like this).

1 Like

I understand your point. However, in practice, Now that I apply the registration with the transform module, everything works well. I’ll look into changing my pipeline to have something more theoretically correct in the fututre.
The issue didn’t seem to come from the transform in itself but from the way it is applied in the elastix module.
Your advice allowed me to find a solution and highlighted potential weak point in my approach, thanks a lot :slight_smile:

As suggested by @lassoan, the solution to my issue was to apply the transform given by the elastix modul to my volume using the transform module.
The cause of the issue seems to be transformix (the part of elastix in charge to apply the transform). The way transformix and the transform module apply the transform are different.
If someone has an explanation of this difference, I’m curious to know.