diff --git a/core/axes.cpp b/core/axes.cpp index 1724b661a3..0ab6cc3503 100644 --- a/core/axes.cpp +++ b/core/axes.cpp @@ -25,7 +25,7 @@ namespace MR Shuffle get_shuffle_to_make_RAS(const transform_type &T) { Shuffle result; - result.permutations = closest(T.matrix().topLeftCorner<3, 3>()); + result.permutations = closest(T.linear()); // Figure out whether any of the rows of the transform point in the // opposite direction to the MRtrix convention result.flips[result.permutations[0]] = T(0, result.permutations[0]) < 0.0; @@ -37,7 +37,7 @@ namespace MR permutations_type closest(const Eigen::Matrix3d &M) { - permutations_type result{3, 3, 3}; + permutations_type result{-1, -1, -1}; // Find which row of the transform is closest to each scanner axis Eigen::Matrix3d::Index index(0); @@ -67,6 +67,7 @@ namespace MR if (result[1] == result[2]) result[2] = not_any_of (result[0], result[1]); assert (result[0] != result[1] && result[1] != result[2] && result[2] != result[0]); + assert (std::min(result.begin(), result.end()) == 0); return result; } diff --git a/core/header.cpp b/core/header.cpp index 24408db1cb..ef63ae7235 100644 --- a/core/header.cpp +++ b/core/header.cpp @@ -21,6 +21,7 @@ #include "app.h" #include "axes.h" +#include "math/math.h" #include "mrtrix.h" #include "metadata/phase_encoding.h" #include "metadata/slice_encoding.h" @@ -811,11 +812,4 @@ namespace MR - Header::Realignment::Realignment() { - applied_transform_.matrix().fill(0); - orig_transform_.matrix().fill(std::numeric_limits::signaling_NaN()); - } - - - } diff --git a/core/header.h b/core/header.h index 9a85a437b8..313046feec 100644 --- a/core/header.h +++ b/core/header.h @@ -213,7 +213,9 @@ namespace MR // therefore can store as integer // TODO Calculate translations; turn into affine transform; verify using applied_transform_type = Eigen::Matrix; - Realignment(); + Realignment() : + orig_transform_ (Eigen::Matrix::Constant(std::numeric_limits::signaling_NaN())), + applied_transform_ (applied_transform_type::Constant(0)) {} bool is_identity() const { return shuffle_.is_identity(); } bool valid() const { return shuffle_.valid(); } const Axes::permutations_type& permutations() const { return shuffle_.permutations; } diff --git a/core/image.h b/core/image.h index d628c0d786..3dbb3aab6a 100644 --- a/core/image.h +++ b/core/image.h @@ -61,7 +61,6 @@ namespace MR FORCE_INLINE const std::string& name() const { return buffer->name(); } FORCE_INLINE const transform_type& transform() const { return buffer->transform(); } - //FORCE_INLINE const Header::Realignment& realignment() const { return buffer->realignment(); } FORCE_INLINE size_t ndim () const { return buffer->ndim(); } FORCE_INLINE ssize_t size (size_t axis) const { return buffer->size (axis); }