<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Courier New, Courier, monospace">Hi Luis,
and all other list members,<br>
<br>
sorry for making my point a bit unclear. By saying:<br>
<blockquote type="cite">I am using the following parameter values for
Rigid3DTransform:
  <br>
- first 9 rotation parameters are set to 0.1
  <br>
- the three translation parameters are set to 0.001
  <br>
  <br>
And the simplex delta parameter values for the optimizer:
  <br>
- first 9 values set to 5
  <br>
- the last 3 values set to 0 (as there is no translation)
</blockquote>
I did not mean that I am constructing a rotation matrix in the format
you proposed:<br>
<blockquote type="cite">When you set the first 9 parameters of the
transform to 0.1
  <br>
you are construction a rotation Matrix:
  <br>
  <br>
       0.1  0.1  0.1
  <br>
       0.1  0.1  0.1
  <br>
       0.1  0.1  0.1
</blockquote>
What I was actually trying to say is that I am initializing the
optimizer scales of the Rigid3DTransform in the way I mentioned above.
I am using the Amoeba optimizer to create the actual rotation matrix in
all iterations. E.g. the rotation matrix computed by Amoeba that is to
be applied in the first iteration and which fails the orthogonality
test is:<br>
<br>
1.0   0.0                    0.0<br>
0.0   0.996194<u>72026824951</u>    0.0871557<u>36982822418</u><br>
0.0  -0.0871557<u>22081661224</u>   0.996194<u>72026824951</u><br>
<br>
This is supposed to be a -5 degree rotation about the x-axis (the first
step of the Amoeba optimizer). The corresponding rotation matrix should
actually look like this (I highlighted the differences in the matrix
elements calculated by Amoeba and by hand):<br>
<br>
1.0   0.0                    0.0<br>
0.0   </font></font><font size="-1"><font
 face="Courier New, Courier, monospace">0.996194<u>69809174555</u></font></font><font
 size="-1"><font face="Courier New, Courier, monospace">    0.0871557<u>42747658180</u><br>
0.0  -0.0871557<u>42747658180</u>   </font></font><font size="-1"><font
 face="Courier New, Courier, monospace">0.996194<u>69809174555</u></font></font><br>
<font size="-1"><font face="Courier New, Courier, monospace"><br>
Please do note especially the difference between the sin(alpha) at
column 3 row 2 and -sin(alpha) at </font></font><font size="-1"><font
 face="Courier New, Courier, monospace">row 3 column 2</font></font><font
 size="-1"><font face="Courier New, Courier, monospace"> in the
rotation matrix computed by Amoeba.<br>
This difference is one reason why the matrix resulting from multiplying
the rotation matrix with its transposed matrix looks like this:<br>
<br>
1.0   0.0                       0.0<br>
0.0   1.0000000431793548        1.4844458107177161e-008<br>
0.0   1.4844458107177161e-008   1.0000000405819116<br>
<br>
Comparing this matrix to the identity matrix causes the orthogonality
test to fail.<br>
<br>
The question is now:<br>
Why do I get a non-orthogonal rotation matrix from the Amoeba optimizer?</font></font><font
 size="-1"><font face="Courier New, Courier, monospace"></font></font><br>
<blockquote type="cite">If you don't now how to initialize a rotation
matrix, then
  <br>
you should at least use the Transform Initializer class</blockquote>
<tt>Thanks for the hint, I will have a look at it. Although I am not
setting the transformation by hand but using the Amoeba optimizer
instead, as mentioned above.<br>
</tt>
<blockquote type="cite">Another potential way of producing a consistent
  <br>
rotation matrix is to use an itkVersor, set its axis
  <br>
and rotation angle, and then extracts its Matrix.
  <br>
</blockquote>
<font size="-1"><font face="Courier New, Courier, monospace">This would
also be a possibility but I think that my scenario using the Amoeba
optimzer should also work, right?<br>
<br>
Best regards,<br>
Matthias</font></font><br>
Luis Ibanez schrieb:
<blockquote cite="mid:49944DD8.1060605@kitware.com" type="cite"><br>
Hi Mathias,
  <br>
  <br>
A rigid transform necessarily requires an Orthogonal matrix.
  <br>
  <br>
  <br>
If you try to force a non-othogonal matrix into the transform,
  <br>
then the transformation will contain Scaling and Shearing
  <br>
effect, which is something that a Rigid Transform shouldn't
  <br>
include.
  <br>
  <br>
The Rigid Transform class is correctly rejecting your Matrix
  <br>
as an inappropriate input.
  <br>
  <br>
  <br>
When you set the first 9 parameters of the transform to 0.1
  <br>
you are construction a rotation Matrix:
  <br>
  <br>
       0.1  0.1  0.1
  <br>
       0.1  0.1  0.1
  <br>
       0.1  0.1  0.1
  <br>
  <br>
that is obviously non-orthogonal, and therefore
  <br>
it can not be a valid representation of a rotation
  <br>
in 3D space.
  <br>
  <br>
  <br>
If you don't now how to initialize a rotation matrix, then
  <br>
you should at least use the Transform Initializer class, as
  <br>
it is illustrated in the examples:
  <br>
  <br>
  <br>
   Insight/Examples/Registration/
  <br>
                     ImageRegistration12.cxx
  <br>
                     ImageRegistration13.cxx
  <br>
                     ImageRegistration14.cxx
  <br>
                     ImageRegistration6.cxx
  <br>
                     ImageRegistration6o.cxx
  <br>
                     ImageRegistration7.cxx
  <br>
                     ImageRegistration7o.cxx
  <br>
                     ImageRegistration8.cxx
  <br>
                     ImageRegistration9.cxx
  <br>
                     MultiResImageRegistration2.cxx
  <br>
  <br>
  <br>
  <br>
Another potential way of producing a consistent
  <br>
rotation matrix is to use an itkVersor, set its axis
  <br>
and rotation angle, and then extracts its Matrix.
  <br>
  <br>
  <br>
  <br>
    Regards,
  <br>
  <br>
  <br>
  <br>
       Luis
  <br>
  <br>
  <br>
---------------------
  <br>
Matthias Keil wrote:
  <br>
  <blockquote type="cite">Hello,
    <br>
    <br>
with regards to this e-mail to the mailing list which unfortunately did
not get any feedback:
    <br>
    <br>
<a class="moz-txt-link-freetext" href="http://www.nabble.com/funning-observation-regarding-SetMatrix%28%29-in-VersorRigid3DTransform-class--tp20409801p20409801.html">http://www.nabble.com/funning-observation-regarding-SetMatrix%28%29-in-VersorRigid3DTransform-class--tp20409801p20409801.html</a>
    <br>
    <br>
I am writing to the mailing list hoping to get some more insight into
the problem.
    <br>
    <br>
Using Rigid3DTransform and the Amoeba optimizer for registration of 2
volumes (one was manually rotated by 5 degrees around the x axis) seems
to be quite challenging to me. Unfortunately I can't initialize my
registration in a way which makes it compute any iterations. I do get
the error "Attempting to set a non-orthogonal rotation matrix"
mentioned in the subject everytime. As pinpress guessed right, there is
a test for the identity matrix.
    <br>
    <br>
    <blockquote type="cite">My guess is that in ITK library somewhere,
there is a check (e.g., to check
      <br>
if determinant of the matrix is exactly 1, because it is a "rigid"
      <br>
transform), but the tolerance is not set properly which caused the
problem
      <br>
that I experience.
      <br>
    </blockquote>
    <br>
This test is implemented in itkRigid3DTransform.txx line 77.
    <br>
    <br>
I am using the following parameter values for Rigid3DTransform:
    <br>
- first 9 rotation parameters are set to 0.1
    <br>
- the three translation parameters are set to 0.001
    <br>
    <br>
And the simplex delta parameter values for the optimizer:
    <br>
- first 9 values set to 5
    <br>
- the last 3 values set to 0 (as there is no translation)
    <br>
    <br>
My question is now as pinpress already asked
    <br>
    <br>
    <blockquote type="cite">However, is such checking necessary?
      <br>
    </blockquote>
    <br>
Thanks in advance for any help,
    <br>
Matthias
    <br>
    <br>
-- <br>
| Dipl.-Ing. Matthias Keil
    <br>
|
    <br>
| Fraunhofer Institute for Computer Graphics (IGD)
    <br>
| Cognitive Computing &amp; Medical Imaging
    <br>
| Fraunhoferstraße 5, 64283 Darmstadt, Germany
    <br>
|
    <br>
| phone  : +49 6151 155 212
    <br>
| fax    : +49 6151 155 480
    <br>
| mobile : +49 173 5709746
    <br>
| e-mail : <a class="moz-txt-link-abbreviated" href="mailto:matthias.keil@igd.fraunhofer.de">matthias.keil@igd.fraunhofer.de</a>
    <br>
| skype  : matthias.keil.office
    <br>
| web    : <a class="moz-txt-link-freetext" href="http://www.igd.fraunhofer.de/~makeil">http://www.igd.fraunhofer.de/~makeil</a>
    <br>
    <br>
    <br>
------------------------------------------------------------------------
    <br>
    <br>
_____________________________________
    <br>
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
    <br>
    <br>
Visit other Kitware open-source projects at
    <br>
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
    <br>
    <br>
Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>
    <br>
    <br>
Follow this link to subscribe/unsubscribe:
    <br>
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
    <br>
  </blockquote>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
| Dipl.-Ing. Matthias Keil
|
| Fraunhofer Institute for Computer Graphics (IGD)
| Cognitive Computing &amp; Medical Imaging
| Fraunhoferstraße 5, 64283 Darmstadt, Germany
|
| phone  : +49 6151 155 212
| fax    : +49 6151 155 480
| mobile : +49 173 5709746
| e-mail : <a class="moz-txt-link-abbreviated" href="mailto:matthias.keil@igd.fraunhofer.de">matthias.keil@igd.fraunhofer.de</a>
| skype  : matthias.keil.office
| web    : <a class="moz-txt-link-freetext" href="http://www.igd.fraunhofer.de/~makeil">http://www.igd.fraunhofer.de/~makeil</a></pre>
</body>
</html>