Skip to content

Commit

Permalink
Minor tweaks to DWI metadata handling changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lestropie committed Oct 3, 2024
1 parent 2be257c commit b1caea0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
5 changes: 3 additions & 2 deletions core/axes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 1 addition & 7 deletions core/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -811,11 +812,4 @@ namespace MR



Header::Realignment::Realignment() {
applied_transform_.matrix().fill(0);
orig_transform_.matrix().fill(std::numeric_limits<default_type>::signaling_NaN());
}



}
4 changes: 3 additions & 1 deletion core/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, 3, 3>;
Realignment();
Realignment() :
orig_transform_ (Eigen::Matrix<default_type,3,4>::Constant(std::numeric_limits<default_type>::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; }
Expand Down
1 change: 0 additions & 1 deletion core/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down

0 comments on commit b1caea0

Please sign in to comment.