18 #include <vtkAbstractTransform.h>
27 :
Superclass(other), m_ParametricBoundingBox(other.m_ParametricBoundingBox)
47 return m_ItkVtkAbstractTransform->GetVtkAbstractTransform();
54 itkExceptionMacro(<<
"m_Plane is NULL.");
56 return m_Plane->GetExtentInMM(direction);
61 return m_ItkVtkAbstractTransform;
66 assert(this->IsBoundingBoxNull() ==
false);
70 isInside = Map(pt3d_mm, pt2d_mm);
71 Map(pt2d_mm, projectedPt3d_mm);
82 assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
85 pt3d_units = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
87 return m_Plane->Map(pt3d_units, pt2d_mm);
92 assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
94 m_Plane->Map(pt2d_mm, pt3d_mm);
95 pt3d_mm = m_ItkVtkAbstractTransform->TransformPoint(pt3d_mm);
102 itkExceptionMacro(
"not implemented yet - replace GetIndexToWorldTransform by "
103 "m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()");
104 assert(this->IsBoundingBoxNull() ==
false);
107 vec3d_units = GetIndexToWorldTransform()->GetInverseMatrix() * vec3d_mm;
109 projectedVec3d_mm = GetIndexToWorldTransform()->TransformVector(vec3d_units);
115 for (j = 0; j < 3; ++j)
116 temp[j] = atPt3d_mm[j] - GetIndexToWorldTransform()->GetOffset()[j];
118 for (i = 0; i < 3; ++i)
122 for (j = 0; j < 3; ++j)
123 pt3d_units[i] += GetIndexToWorldTransform()->GetInverseMatrix()[i][j] * temp[j];
126 return const_cast<BoundingBox *
>(this->GetBoundingBox())->IsInside(pt3d_units);
132 MITK_WARN <<
"Need additional point! No standard value defined. Please use Project(const mitk::Point3D & atPt3d_mm, "
133 "const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm). Unfortunatley this one is not "
134 "implemented at the moment. Sorry :(";
135 itkExceptionMacro(
"not implemented yet - replace GetIndexToWorldTransform by "
136 "m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()");
144 assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
149 m_ItkVtkAbstractTransform->GetInverseVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
152 return m_Plane->Map(atPt3d_mm, vec3d_units, vec2d_mm);
159 m_Plane->Map(atPt2d_mm, vec2d_mm, vec3d_mm);
161 Map(atPt2d_mm, atPt3d_mm);
162 float vtkpt[3], vtkvec[3];
165 m_ItkVtkAbstractTransform->GetVtkAbstractTransform()->TransformVectorAtPoint(vtkpt, vtkvec, vtkvec);
171 m_Plane->IndexToWorld(pt_units, pt_mm);
176 m_Plane->WorldToIndex(pt_mm, pt_units);
183 MITK_WARN <<
"Warning! Call of the deprecated function AbstractTransformGeometry::IndexToWorld(point, vec, vec). Use "
184 "AbstractTransformGeometry::IndexToWorld(vec, vec) instead!";
185 this->IndexToWorld(vec_units, vec_mm);
190 m_Plane->IndexToWorld(vec_units, vec_mm);
197 MITK_WARN <<
"Warning! Call of the deprecated function AbstractTransformGeometry::WorldToIndex(point, vec, vec). Use "
198 "AbstractTransformGeometry::WorldToIndex(vec, vec) instead!";
199 this->WorldToIndex(vec_mm, vec_units);
204 m_Plane->WorldToIndex(vec_mm, vec_units);
209 assert((m_ItkVtkAbstractTransform.IsNotNull()) && (m_Plane.IsNotNull()));
212 pt3d_ParametricWorld = m_ItkVtkAbstractTransform->BackTransform(pt3d_mm);
215 ((
BaseGeometry *)m_Plane)->WorldToIndex(pt3d_ParametricWorld, pt3d_ParametricUnits);
217 return (pt3d_ParametricUnits[2] > m_ParametricBoundingBox->GetBounds()[4]);
222 m_ItkVtkAbstractTransform->SetVtkAbstractTransform(aVtkAbstractTransform);
227 if (aPlane !=
nullptr)
233 SetParametricBounds(b);
235 CalculateFrameGeometry();
239 if (m_Plane.IsNull())
248 if ((m_Plane.IsNull()) || (m_FrameGeometry.IsNotNull()))
251 SetBounds(m_Plane->GetBoundingBox()->GetBounds());
256 if ((frameGeometry !=
nullptr) && (frameGeometry->
IsValid()))
259 SetIndexToWorldTransform(m_FrameGeometry->GetIndexToWorldTransform());
260 SetBounds(m_FrameGeometry->GetBounds());
264 m_FrameGeometry =
nullptr;
270 if (Superclass::GetMTime() < m_ItkVtkAbstractTransform->GetMTime())
271 return m_ItkVtkAbstractTransform->GetMTime();
273 return Superclass::GetMTime();
278 if (m_Plane.IsNull())
280 itkExceptionMacro(<<
"m_Plane is not set.");
284 bounds[1] *= oversampling;
285 bounds[3] *= oversampling;
286 bounds[5] *= oversampling;
287 SetParametricBounds(bounds);
293 newGeometry->UnRegister();
294 return newGeometry.GetPointer();
303 BoundingBoxType::PointIdentifier pointid;
305 for (pointid = 0; pointid < 2; ++pointid)
308 for (i = 0; i < GetNDimensions(); ++i)
310 p[i] = bounds[2 * i + pointid];
312 pointscontainer->InsertElement(pointid, p);
315 m_ParametricBoundingBox->SetPoints(pointscontainer);
316 m_ParametricBoundingBox->ComputeBoundingBox();
322 assert(m_ParametricBoundingBox.IsNotNull());
323 return m_ParametricBoundingBox->GetBounds();
328 if (direction < 0 || direction >= 3)
329 mitkThrow() <<
"Invalid direction. Must be between either 0, 1 or 2. ";
330 assert(m_ParametricBoundingBox.IsNotNull());
333 return bounds[direction * 2 + 1] - bounds[direction * 2];
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
itk::SmartPointer< Self > Pointer
virtual bool IsValid() const
Is this BaseGeometry in a state that is valid?
void Initialize()
Initialize the BaseGeometry.
void vtk2itk(const Tin &in, Tout &out)
void itk2vtk(const Tin &in, Tout &out)
Describes a two-dimensional, rectangular plane.
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.