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

Method IsIndexInside

Modules/Core/src/DataManagement/mitkBaseGeometry.cpp:394–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394bool 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
422mitk::Point3D mitk::BaseGeometry::ClampPoint(const Point3D& point) const
423{

Callers 5

GenerateDataMethod · 0.80
OnMousePressedMethod · 0.80
TestIsInsideMethod · 0.80
IsSubGeometryMethod · 0.80
InitBaseGeometryFunction · 0.80

Calls 3

IsInsideMethod · 0.45
GetBoundingBoxMethod · 0.45
GetBoundsMethod · 0.45

Tested by 1

TestIsInsideMethod · 0.64