BSpline Multiresolution error while setting Transform

Hello, everyone.

I am writing a MULTISTAGE registration pipeline.
1st Stage is a 3D rigid one;
the output is added into CompositTransform object;
Then I set the CompositTransform as the initial transform of the Deformable BSpline stage;

Moving forward I set the multi-resolution transformAdaptors using the CompositTransform in the transformAdaptors->SetTransform() and it yields an ERROR: Transform mismatch.

Any clues are welcome.

I think the usual way is to add BSpline to Composite, like in DeformableRegistration15 which was recently updated.

1 Like

Thanks for answering @dzenanz.
I did that. I Created a deformableTransform, initialized that, added to the compositTransform,
and set the command compositeTransform->SetOnlyMostRecentTransformToOptimizeOn();

Then I set the compositTransform into the deformableRegistration->SetInitialTransform() with the extra command registration->InPlaceOn();

Now, the questions that arises are the following:

Is it necessary to give the command
compositeTransform->AddTransform(deformableRegistration->GetModifiableTransform()) in order to have the compositTransform fully updated?

In the resampling stage, what transform should I use: the compositTransform or the deformableTransform?

Thanks in advance.

It probably is. But you can try omitting it and see what happens.

Probably compositTransform.

1 Like

Hey @dzenanz.
I tried to use the transforms as mentioned. Now I’m getting a quite random error about the metric:

ExceptionObject caught !

itk::ExceptionObject (0x560232884590)
Location: "unknown" 
File: /home/leo/General_sources/ITK-5.0.1/Modules/Core/Common/src/itkPoolMultiThreader.cxx
Line: 154
Description: itk::ERROR: PoolMultiThreader(0x5602328a1210): Exception occurred during SingleMethodExecute
/usr/local/include/ITK-5.0/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx:260:
Exception in GetValueAndDerivativeProcessPoint:
/usr/local/include/ITK-5.0/itkBSplineBaseTransform.h:284:
itk::ERROR: BSplineTransform(0x560232885970): ComputeJacobianWithRespectToPosition not yet implemented for BSplineTransform 

So far, I have no clue where this error starts. Although another doubt arises:
What’s the true difference between:

registration->SetInitialTransform();
registration->InPlaceOn();

and

registration->SetMovingInitialTransform();

What I am thinking is if it is correct to set:

registration->setInitialTransform(CompositTransform)

and

registration->SetMovingInitialTransform(dtransform)

to later on GetModifiableTransform give me the updated dtransform alone.

Any help is appreciated. Thanks.

Perhaps comments here might be of help:

Hey @dzenanz, thanks for the help. Although I did not get any further.

A better way to state my issue is:
How can I set the BULK transform in a BSpline registration?
I have the bulk transform (a rigid registration previously found) I only need to connect that into the pipeline.

There are 2 classes, BSplineDeformableTransform which has SetBulkTransform() method and BSplineTransform, which doesn’t. BSplineTransform is therefore usually part of composite transform. DeformableRegistration15 example uses BSplineTransform + composite transform.

I create another topic. I guess we can make a clearer discussion.