[ITK] ITK bug or feature

Francois Budin francois.budin at kitware.com
Mon Sep 18 12:04:23 EDT 2017


Hello Ziv,

Thanks for the report. There was indeed a bug in itkSimilarity2DTransform
and itkCenteredSimilarity2DTransform. I submitted a patch [1] to correct
the problem. It would be great if you could test it and review it.

Thanks!
Francois

[1] http://review.source.kitware.com/#/c/22633/

On Thu, Sep 14, 2017 at 12:34 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <
zivrafael.yaniv at nih.gov> wrote:

> Hello ITK developers,
>
>
>
> I encountered unexpected behavior with ITK parameter settings in
> degenerate cases for the CenteredSimilarity2DTransform and
> Similarity3DTransform classes.
>
>
>
> The degenerate parameter values I am referring to is setting the scale to
> zero. I encountered this issue when I blindly set all parameters to zero to
> get an identity transform (obviously scale should be one). It appears that
> setting the scale factor to zero is acceptable, no exception (arbitrary
> choice which makes sense for the general SetParameters method – up to the
> user to make sure the parameter values make sense).
>
>
>
> The feature/bug I am referring to has to do with the GetInverse method
> (ill-defined for this degenerate case):
>
>
>
> 2D case -  when I print the original transformation, it is identified as
> singular. When I invoke the GetInverse method vnl generates a warning with
> the resulting “inverse” transform including Nan and Inf , not identified as
> singular.
>
>
>
> 3D case -  when I print the original transformation, it is identified as
> singular. When I invoke the GetInverse method there is no warning and the
> “inverse” transform has numbers and is identified as singular.
>
>
>
> Is this behavior fine and up to the user to deal with? Should the
> GetInverse generate an exception?
>
>         thanks
>
>              Ziv
>
>
>
> Code for the two cases below:
>
>
>
>     {
>
>     typedef itk::Similarity3DTransform<double> TransformType3D;
>
>     // Test degenerate parameter settings
>
>     TransformType3D::Pointer t1 = TransformType3D::New();
>
>     TransformType3D::Pointer t1Inverse = TransformType3D::New();
>
>
>
>     // Set parameters
>
>     TransformType3D::ParametersType parameters(
> t1->GetNumberOfParameters() );
>
>     // Degenerate configuration with zero scale
>
>     parameters[0] = 1.0;
>
>     parameters[1] = 0.0;
>
>     parameters[2] = 0.0;
>
>     parameters[3] = 1.0;
>
>     parameters[4] = 2.0;
>
>     parameters[5] = 3.0;
>
>     parameters[6] = 0.0; //scale
>
>
>
>     t1->SetParameters( parameters );
>
>     t1Inverse->SetParameters(parameters);
>
>
>
>     t1->GetInverse( t1Inverse );
>
>     std::cout<< "**original**\n"<<t1;
>
>     std::cout<< "**inverse**\n"<<t1Inverse<<"\n";
>
>     }
>
>
>
>     {
>
>     // Test degenerate parameter settings
>
>     typedef itk::CenteredSimilarity2DTransform<double> TransformType2D;
>
>     TransformType2D::Pointer t1 = TransformType2D::New();
>
>     TransformType2D::Pointer t1Inverse = TransformType2D::New();
>
>
>
>     // Set parameters
>
>     TransformType2D::ParametersType parameters(
> t1->GetNumberOfParameters() );
>
>     // Degenerate configuration with zero scale
>
>     parameters[0] = 0.0; //scale
>
>     parameters[1] = -21.0 / 180.0 * itk::Math::pi;
>
>     parameters[2] = 12.0;
>
>     parameters[3] = -8.9;
>
>     parameters[4] = 67.8;
>
>     parameters[5] = -0.2;
>
>
>
>     t1->SetParameters( parameters );
>
>     t1->GetInverse( t1Inverse );
>
>     std::cout<< "**original**\n"<<t1;
>
>     std::cout<< "**inverse**\n"<<t1Inverse<<"\n";
>
>     }
>
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170918/18716542/attachment.html>


More information about the Community mailing list