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

Method ClampPoint

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

Source from the content-addressed store, hash-verified

420}
421
422mitk::Point3D mitk::BaseGeometry::ClampPoint(const Point3D& point) const
423{
424 if (this->IsInside(point))
425 return point;
426
427 auto origin = this->GetOrigin();
428
429 if (this->GetImageGeometry())
430 origin -= this->GetSpacing() * 0.5;
431
432 Point3D clampedPoint;
433
434 for (int i = 0; i < 3; ++i)
435 clampedPoint[i] = std::max(origin[i], std::min(point[i], origin[i] + this->GetExtentInMM(i)));
436
437 return clampedPoint;
438}
439
440void mitk::BaseGeometry::WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
441{

Callers 1

MovePointMethod · 0.80

Calls 4

IsInsideMethod · 0.95
GetOriginMethod · 0.95
GetSpacingMethod · 0.95
GetExtentInMMMethod · 0.95

Tested by

no test coverage detected