| 519 | } |
| 520 | |
| 521 | mitk::BoundingBox::Pointer mitk::DataStorage::ComputeBoundingBox(const char *boolPropertyKey, |
| 522 | const BaseRenderer *renderer, |
| 523 | const char *boolPropertyKey2) |
| 524 | { |
| 525 | BoundingBox::PointsContainer::Pointer pointscontainer = BoundingBox::PointsContainer::New(); |
| 526 | |
| 527 | BoundingBox::PointIdentifier pointid = 0; |
| 528 | Point3D point; |
| 529 | |
| 530 | // Needed for check of zero bounding boxes |
| 531 | ScalarType nullpoint[] = {0, 0, 0, 0, 0, 0}; |
| 532 | BoundingBox::BoundsArrayType itkBoundsZero(nullpoint); |
| 533 | |
| 534 | SetOfObjects::ConstPointer all = this->GetAll(); |
| 535 | for (SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it) |
| 536 | { |
| 537 | DataNode::Pointer node = it->Value(); |
| 538 | if ((node.IsNotNull()) && (node->GetData() != nullptr) && (node->GetData()->IsEmpty() == false) && |
| 539 | node->IsOn(boolPropertyKey, renderer) && node->IsOn(boolPropertyKey2, renderer)) |
| 540 | { |
| 541 | const TimeGeometry *geometry = node->GetData()->GetUpdatedTimeGeometry(); |
| 542 | if (geometry != nullptr) |
| 543 | { |
| 544 | // bounding box (only if non-zero) |
| 545 | BoundingBox::BoundsArrayType itkBounds = geometry->GetBoundingBoxInWorld()->GetBounds(); |
| 546 | if (itkBounds == itkBoundsZero) |
| 547 | { |
| 548 | continue; |
| 549 | } |
| 550 | |
| 551 | unsigned char i; |
| 552 | for (i = 0; i < 8; ++i) |
| 553 | { |
| 554 | point = geometry->GetCornerPointInWorld(i); |
| 555 | if (point[0] * point[0] + point[1] * point[1] + point[2] * point[2] < large) |
| 556 | pointscontainer->InsertElement(pointid++, point); |
| 557 | else |
| 558 | { |
| 559 | itkGenericOutputMacro(<< "Unrealistically distant corner point encountered. Ignored. Node: " << node); |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | BoundingBox::Pointer result = BoundingBox::New(); |
| 567 | result->SetPoints(pointscontainer); |
| 568 | result->ComputeBoundingBox(); |
| 569 | |
| 570 | return result; |
| 571 | } |
| 572 | |
| 573 | mitk::TimeBounds mitk::DataStorage::ComputeTimeBounds(const char *boolPropertyKey, |
| 574 | const BaseRenderer *renderer, |