<div dir="ltr"><div><div><div><div><div><div><br><br></div>Hi all, <br><br></div>I want to store a 3D rotation matrix that I have computed in some format that itk can understand (and use to transform points and images, not to as the starting point of any optimization process). The problem is that the matrix is not "as orthogonal as it should be" due to numerical problems:<br></div><br><br></div><div>So far I am using the Rigid3DTransform which looks the best way to go (but am willing to change if this is wrong). The numerical problems express like this:<br></div><div><br></div>1) if I use the "MatrixIsOrthogonal(,)" function I get a "yes" for a 1e-5 tolerance but not for the default "1e-10" tolerance.<br></div>2) Consequently, if I use the SetMatrix() function I get an exception.<br><br></div>I am pretty confident that I can get away with what I need to do if I convince the class to just swallow the "not very orthogonal" matrix (by using a less restrictive tolerance). I have seen that there exists a function to do just that but I am having problems using it. <br><br>Specifically, I cannot seem to access the <br><div><div><div><div><div><div><div><br><div>itk::Rigid3DTransform< TScalar >::SetMatrix     (const MatrixType &      matrix, double      tolerance      )      function <br><br>From the Rigid3D transform class. <br><br>Consequently, the following code returns a compilation error : <br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">error: no matching function for call to ‘itk::Rigid3DTransform<double>::SetMatrix(smallMatrixType&, double)’<br>XXXXXXXXXXXX: note: candidate is:<br>PATH/Code/Common/itkRigid3DTransform.txx:93:1: note: void itk::Rigid3DTransform<TScalarType>::SetMatrix(const MatrixType&) [with TScalarType = double, itk::Rigid3DTransform<TScalarType>::MatrixType = itk::Matrix<double, 3u, 3u>]<br>PATH/Code/Common/itkRigid3DTransform.txx:93:1: note:   candidate expects 1 argument, 2 provided<br></blockquote><br>I have checked that the itkRigid3DTransform.txx file has indeed only the definition of the 
setmatrix method with one parameter.<br><br></div><div>I assume I am looking for the setmatrix function with two parameters "in the wrong place", but have not yet managed to find the right one, any ideas?<br></div><div><br><br></div><div>Here is the detailed code <br></div><div><br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">typedef itk::Matrix<double, 3, 3> smallMatrixType;<br>smallMatrixType auxMatrix;<br><br></blockquote></div><blockquote>// matrix initialization, matrix M1 is orthogonal but I have numerical problems<br></blockquote><div><blockquote>auxMatrix[0][0]=M1[0][0];<br>auxMatrix[0][1]=M1[0][1];<br>auxMatrix[0][2]=M1[0][2];<br>auxMatrix[1][0]=M1[1][0];<br>auxMatrix[1][1]=M1[1][1];<br>auxMatrix[1][2]=M1[1][2];<br>auxMatrix[2][0]=M1[2][0];<br>auxMatrix[2][1]=M1[2][1];<br>auxMatrix[2][2]=M1[2][2];<br><br><br>typedef itk::Rigid3DTransform<double>  TransformType;<br>TransformType::Pointer  rotation = TransformType::New();<br><br>// rotation->MatrixIsOrthogonal(auxMatrix,1e-10) outputs 0, but rotation->MatrixIsOrthogonal(auxMatrix,1e-5) outputs 1<br><br>rotation->SetMatrix(auxMatrix,1e-5); // this produces a compilation error<br><br><br>//rotation->SetMatrix(auxMatrix); // THIS RESULTS IN AN EXCEPTION: itk::ERROR: Rigid3DTransform(0x1dec800): Attempting to set a non-orthogonal rotation matrix<br></blockquote><div><br>Thanks you very much for any help that you can provide.<br></div><div><br><br><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Yago Diez Donoso (PhD)<br>Computer Vision and Robotics Group <a href="http://vicorob.udg.es/" target="_blank">http://vicorob.udg.es/</a><br>E-mail: <a href="mailto:yago@eia.udg.es" target="_blank">yago@eia.udg.es</a>; <a href="mailto:yagodiezdonoso@gmail.com" target="_blank">yagodiezdonoso@gmail.com</a><br>Phone: (int. code) 34 972418013<br>University of Girona </div></div></div>
</div></div></div></div></div></div></div></div></div></div>