Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkCameraController.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 mitkCameraController_h
14 #define mitkCameraController_h
15 
16 #include <mitkBaseController.h>
17 #include <MitkCoreExports.h>
18 
19 namespace mitk
20 {
21  class KeyEvent;
22 
34  {
35  public:
38  {
44  CAUDAL
45  };
46 
48  // mitkNewMacro1Param(Self, const char*);
49  itkNewMacro(Self);
50 
52  void SetRenderer(const BaseRenderer *renderer) { m_Renderer = renderer; };
53  itkGetConstMacro(Renderer, const BaseRenderer *);
54 
56  virtual void SetViewToAnterior();
58  virtual void SetViewToPosterior();
60  virtual void SetViewToSinister();
62  virtual void SetViewToDexter();
64  virtual void SetViewToCranial();
66  virtual void SetViewToCaudal();
67 
72  virtual void SetStandardView(StandardView view);
73 
77  void Fit();
78 
84 
89  void MoveCameraToPoint(const Point2D &planePoint);
90 
95  void MoveBy(const Vector2D &moveVectorInMM);
96 
102  void Zoom(ScalarType factor, const Point2D &zoomPointInMM);
103 
109 
116 
117  protected:
120 
122  ~CameraController() override;
123 
126 
132 
133  private:
142  void AdjustCameraToPlane(const Point2D &PlanePoint);
143 
148  void AdjustConstrainedCameraPosition(Point2D &planePoint);
149  };
150 
151 } // namespace mitk
152 
153 #endif
#define MITKCORE_EXPORT
Base class for renderer slice, camera, and time control.
Organizes the rendering process.
Controls the camera used by the associated BaseRenderer.
StandardView
Enumeration of standard anatomical viewing directions.
@ SINISTER
View from the left.
@ POSTERIOR
View from the back (dorsal).
@ CRANIAL
View from above (superior).
@ ANTERIOR
View from the front (ventral).
@ DEXTER
View from the right.
virtual void SetViewToDexter()
Set the camera to a dexter (right) view.
void AdjustCameraToPlane()
Adjust the camera orientation to match the current plane without panning or zooming.
void SetRenderer(const BaseRenderer *renderer)
Set the renderer whose camera this controller manages.
Point2D GetCameraPositionOnPlane()
Get the current camera position projected onto the plane.
mitkClassMacro(CameraController, BaseController)
virtual void SetViewToSinister()
Set the camera to a sinister (left) view.
CameraController()
Default constructor.
const BaseRenderer * m_Renderer
The renderer whose camera is controlled.
void Zoom(ScalarType factor, const Point2D &zoomPointInMM)
Zoom the camera by the given factor around the specified point.
~CameraController() override
Destructor.
virtual void SetStandardView(StandardView view)
Set the camera to one of the standard anatomical views.
ScalarType ComputeMaxParallelScale()
Compute the maximum parallel scale that fits the entire plane into the viewport.
virtual void SetViewToPosterior()
Set the camera to a posterior (back) view.
virtual void SetViewToAnterior()
Set the camera to an anterior (front) view.
virtual void SetViewToCranial()
Set the camera to a cranial (top) view.
void MoveBy(const Vector2D &moveVectorInMM)
Move the camera by the given vector (in mm).
void MoveCameraToPoint(const Point2D &planePoint)
Move the camera so that the given point on the plane is in the view center.
void SetScaleFactorInMMPerDisplayUnit(ScalarType scale)
Set the desired zoom level to an absolute value.
virtual void SetViewToCaudal()
Set the camera to a caudal (bottom) view.
void Fit()
Adjust the camera so that the world bounding box is fully visible.
Find image slices visible on a given plane.
double ScalarType
Scalar type used throughout MITK for geometric computations.