Hello Michiel,<br><br>perhaps you could use a const Matrix object after all, since it looks to me that FinalRotation is first built with image->GetDirection() but this value is not actually used, and that the signature of itk::Image's is SetDirection(const DirectionType direction).<br>
<br>So here you are, my quickly written proposal (caution, I haven't compiled it):<br><br><div class="gmail_quote"> float angleX, angleY, angleZ;<br> angleX = angleY = angleZ = 5;<br><br> const double cx = vcl_cos(angleX);<br>
const double sx = vcl_sin(angleX);<div class="im"> <br> typedef itk::Matrix<double,3,3> Matrix;<br> Matrix RotationX;<br></div> <span style="background-color: rgb(255, 204, 204);">// Matrix FinalRotation = image->GetDirection(); -- Commented now <br>
</span><div class="im"><br> RotationX[0][0] = 1; RotationX[0][1] = 0; RotationX[0][2] = 0; <br> RotationX[1][0] = 0; RotationX[1][1] = cx; RotationX[1][2] = sx; <br>
RotationX[2][0] = 0; RotationX[2][1] = -sx; RotationX[2][2] = cx;<br><br></div> <span style="background-color: rgb(255, 255, 153);">const Matrix FinalRotation = direction*RotationX;</span><br><br> std::cout << "image->GetDirection(): " << std::endl << image->GetDirection() << std::endl;<br>
std::cout << "RotationX: " << std::endl << RotationX << std::endl;<br> std::cout << "FinalRotation: " << std::endl << FinalRotation << std::endl;<br>
<br>
image->SetDirection(FinalRotation);<br><br> std::cout << "image->GetDirection(): " << std::endl << image->GetDirection() << std::endl;<br><br>Cheers,<br><br>Frederic<br></div>
<br><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>