Hi, <br><br>I am running an Affine transform registration in 3D (basically ImageRegistration9.cxx).<br><br>In order to support 3D mode, appart from some obvious changes, I did the following:<br><br>Extend the optimizer scale:<br>
<br>....<br> optimizerScales[0] = 1.0;<br> optimizerScales[1] = 1.0;<br> optimizerScales[2] = 1.0;<br> optimizerScales[3] = 1.0;<br> optimizerScales[4] = 1.0;<br> optimizerScales[5] = 1.0;<br> optimizerScales[6] = 1.0;<br>
optimizerScales[7] = 1.0;<br> optimizerScales[8] = 1.0;<br> optimizerScales[9] = translationScale;<br> optimizerScales[10] = translationScale;<br> optimizerScales[11] = translationScale;<br>...<br><br><br>Get the full set of final parameters to print out <br>
<br>....<br>const double finalRotationCenterX = transform->GetCenter()[0];<br> const double finalRotationCenterY = transform->GetCenter()[1];<br> const double finalRotationCenterZ = transform->GetCenter()[2]; <br>
const double finalTranslationX = finalParameters[9];<br> const double finalTranslationY = finalParameters[10];<br> const double finalTranslationZ = finalParameters[11]; <br>....<br><br>Then I guess I must retrieve the rotation angle by SVD <br>
which I guess it is run on the 3x3 matrix but I do not know in which order I must pick up the value. I am not sure that I got <br>this right but my guess would be: <br><br>(Guess)<br> vnl_matrix<double> p(3, 3);<br>
p[0][0] = (double) finalParameters[0];<br> p[0][1] = (double) finalParameters[1];<br> p[0][2] = (double) finalParameters[2];<br> <br> p[1][0] = (double) finalParameters[3];<br> p[1][1] = (double) finalParameters[4];<br>
p[1][2] = (double) finalParameters[5];<br> <br> p[2][0] = (double) finalParameters[6];<br> p[2][1] = (double) finalParameters[7];<br> p[2][2] = (double) finalParameters[8];<br> <br> <br> vnl_svd<double> svd(p);<br>
vnl_matrix<double> r(3, 3);<br> r = svd.U() * vnl_transpose(svd.V());<br> double angle = asin(r[1][0]);<br> <br> std::cout << " Scale 1 = " << svd.W(0) << std::endl;<br>
std::cout << " Scale 2 = " << svd.W(1) << std::endl;<br> std::cout << " Scale 3 = " << svd.W(3) << std::endl;<br> std::cout << " Angle (degrees) = " << angle * 45.0 / atan(1.0) << std::endl;<br>
<br> <br>Does that make sense ?<br><br>I would appreciate some help on that.<br><br>Thank you <br clear="all"><br>-- <br>Marco G.<br><br>