BioMedIA / MIRTK

The Medical Image Registration ToolKit (MIRTK), the successor of the IRTK, contains common CMake build configuration files, core libraries, and basic command-line tools. Extension packages are hosted by the MIRTK GitHub group at
https://github.com/MIRTK
Apache License 2.0
186 stars 71 forks source link

Singularity tolerance seems too large in Modules/Numerics/src/Matrix.cc #758

Open jcupitt opened 3 years ago

jcupitt commented 3 years ago

I had problems with average-dofs reporting a singular matrix in MatrixToAffineParameters.

I checked with a debugger and the matrix values were fine, just rather small for my data, eg. 0.0005 etc. I added a couple more zeros to TOL and everything seems OK again.

https://github.com/BioMedIA/MIRTK/blob/master/Modules/Numerics/src/Matrix.cc#L1452

void MatrixToAffineParameters(const Matrix &m,
                              double &tx,  double &ty,  double &tz,
                              double &rx,  double &ry,  double &rz,
                              double &sx,  double &sy,  double &sz,
                              double &sxy, double &sxz, double &syz)
{
  const double TOL = 0.000001;
  double tansxy, tansxz, tansyz;

There are plenty of other TOLs in that file, it might make sense to revise some other too.