[Insight-users] itk::ERROR: BSplineDeformableTransform

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 7 10:34:12 EDT 2009


Hi Darren,

After running your program in GDB, things become clearer.

The problem is that in lines 621-624:

    bsTransformType::Pointer bsFinalTransform = bsTransformType::New();
    bsFinalTransform->SetParameters(
bsRegistration->GetLastTransformParameters() );
    bsFinalTransform->SetFixedParameters( bsTransform->GetFixedParameters() );

You are setting the new parameters values BEFORE setting
the Fixed parameters of the transform. The settings of the
BSpline grid are part of the Fixed parameters. Therefore, you
are passing the values of deformation to all the BSpline grid
nodes, without having first specified how many grid nodes
there are.

The fix is simple:
Invert the order of the SetFixedParameters and SetParameters calls.

Like

    bsTransformType::Pointer bsFinalTransform = bsTransformType::New();
    // FIXED parameters MUST Be set first.
    bsFinalTransform->SetFixedParameters( bsTransform->GetFixedParameters() );
    bsFinalTransform->SetParameters(
bsRegistration->GetLastTransformParameters() );


With this change, the code runs for me until the end
without throwing exceptions.


The lbfgs optimizer is still unhappy though...



   Regards,


         Luis



-------------------------------------------
On Wed, Oct 7, 2009 at 10:18 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Darren,
>
> Yes, there are multiple ways of debugging this errror.
>
> It would seems that the grid of the BSpline transform
> is not defined, despite the fact that you seem to be
> setting that correctly (from looking at your code.)
>
> BTW: thanks for attaching the source code.
>
> The first thing to try, would be to add:
>
>    bsTransform->Print( std::cout );
>
> to line 594, just after the call to StartRegistration().
>
> This will allow us to see the state of the BSpline transform
> at that point. In particular we are interested in seeing
> the values of the BSpline grid.
>
>
>    Please let us know what you find,
>
>
>          Thanks
>
>
>                Luis
>
>
> -----------------------------------------------------------------------
> On Tue, Oct 6, 2009 at 6:28 PM, Darren Weber
> <darren.weber.lists at gmail.com> wrote:
>>
>> Is there an easy way to debug this error?
>>
>> vnl_lbfgs: Error. Netlib routine lbfgs failed.
>> terminate called after throwing an instance of 'itk::ExceptionObject'
>>   what():
>> /opt/local/include/InsightToolkit-3.16/Common/itkBSplineDeformableTransform.txx:347:
>> itk::ERROR: BSplineDeformableTransform(0x126f390): Mismatched between
>> parameters size 128 and region size 0
>>
>>
>> See code file attached.  Example files are available at
>> ftp://ftp.buckinstitute.org/dweber/itkRegistrationFiles.tar.gz
>>
>> The src code builds OK and it's called using:
>>
>>         # Bspline deformation registration: $imgMov TO $imgFix
>>         $HOME/bin/itkImageBsplineCoregistration \
>>             $imgFixBW  $imgMovBW  ${imgOutBW}.${imgType} \
>>             $imgFixRGB $imgMovRGB ${imgOutRGB}.${imgType} \
>>             ${imgOutBW}_DiffBefore.$imgType \
>>             ${imgOutBW}_DiffAfter.$imgType > ${imgOutBW}.log
>>
>> TIA,
>> Darren
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>


More information about the Insight-users mailing list