[ITK-users] cannot acces virtual void itk::Rigid3DTransform< TScalar >::SetMatrix (const MatrixType & matrix, double tolerance ) from the Rigid3D transform class.
Yago Diez
yagodiezdonoso at gmail.com
Fri Feb 6 14:32:47 EST 2015
Hi all,
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:
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:
1) if I use the "MatrixIsOrthogonal(,)" function I get a "yes" for a 1e-5
tolerance but not for the default "1e-10" tolerance.
2) Consequently, if I use the SetMatrix() function I get an exception.
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.
Specifically, I cannot seem to access the
itk::Rigid3DTransform< TScalar >::SetMatrix (const MatrixType &
matrix, double tolerance ) function
>From the Rigid3D transform class.
Consequently, the following code returns a compilation error :
error: no matching function for call to
> ‘itk::Rigid3DTransform<double>::SetMatrix(smallMatrixType&, double)’
> XXXXXXXXXXXX: note: candidate is:
> 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>]
> PATH/Code/Common/itkRigid3DTransform.txx:93:1: note: candidate expects 1
> argument, 2 provided
>
I have checked that the itkRigid3DTransform.txx file has indeed only the
definition of the setmatrix method with one parameter.
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?
Here is the detailed code
typedef itk::Matrix<double, 3, 3> smallMatrixType;
> smallMatrixType auxMatrix;
>
> // matrix initialization, matrix M1 is orthogonal but I have numerical
problems
auxMatrix[0][0]=M1[0][0];
auxMatrix[0][1]=M1[0][1];
auxMatrix[0][2]=M1[0][2];
auxMatrix[1][0]=M1[1][0];
auxMatrix[1][1]=M1[1][1];
auxMatrix[1][2]=M1[1][2];
auxMatrix[2][0]=M1[2][0];
auxMatrix[2][1]=M1[2][1];
auxMatrix[2][2]=M1[2][2];
typedef itk::Rigid3DTransform<double> TransformType;
TransformType::Pointer rotation = TransformType::New();
// rotation->MatrixIsOrthogonal(auxMatrix,1e-10) outputs 0, but
rotation->MatrixIsOrthogonal(auxMatrix,1e-5) outputs 1
rotation->SetMatrix(auxMatrix,1e-5); // this produces a compilation error
//rotation->SetMatrix(auxMatrix); // THIS RESULTS IN AN EXCEPTION:
itk::ERROR: Rigid3DTransform(0x1dec800): Attempting to set a non-orthogonal
rotation matrix
Thanks you very much for any help that you can provide.
Yago Diez Donoso (PhD)
Computer Vision and Robotics Group http://vicorob.udg.es/
E-mail: yago at eia.udg.es; yagodiezdonoso at gmail.com
Phone: (int. code) 34 972418013
University of Girona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150206/9e8dfc7d/attachment.html>
More information about the Insight-users
mailing list