MCPcopy Create free account
hub / github.com/MITK/MITK / ExtractDirection

Function ExtractDirection

Wrapping/Python/mitk/GeometryHelpers.cpp:77–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77py::array_t<double> ExtractDirection(const mitk::BaseGeometry& geom)
78{
79 const auto& matrix = geom.GetIndexToWorldTransform()->GetMatrix();
80 const auto spacing = geom.GetSpacing();
81
82 py::array_t<double> direction({static_cast<py::ssize_t>(3), static_cast<py::ssize_t>(3)});
83 auto buf = direction.mutable_unchecked<2>();
84
85 for (int row = 0; row < 3; ++row)
86 for (int col = 0; col < 3; ++col)
87 buf(row, col) = matrix[row][col] / spacing[col];
88
89 return direction;
90}
91
92py::array_t<double> GetDirection(const mitk::TimeGeometry* tg, mitk::TimeStepType t)
93{

Callers 1

GetDirectionFunction · 0.85

Calls 3

GetMatrixMethod · 0.80
GetSpacingMethod · 0.45

Tested by

no test coverage detected