itk::ERROR Image(0x55f0ab8f5690): A spacing of 0 is not allowed: Spacing is [0, 0, 0]

Hello, everyone!
I am struggling with that error:
itk::ERROR Image(0x55f0ab8f5690): A spacing of 0 is not allowed: Spacing is [0, 0, 0]

The situation is the following:
I am performing a multistage image registration.
First stage is a rigid transform (3DVersorRigidTransform) using the regularStepGradientDiscentOptimizer;

After that I resample the moving image to obtained a rigidly registered image.

That image is used as the input for the deformable stage.
This stage starts ok, but crashes right away with that error message.

I already tested the process with two different optimizers for the deformable stage: LBFGSBOptimizer and LBFGSOptimizer . No success though.

Any clues are welcome.
Thanks,

Leo.

Sounds like you have a bug in your code. Trying to create a MWE might reveal it.

I’m not aware of how to create and handle a MWE.
Could you go into the specifics of that?

I also tried to debug with Qt Creator, but no success.

My pipeline is based on DeformableRegistration8.cxx.
I even tried to run the example alone, but it is running tooo slow, and the optimizer output do not sound reasonable.

Thanks.

Here are some instructions on how to create minimum working example (MWE).