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

Method SetGeometry

Modules/QtWidgets/src/QmitkRenderWindowUtilityWidget.cpp:186–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void QmitkRenderWindowUtilityWidget::SetGeometry(const itk::EventObject& event)
187{
188 if (!mitk::SliceNavigationController::GeometrySendEvent(nullptr, 0).CheckEvent(&event))
189 {
190 return;
191 }
192
193 const auto* sliceNavigationController = m_BaseRenderer->GetSliceNavigationController();
194 auto viewDirection = sliceNavigationController->GetViewDirection();
195 unsigned int axis = 0;
196 switch (viewDirection)
197 {
198 case mitk::AnatomicalPlane::Original:
199 return;
200 case mitk::AnatomicalPlane::Axial:
201 {
202 axis = 2;
203 break;
204 }
205 case mitk::AnatomicalPlane::Coronal:
206 {
207 axis = 1;
208 break;
209 }
210 case mitk::AnatomicalPlane::Sagittal:
211 {
212 axis = 0;
213 break;
214 }
215 }
216
217 const auto* inputTimeGeometry = sliceNavigationController->GetInputWorldTimeGeometry();
218 const mitk::BaseGeometry* rendererGeometry = m_BaseRenderer->GetCurrentWorldGeometry();
219
220 mitk::TimeStepType timeStep = sliceNavigationController->GetStepper()->GetPos();
221 mitk::BaseGeometry::ConstPointer geometry = inputTimeGeometry->GetGeometryForTimeStep(timeStep);
222 if (geometry == nullptr)
223 return;
224
225 mitk::AffineTransform3D::MatrixType matrix = geometry->GetIndexToWorldTransform()->GetMatrix();
226 matrix.GetVnlMatrix().normalize_columns();
227 mitk::AffineTransform3D::MatrixType::InternalMatrixType inverseMatrix = matrix.GetInverse();
228
229 int dominantAxis = itk::Function::Max3(inverseMatrix[0][axis], inverseMatrix[1][axis], inverseMatrix[2][axis]);
230
231 bool referenceGeometryAxisInverted = inverseMatrix[dominantAxis][axis] < 0;
232 bool rendererZAxisInverted = rendererGeometry->GetAxisVector(2)[axis] < 0;
233
234 m_SliceNavigationWidget->SetInverseDirection(referenceGeometryAxisInverted != rendererZAxisInverted);
235}
236
237void QmitkRenderWindowUtilityWidget::ChangeViewDirection(const QString& viewDirection)
238{

Callers

nothing calls this directly

Calls 10

GetStepperMethod · 0.80
GetMatrixMethod · 0.80
GetVnlMatrixMethod · 0.80
GetAxisVectorMethod · 0.80
SetInverseDirectionMethod · 0.80
CheckEventMethod · 0.45
GetPosMethod · 0.45

Tested by

no test coverage detected