Mercurial > hg > orthanc-stone
diff Framework/Toolbox/LinearAlgebra.cpp @ 949:32eaf4929b08 toa2019081301
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 13 Aug 2019 16:01:05 +0200 |
parents | 61ba4b504e9a |
children | 1f74bc3459ba |
line wrap: on
line diff
--- a/Framework/Toolbox/LinearAlgebra.cpp Sat Aug 10 13:13:11 2019 +0200 +++ b/Framework/Toolbox/LinearAlgebra.cpp Tue Aug 13 16:01:05 2019 +0200 @@ -21,14 +21,18 @@ #include "LinearAlgebra.h" +#include "../StoneException.h" + #include <Core/Logging.h> #include <Core/OrthancException.h> #include <Core/Toolbox.h> -#include <stdio.h> #include <boost/lexical_cast.hpp> #include <boost/numeric/ublas/lu.hpp> +#include <stdio.h> +#include <iostream> + namespace OrthancStone { namespace LinearAlgebra @@ -652,4 +656,38 @@ return m; } } + + std::ostream& operator<<(std::ostream& s, const Vector& vec) + { + s << "("; + for (size_t i = 0; i < vec.size(); ++i) + { + s << vec(i); + if (i < (vec.size() - 1)) + s << ", "; + } + s << ")"; + return s; + } + + std::ostream& operator<<(std::ostream& s, const Matrix& m) + { + ORTHANC_ASSERT(m.size1() == m.size2()); + s << "("; + for (size_t i = 0; i < m.size1(); ++i) + { + s << "("; + for (size_t j = 0; j < m.size2(); ++j) + { + s << m(i,j); + if (j < (m.size2() - 1)) + s << ", "; + } + s << ")"; + if (i < (m.size1() - 1)) + s << ", "; + } + s << ")"; + return s; + } }