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

Method UpdateOutputInformation

Modules/DataTypesExt/src/mitkBoundingObjectGroup.cpp:32–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void mitk::BoundingObjectGroup::UpdateOutputInformation()
33{
34 if (this->GetSource())
35 {
36 this->GetSource()->UpdateOutputInformation();
37 }
38
39 // calculate global bounding box
40 if (m_BoundingObjects.size() < 1) // if there is no BoundingObject, the bounding box is zero
41 {
42 mitk::BoundingBox::BoundsArrayType boundsArray;
43 boundsArray.Fill(0);
44 ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
45 timeGeometry->Initialize(1);
46 SetTimeGeometry(timeGeometry);
47 GetGeometry()->SetBounds(boundsArray);
48 GetTimeGeometry()->Update();
49 return;
50 }
51
52 // initialize container
53 mitk::BoundingBox::PointsContainer::Pointer pointscontainer = mitk::BoundingBox::PointsContainer::New();
54
55 mitk::BoundingBox::PointIdentifier pointid = 0;
56 mitk::Point3D point;
57
58 mitk::AffineTransform3D *transform = GetGeometry()->GetIndexToWorldTransform();
59 mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
60 transform->GetInverse(inverse);
61
62 // calculate a bounding box that includes all BoundingObjects
63 // \todo probably we should do this additionally for each time-step
64 // while (boundingObjectsIterator != boundingObjectsIteratorEnd)
65 for (unsigned int j = 0; j < m_BoundingObjects.size(); j++)
66 {
67 const TimeGeometry *geometry = m_BoundingObjects.at(j)->GetUpdatedTimeGeometry();
68 unsigned char i;
69 for (i = 0; i < 8; ++i)
70 {
71 point = inverse->TransformPoint(geometry->GetCornerPointInWorld(i));
72 if (point[0] * point[0] + point[1] * point[1] + point[2] * point[2] < mitk::large)
73 pointscontainer->InsertElement(pointid++, point);
74 else
75 {
76 itkGenericOutputMacro(<< "Unrealistically distant corner point encountered. Ignored. BoundingObject: "
77 << m_BoundingObjects.at(j));
78 }
79 }
80 }
81
82 mitk::BoundingBox::Pointer boundingBox = mitk::BoundingBox::New();
83 boundingBox->SetPoints(pointscontainer);
84 boundingBox->ComputeBoundingBox();
85
86 BaseGeometry *geometry3d = GetGeometry(0);
87 geometry3d->SetIndexToWorldTransform(transform);
88 geometry3d->SetBounds(boundingBox->GetBounds());
89 /* the objects position is the center of all sub bounding objects */

Callers 4

DeformObjectMethod · 0.45
InitTranslateMethod · 0.45
InitRotateMethod · 0.45
InitMembersMethod · 0.45

Calls 15

GetGeometryFunction · 0.85
atMethod · 0.80
TransformPointMethod · 0.80
GetCornerPointInWorldMethod · 0.80
ComputeBoundingBoxMethod · 0.80
NewFunction · 0.50
GetTimeGeometryFunction · 0.50
GetSourceMethod · 0.45
sizeMethod · 0.45
FillMethod · 0.45
InitializeMethod · 0.45
SetBoundsMethod · 0.45

Tested by

no test coverage detected