Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkBoundingShapeUtil.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkBoundingShapeUtil_h
14 #define mitkBoundingShapeUtil_h
15 
16 #include <mitkBaseData.h>
17 #include <mitkBaseGeometry.h>
18 #include <mitkInteractionConst.h>
19 
20 #include <array>
21 
22 namespace mitk
23 {
27  std::vector<mitk::Point3D> GetCornerPoints(mitk::BaseGeometry::Pointer geometry, bool visualizationOffset);
28 
33 
40  std::vector<int> GetHandleIndices(int index);
41 
53  std::array<int, 4> GetHandleFaceCornerIndices(int handleIndex);
54 
68  bool GetFacePlaneIntersectionCenter(const std::array<mitk::Point3D, 4> &faceCorners,
69  const mitk::Point3D &planeOrigin,
70  const mitk::Vector3D &planeNormal,
71  mitk::Point3D &center);
72 
77  class Handle final
78  {
79  public:
81  Handle();
82 
91  Handle(mitk::Point3D pos, int index, std::vector<int> faceIndices, bool active = false);
92 
94 
96  bool IsActive();
97 
99  bool IsNotActive();
100 
102  void SetActive(bool status);
103 
105  void SetIndex(int index);
106 
108  int GetIndex();
109 
111  std::vector<int> GetFaceIndices();
112 
115 
118 
119  private:
120  bool m_IsActive;
121  mitk::Point3D m_Position;
122  std::vector<int> m_FaceIndices;
123  int m_Index;
124  };
125 }
126 
127 #endif
Helper Class for realizing the handles of bounding object encapsulated by a geometry data.
void SetActive(bool status)
Set the active (selected) state of the handle.
std::vector< int > GetFaceIndices()
Return the corner-point indices of the face associated with this handle.
Handle()
Default constructor. Creates an inactive handle at the origin.
bool IsActive()
Return true if the handle is currently active (selected).
void SetPosition(mitk::Point3D pos)
Set the 3D world position of the handle.
int GetIndex()
Return the index identifying this handle.
mitk::Point3D GetPosition()
Return the 3D world position of the handle.
void SetIndex(int index)
Set the index identifying this handle.
Handle(mitk::Point3D pos, int index, std::vector< int > faceIndices, bool active=false)
Construct a handle with a given position, index, and associated face indices.
bool IsNotActive()
Return true if the handle is not active.
Constants for most interaction classes, due to the generic StateMachines.
Find image slices visible on a given plane.
std::array< int, 4 > GetHandleFaceCornerIndices(int handleIndex)
Return the four corner-point indices of the box face that the given handle sits on,...
bool GetFacePlaneIntersectionCenter(const std::array< mitk::Point3D, 4 > &faceCorners, const mitk::Point3D &planeOrigin, const mitk::Vector3D &planeNormal, mitk::Point3D &center)
Intersect a planar, convex quad (given by its four perimeter-ordered corner points) with a plane and ...
mitk::Point3D CalcAvgPoint(mitk::Point3D a, mitk::Point3D b)
helper function for calculating the average of two points
std::vector< int > GetHandleIndices(int index)
Return the four corner-point indices that define the face associated with the given handle index.
std::vector< mitk::Point3D > GetCornerPoints(mitk::BaseGeometry::Pointer geometry, bool visualizationOffset)
helper function for calculating corner points of the bounding object from a given geometry