<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Arial;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello ITK developers,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I encountered unexpected behavior with ITK parameter settings in degenerate cases for the CenteredSimilarity2DTransform and Similarity3DTransform classes.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The feature/bug I am referring to has to do with the GetInverse method (ill-defined for this degenerate case):
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this behavior fine and up to the user to deal with? Should the GetInverse generate an exception?</p>
<p class="MsoNormal"></p>
<p class="MsoNormal">        thanks</p>
<p class="MsoNormal">             Ziv</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Code for the two cases below:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    {<o:p></o:p></p>
<p class="MsoNormal">    typedef itk::Similarity3DTransform<double> TransformType3D;<o:p></o:p></p>
<p class="MsoNormal">    // Test degenerate parameter settings<o:p></o:p></p>
<p class="MsoNormal">    TransformType3D::Pointer t1 = TransformType3D::New();<o:p></o:p></p>
<p class="MsoNormal">    TransformType3D::Pointer t1Inverse = TransformType3D::New();<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    // Set parameters<o:p></o:p></p>
<p class="MsoNormal">    TransformType3D::ParametersType parameters( t1->GetNumberOfParameters() );<o:p></o:p></p>
<p class="MsoNormal">    // Degenerate configuration with zero scale<o:p></o:p></p>
<p class="MsoNormal">    parameters[0] = 1.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[1] = 0.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[2] = 0.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[3] = 1.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[4] = 2.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[5] = 3.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[6] = 0.0; //scale<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    t1->SetParameters( parameters );<o:p></o:p></p>
<p class="MsoNormal">    t1Inverse->SetParameters(parameters);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    t1->GetInverse( t1Inverse );<o:p></o:p></p>
<p class="MsoNormal">    std::cout<< "**original**\n"<<t1;<o:p></o:p></p>
<p class="MsoNormal">    std::cout<< "**inverse**\n"<<t1Inverse<<"\n";<o:p></o:p></p>
<p class="MsoNormal">    }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    {<o:p></o:p></p>
<p class="MsoNormal">    // Test degenerate parameter settings<o:p></o:p></p>
<p class="MsoNormal">    typedef itk::CenteredSimilarity2DTransform<double> TransformType2D;<o:p></o:p></p>
<p class="MsoNormal">    TransformType2D::Pointer t1 = TransformType2D::New();<o:p></o:p></p>
<p class="MsoNormal">    TransformType2D::Pointer t1Inverse = TransformType2D::New();<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    // Set parameters<o:p></o:p></p>
<p class="MsoNormal">    TransformType2D::ParametersType parameters( t1->GetNumberOfParameters() );<o:p></o:p></p>
<p class="MsoNormal">    // Degenerate configuration with zero scale<o:p></o:p></p>
<p class="MsoNormal">    parameters[0] = 0.0; //scale<o:p></o:p></p>
<p class="MsoNormal">    parameters[1] = -21.0 / 180.0 * itk::Math::pi;<o:p></o:p></p>
<p class="MsoNormal">    parameters[2] = 12.0;<o:p></o:p></p>
<p class="MsoNormal">    parameters[3] = -8.9;<o:p></o:p></p>
<p class="MsoNormal">    parameters[4] = 67.8;<o:p></o:p></p>
<p class="MsoNormal">    parameters[5] = -0.2;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    t1->SetParameters( parameters );<o:p></o:p></p>
<p class="MsoNormal">    t1->GetInverse( t1Inverse );<o:p></o:p></p>
<p class="MsoNormal">    std::cout<< "**original**\n"<<t1;<o:p></o:p></p>
<p class="MsoNormal">    std::cout<< "**inverse**\n"<<t1Inverse<<"\n";<o:p></o:p></p>
<p class="MsoNormal">    }</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>