Dear Luis,<br><br>thank you for your reply, now I understand what is meant!<br><br>Direction is from an image:<br><br>  const ImageType::DirectionType &amp; direction = image-&gt;GetDirection();<br><br>I&#39;m trying to rotate the image by just changing the direction matrix of the image.<br>

<br>Unfortunately, when I just leave out &#39;const&#39; from that line, the compiler complains<br>that it&#39;s not the same type as expected.<br><br>Maybe I should just create a new matrix, copy the value of image-&gt;GetDirection()<br>

into it, apply the rotation, and use image-&gt;SetDirection()?<br><br>cheers, Michael<br><br><br><div class="gmail_quote">On Mon, Mar 29, 2010 at 11:04 PM, Luis Ibanez <span dir="ltr">&lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Michiel,<br>
<br>
<br>
It is excellent that you are diving into the code<br>
looking for deeper understanding !<br>
<br>
<br>
The message that you get indicates that you are<br>
attempting to change the value of a variable that<br>
has been declared &quot;const&quot; previously.<br>
<br>
The &quot;const&quot; declaration is a promise made to the<br>
compiler, stating that you will not change the value<br>
of that variable.<br>
<br>
When the compiler catch you breaking that promise,<br>
it get angry at you and gives you the error message:<br>
<br>
&quot;error: passing ‘const   X to  Z discards qualifiers&quot;<br>
<br>
<br>
Where the &quot;qualifier&quot; refers to the &quot;const&quot; property<br>
of that variable.<br>
<br>
<br>
The error message indicates that you are calling<br>
the operator=() method on a const matrix (as left<br>
argument of the = ).<br>
<br>
<br>
You did so, with an expression such as:<br>
<br>
<br>
  const MatrixType  myConstMatrixThatWillNeverChange;<br>
<br>
  myConstMatrixThatWillNeverChange = anotherMatrix;<br>
<br>
<br>
This may also happens implicitly if the matrix<br>
happens to be a member variable of a class,<br>
and you attempt to do such assignment inside<br>
a &quot;const&quot; method of the class.<br>
<br>
<br>
If you share with use the exact declaration of your<br>
&quot;direction&quot; matrix we could tell you more about how<br>
to get around the problem.<br>
<br>
<br>
       Regards,<br>
<br>
<br>
             Luis<br>
<br>
<br>
<br>
--------------------------------------------------------------------------<br>
<div><div></div><div class="h5">On Mon, Mar 29, 2010 at 12:01 PM, michiel mentink<br>
&lt;<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>&gt; wrote:<br>
&gt;<br>
&gt; In an autodidactic effort, I&#39;m trying to rotate an image by &#39;hand&#39;, by<br>
&gt; multiplying the &#39;direction&#39; matrix of an image by a rotation matrix.<br>
&gt;<br>
&gt; To do that, I&#39;m copying bits out of itkEuler3DTransform.txx<br>
&gt; In that file, a RotationX matrix is defined:<br>
&gt;<br>
&gt; Matrix&lt;TScalarType,3,3&gt; RotationX<br>
&gt;<br>
&gt; However, when I try doing that, I&#39;m getting the following error:<br>
&gt;<br>
&gt; error: passing ‘const itk::Matrix&lt;double, 3u, 3u&gt;’ as ‘this’ argument of<br>
&gt; ‘const itk::Matrix&lt;T, NRows, NColumns&gt;&amp; itk::Matrix&lt;T, NRows,<br>
&gt; NColumns&gt;::operator=(const itk::Matrix&lt;T, NRows, NColumns&gt;&amp;) [with T =<br>
&gt; double, unsigned int NRows = 3u, unsigned int NColumns = 3u]’ discards<br>
&gt; qualifiers<br>
&gt;<br>
&gt; 1) What does this mean?<br>
&gt; 2) How do I get my beloved Matrix?<br>
&gt;<br>
&gt; #include &lt;itkMatrix.h&gt;<br>
&gt; #include &lt;vnl/vnl_matrix.h&gt;<br>
&gt;<br>
&gt;   typedef itk::Matrix&lt;double,3,3&gt; Matrix;<br>
&gt;<br>
&gt;   Matrix RotationX;<br>
&gt;  // ImageType::DirectionType RotationX;<br>
&gt;<br>
&gt; //  vnl_matrix_fixed&lt;double,3,3&gt; RotationX;<br>
&gt;<br>
&gt;   RotationX[0][0] = 1; RotationX[0][1] =   0; RotationX[0][2] = 0;<br>
&gt;   RotationX[1][0] = 0; RotationX[1][1] =  cx; RotationX[1][2] = sx;<br>
&gt;   RotationX[2][0] = 0; RotationX[2][1] = -sx; RotationX[2][2] = cx;<br>
&gt;<br>
&gt;   direction = direction*RotationX;<br>
&gt;<br>
&gt; cheers,<br>
&gt;<br>
&gt; Michael<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br>