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

Method CreateBoundingObject

Modules/QtWidgetsExt/src/QmitkBoundingObjectWidget.cpp:319–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void QmitkBoundingObjectWidget::CreateBoundingObject(int type)
320{
321 // get cross position
322 mitk::Point3D pos;
323 mitk::RenderingManager::RenderWindowVector windows =
324 mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
325
326 // hopefully we have the renderwindows in the "normal" order
327 const mitk::PlaneGeometry *plane1 =
328 mitk::BaseRenderer::GetInstance(windows.at(0))->GetSliceNavigationController()->GetCurrentPlaneGeometry();
329 const mitk::PlaneGeometry *plane2 =
330 mitk::BaseRenderer::GetInstance(windows.at(1))->GetSliceNavigationController()->GetCurrentPlaneGeometry();
331 const mitk::PlaneGeometry *plane3 =
332 mitk::BaseRenderer::GetInstance(windows.at(2))->GetSliceNavigationController()->GetCurrentPlaneGeometry();
333
334 mitk::Line3D line;
335 if ((plane1 != nullptr) && (plane2 != nullptr) && (plane1->IntersectionLine(plane2, line)))
336 {
337 if (!((plane3 != nullptr) && (plane3->IntersectionPoint(line, pos))))
338 {
339 return;
340 }
341 }
342
343 if (type != 0)
344 {
345 mitk::BoundingObject::Pointer boundingObject;
346 QString name;
347 name.setNum(m_BoundingObjectCounter);
348
349 switch (type - 1)
350 {
351 case CUBOID:
352 boundingObject = mitk::Cuboid::New();
353 name.prepend("Cube_");
354 break;
355 case CONE:
356 boundingObject = mitk::Cone::New();
357 name.prepend("Cone_");
358 break;
359 case ELLIPSOID:
360 boundingObject = mitk::Ellipsoid::New();
361 name.prepend("Ellipse_");
362 break;
363 case CYLINDER:
364 boundingObject = mitk::Cylinder::New();
365 name.prepend("Cylinder_");
366 break;
367 default:
368 return;
369 break;
370 }
371 m_BoundingObjectCounter++;
372 m_addComboBox->setCurrentIndex(0);
373
374 // set initial size
375 mitk::Vector3D size;
376 size.Fill(10);

Callers

nothing calls this directly

Calls 15

atMethod · 0.80
IntersectionLineMethod · 0.80
IntersectionPointMethod · 0.80
GetGeometryMethod · 0.80
NewFunction · 0.50
FillMethod · 0.45
SetSpacingMethod · 0.45
TranslateMethod · 0.45
UpdateMethod · 0.45
SetDataMethod · 0.45

Tested by

no test coverage detected