20 #include <vtkLinearTransform.h>
23 : m_BoundingObjects(0), m_Counter(0), m_CSGMode(Union)
26 timeGeometry->Initialize(1);
38 if (this->GetSource())
40 this->GetSource()->UpdateOutputInformation();
44 if (m_BoundingObjects.size() < 1)
49 timeGeometry->Initialize(1);
50 SetTimeGeometry(timeGeometry);
51 GetGeometry()->SetBounds(boundsArray);
52 GetTimeGeometry()->Update();
59 mitk::BoundingBox::PointIdentifier pointid = 0;
64 transform->GetInverse(inverse);
69 for (
unsigned int j = 0; j < m_BoundingObjects.size(); j++)
71 const TimeGeometry *geometry = m_BoundingObjects.at(j)->GetUpdatedTimeGeometry();
73 for (i = 0; i < 8; ++i)
76 if (point[0] * point[0] + point[1] * point[1] + point[2] * point[2] <
mitk::large)
77 pointscontainer->InsertElement(pointid++, point);
80 itkGenericOutputMacro(<<
"Unrealistically distant corner point encountered. Ignored. BoundingObject: "
81 << m_BoundingObjects.at(j));
87 boundingBox->SetPoints(pointscontainer);
88 boundingBox->ComputeBoundingBox();
92 geometry3d->
SetBounds(boundingBox->GetBounds());
97 timeGeometry->Initialize(geometry3d, GetTimeGeometry()->CountTimeSteps());
98 SetTimeGeometry(timeGeometry);
103 if (boundingObject->GetPositive())
104 m_BoundingObjects.push_front(boundingObject);
106 m_BoundingObjects.push_back(boundingObject);
108 UpdateOutputInformation();
113 auto it = m_BoundingObjects.begin();
114 for (
unsigned int i = 0; i < m_BoundingObjects.size(); i++)
116 if (m_BoundingObjects.at(i) == boundingObject)
117 m_BoundingObjects.erase(it);
121 UpdateOutputInformation();
127 bool posInside =
false;
128 bool negInside =
false;
130 for (
unsigned int i = 0; i < m_BoundingObjects.size(); i++)
137 inside = m_BoundingObjects.at(i)->IsInside(p) && inside;
139 i = m_BoundingObjects.size();
147 if (m_BoundingObjects.at(i)->GetPositive())
148 posInside = m_BoundingObjects.at(i)->IsInside(p) || posInside;
150 negInside = m_BoundingObjects.at(i)->IsInside(p) || negInside;
152 if (posInside && !negInside)
161 inside = m_BoundingObjects.at(i)->IsInside(p) || inside;
163 i = m_BoundingObjects.size();
177 return m_Counter > 0;
183 return Superclass::GetGeometry(t);
200 m_BoundingObjects = boundingObjects;
205 return m_BoundingObjects;
virtual ~BoundingObjectGroup()
itk::SmartPointer< Self > Pointer
void SetIndexToWorldTransform(mitk::AffineTransform3D *transform)
mitk::BaseGeometry * GetGeometry(int t=0) const
unsigned int GetCount() const
virtual void SetTimeGeometry(TimeGeometry *geometry)
Set the TimeGeometry of the data, which will be referenced (not copied!).
void RemoveBoundingObject(mitk::BoundingObject::Pointer boundingObject)
void AddBoundingObject(mitk::BoundingObject::Pointer boundingObject)
Point3D GetCornerPointInWorld(int id) const
Get the position of the corner number id (in world coordinates)
virtual bool IsInside(const mitk::Point3D &p) const override
std::deque< mitk::BoundingObject::Pointer > GetBoundingObjects()
virtual void UpdateOutputInformation() override
itk::AffineGeometryFrame< ScalarType, 3 >::TransformType AffineTransform3D
virtual void SetVtkPolyData(vtkPolyData *polydata, unsigned int t=0)
MITKCORE_EXPORT const double large
void SetBounds(const BoundsArrayType &bounds)
Set the bounding box (in index/unit coordinates)
virtual bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
void SetBoundingObjects(const std::deque< mitk::BoundingObject::Pointer > boundingObjects)
BaseGeometry Describes the geometry of a data object.
BoundingBoxType::BoundsArrayType BoundsArrayType
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.