| 95 | } |
| 96 | |
| 97 | void SetDirection(mitk::TimeGeometry* tg, py::array_t<double, py::array::c_style | py::array::forcecast> direction, mitk::TimeStepType t) |
| 98 | { |
| 99 | if (direction.ndim() != 2 || direction.shape(0) != 3 || direction.shape(1) != 3) |
| 100 | throw py::value_error("direction must be a 3x3 matrix"); |
| 101 | |
| 102 | auto geom = GetGeometryForTimeStep(tg, t); |
| 103 | auto buf = direction.unchecked<2>(); |
| 104 | const auto spacing = geom->GetSpacing(); |
| 105 | |
| 106 | auto* transform = geom->GetIndexToWorldTransform(); |
| 107 | auto matrix = transform->GetMatrix(); |
| 108 | |
| 109 | for (int row = 0; row < 3; ++row) |
| 110 | for (int col = 0; col < 3; ++col) |
| 111 | matrix[row][col] = buf(row, col) * spacing[col]; |
| 112 | |
| 113 | transform->SetMatrix(matrix); |
| 114 | geom->Modified(); |
| 115 | } |
| 116 | |
| 117 | std::array<double, 9> GetDirectionCosines(const mitk::TimeGeometry* tg, mitk::TimeStepType t) |
| 118 | { |
no test coverage detected