23 typedef BoundingBox::PointsContainer ContainerType;
43 assert(m_BoundingBox.IsNotNull());
51 FillVector3D(cornerpoint, bounds[0], bounds[2], bounds[4]);
54 FillVector3D(cornerpoint, bounds[0], bounds[2], bounds[5]);
57 FillVector3D(cornerpoint, bounds[0], bounds[3], bounds[4]);
60 FillVector3D(cornerpoint, bounds[0], bounds[3], bounds[5]);
63 FillVector3D(cornerpoint, bounds[1], bounds[2], bounds[4]);
66 FillVector3D(cornerpoint, bounds[1], bounds[2], bounds[5]);
69 FillVector3D(cornerpoint, bounds[1], bounds[3], bounds[4]);
72 FillVector3D(cornerpoint, bounds[1], bounds[3], bounds[5]);
76 itkExceptionMacro(<<
"A cube only has 8 corners. These are labeled 0-7.");
88 assert(m_BoundingBox.IsNotNull());
92 cornerpoint[0] = (xFront ? bounds[0] : bounds[1]);
93 cornerpoint[1] = (yFront ? bounds[2] : bounds[3]);
94 cornerpoint[2] = (zFront ? bounds[4] : bounds[5]);
101 assert(m_BoundingBox.IsNotNull());
102 return m_BoundingBox->GetCenter();
107 Vector3D diagonalvector = GetCornerPointInWorld() - GetCornerPointInWorld(
false,
false,
false);
108 return diagonalvector.GetSquaredNorm();
113 return sqrt(GetDiagonalLength2InWorld());
118 return m_BoundingBox->IsInside(p);
123 assert(m_BoundingBox.IsNotNull());
124 typedef BoundingBox::PointsContainer ContainerType;
126 unsigned long lastModifiedTime = 0;
127 unsigned long currentModifiedTime = 0;
130 points->reserve(2 * CountTimeSteps());
131 for (
TimeStepType step = 0; step < CountTimeSteps(); ++step)
133 currentModifiedTime = GetGeometryForTimeStep(step)->GetMTime();
134 if (currentModifiedTime > lastModifiedTime)
135 lastModifiedTime = currentModifiedTime;
137 for (
int i = 0; i < 8; ++i)
139 Point3D cornerPoint = GetGeometryForTimeStep(step)->GetCornerPoint(i);
140 points->push_back(cornerPoint);
143 m_BoundingBox->SetPoints(points);
144 m_BoundingBox->ComputeBoundingBox();
145 if (this->GetMTime() < lastModifiedTime)
151 assert(direction < 3);
152 assert(m_BoundingBox.IsNotNull());
154 return bounds[direction * 2 + 1] - bounds[direction * 2];
159 this->UpdateBoundingBox();
160 this->UpdateWithoutBoundingBox();
165 for (
TimeStepType step = 0; step < CountTimeSteps(); ++step)
167 GetGeometryForTimeStep(step)->ExecuteOperation(op);
174 os << indent <<
" TimeSteps: " << this->CountTimeSteps() << std::endl;
177 os << indent <<
" GetGeometryForTimeStep(0): ";
178 if (GetGeometryForTimeStep(0).IsNull())
179 os <<
"NULL" << std::endl;
181 GetGeometryForTimeStep(0)->Print(os, indent);
190 mitkThrow() <<
" Downcast to type " << this->GetNameOfClass() <<
" failed.";
192 rval->m_BoundingBox = m_BoundingBox->DeepCopy();
205 MITK_INFO <<
"[( TimeGeometry )] BoundingBoxInWorld differs.";
207 <<
" : leftHandSide is " << leftHandSide.
GetBoundsInWorld() <<
" and tolerance is " <<
eps;
212 if (!
mitk::Equal(leftHandSide.CountTimeSteps(), rightHandSide.CountTimeSteps(),
eps, verbose))
216 MITK_INFO <<
"[( TimeGeometry )] CountTimeSteps differs.";
217 MITK_INFO <<
"rightHandSide is " << setprecision(12) << rightHandSide.CountTimeSteps() <<
" : leftHandSide is "
218 << leftHandSide.CountTimeSteps() <<
" and tolerance is " <<
eps;
227 MITK_INFO <<
"[( TimeGeometry )] MinimumTimePoint differs.";
238 MITK_INFO <<
"[( TimeGeometry )] MaximumTimePoint differs.";
254 MITK_INFO <<
"[( TimeGeometry )] TimeStepToTimePoint(" << t <<
") differs.";
264 if (leftGeometry.IsNotNull() && rightGeometry.IsNull())
266 if (leftGeometry.IsNull())
270 MITK_INFO <<
"[( TimeGeometry )] TimeStepToTimePoint(" << t <<
") differs.";
271 MITK_INFO <<
"rightHandSide is an object : leftHandSide is nullptr";
277 if (rightGeometry.IsNull())
281 MITK_INFO <<
"[( TimeGeometry )] TimeStepToTimePoint(" << t <<
") differs.";
282 MITK_INFO <<
"rightHandSide is nullptr : leftHandSide is an object";
288 if (!
mitk::Equal(*leftGeometry, *rightGeometry, eps, verbose))
292 MITK_INFO <<
"[( TimeGeometry )] GetGeometryForTimeStep(" << t <<
") differs.";
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
itk::SmartPointer< Self > Pointer
void UpdateBoundingBox()
Updates the bounding box to cover the area used in all time steps.
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
Base class of all Operation-classes.
virtual void Initialize()
Initializes the TimeGeometry.
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override
Point3D GetCornerPointInWorld(int id) const
Get the position of the corner number id (in world coordinates)
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
double GetDiagonalLengthInWorld() const
Get the length of the diagonal of the bounding-box in mm.
virtual void ExecuteOperation(Operation *op) override
Executes the given operation on all time steps.
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const =0
Converts a time step to a time point.
std::vcl_size_t TimeStepType
virtual TimePointType GetMaximumTimePoint() const =0
Returns the last time point for which the object is valid.
Point< ScalarType, 3 > Point3D
Point3D GetCenterInWorld() const
Get the center of the bounding-box in mm.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
ScalarType GetExtentInWorld(unsigned int direction) const
Returns the Extend of the bounding in the given direction.
bool IsWorldPointInside(const mitk::Point3D &p) const
Test whether the point p (world coordinates in mm) is inside the bounding box.
double GetDiagonalLength2InWorld() const
Get the squared length of the diagonal of the bounding-box in mm.
BoundingBox::BoundsArrayType GetBoundsInWorld() const
Returns the world bounds of the object that cover all time steps.
virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const =0
Returns the geometry which corresponds to the given time step.
MITKCORE_EXPORT const ScalarType eps
virtual LightObject::Pointer InternalClone() const override
Makes a deep copy of the current object.
void Update()
Updates the geometry.
virtual TimePointType GetMinimumTimePoint() const =0
Returns the first time point for which the object is valid.
BoundingBox::Pointer m_BoundingBox
Contains a bounding box which includes all time steps.
BoundingBoxType::BoundsArrayType BoundsArrayType
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.