| 392 | } |
| 393 | |
| 394 | bool mitk::BaseGeometry::IsIndexInside(const mitk::Point3D &index) const |
| 395 | { |
| 396 | bool inside = false; |
| 397 | // if it is an image geometry, we need to convert the index to discrete values |
| 398 | // this is done by applying the rounding function also used in WorldToIndex (see line 323) |
| 399 | if (m_ImageGeometry) |
| 400 | { |
| 401 | mitk::Point3D discretIndex; |
| 402 | discretIndex[0] = itk::Math::RoundHalfIntegerUp<mitk::ScalarType>(index[0]); |
| 403 | discretIndex[1] = itk::Math::RoundHalfIntegerUp<mitk::ScalarType>(index[1]); |
| 404 | discretIndex[2] = itk::Math::RoundHalfIntegerUp<mitk::ScalarType>(index[2]); |
| 405 | |
| 406 | inside = this->GetBoundingBox()->IsInside(discretIndex); |
| 407 | // we have to check if the index is at the upper border of each dimension, |
| 408 | // because the boundingbox is not centerbased |
| 409 | if (inside) |
| 410 | { |
| 411 | const BoundingBox::BoundsArrayType &bounds = this->GetBoundingBox()->GetBounds(); |
| 412 | if ((discretIndex[0] == bounds[1]) || (discretIndex[1] == bounds[3]) || (discretIndex[2] == bounds[5])) |
| 413 | inside = false; |
| 414 | } |
| 415 | } |
| 416 | else |
| 417 | inside = this->GetBoundingBox()->IsInside(index); |
| 418 | |
| 419 | return inside; |
| 420 | } |
| 421 | |
| 422 | mitk::Point3D mitk::BaseGeometry::ClampPoint(const Point3D& point) const |
| 423 | { |