13 #ifndef mitkSliceNavigationController_h
14 #define mitkSliceNavigationController_h
25 #pragma GCC visibility push(default)
27 #include <itkEventObject.h>
29 #pragma GCC visibility pop
32 #include <itkCommand.h>
36 #define mitkTimeGeometryEventMacro(classname, super) \
37 class MITKCORE_EXPORT classname : public super \
40 typedef classname Self; \
41 typedef super Superclass; \
42 classname(TimeGeometry *aTimeGeometry, unsigned int aPos) : Superclass(aTimeGeometry, aPos) {} \
43 virtual ~classname() {} \
44 virtual const char *GetEventName() const { return #classname; } \
45 virtual bool CheckEvent(const ::itk::EventObject *e) const { return dynamic_cast<const Self *>(e); } \
46 virtual ::itk::EventObject *MakeObject() const { return new Self(GetTimeGeometry(), GetPos()); } \
48 void operator=(const Self &); \
240 const char*
GetEventName()
const override {
return "TimeGeometryEvent"; }
241 bool CheckEvent(const ::itk::EventObject* e)
const override {
return dynamic_cast<const Self*
>(e); }
242 ::itk::EventObject*
MakeObject()
const override {
return new Self(m_TimeGeometry, m_Pos); }
244 unsigned int GetPos()
const {
return m_Pos; }
247 TimeGeometry::Pointer m_TimeGeometry;
250 void operator=(
const Self&);
258 template <
typename T>
261 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
262 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry);
263 unsigned long tag = AddObserver(
GeometrySendEvent(
nullptr, 0), eventReceptorCommand);
264 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
267 template <
typename T>
270 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
271 eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry);
273 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
276 template <
typename T>
279 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
280 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice);
281 unsigned long tag = AddObserver(
GeometrySliceEvent(
nullptr, 0), eventReceptorCommand);
282 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
286 template <
typename T>
289 auto i = m_ReceiverToObserverTagsMap.find(
static_cast<void*
>(receiver));
290 if (i == m_ReceiverToObserverTagsMap.end())
292 const std::list<unsigned long>& tags = i->second;
293 for (
auto tagIter = tags.begin(); tagIter != tags.end(); ++tagIter)
295 RemoveObserver(*tagIter);
297 m_ReceiverToObserverTagsMap.erase(i);
365 itkSetMacro(SliceLocked,
bool);
366 itkGetMacro(SliceLocked,
bool);
367 itkBooleanMacro(SliceLocked);
375 itkSetMacro(SliceRotationLocked,
bool);
376 itkGetMacro(SliceRotationLocked,
bool);
377 itkBooleanMacro(SliceRotationLocked);
Base class for renderer slice, camera, and time control.
Abstract base class describing the geometry of a data object.
Organizes the rendering process.
Event/message class with one parameter.
Base class for all operations in the undo/redo framework.
Describes the geometry of a plane object.
const char * GetEventName() const override
~TimeGeometryEvent() override
unsigned int GetPos() const
TimeGeometry * GetTimeGeometry() const
TimeGeometryEvent(TimeGeometry *aTimeGeometry, unsigned int aPos)
bool CheckEvent(const ::itk::EventObject *e) const override
::itk::EventObject * MakeObject() const override
Controls the selection of the slice the associated BaseRenderer will display.
void CreateWorldGeometry(bool top, bool frontside, bool rotated)
mitkClassMacro(SliceNavigationController, BaseController)
const BaseGeometry * GetCurrentGeometry3D()
Returns the BaseGeometry of the currently selected time step.
void ConnectGeometryUpdateEvent(T *receiver)
void ConnectGeometrySendEvent(T *receiver)
BaseRenderer * m_Renderer
std::map< void *, std::list< unsigned long > > ObserverTagsMapType
void SetInputWorldTimeGeometry(const TimeGeometry *geometry)
Set the input world time geometry out of which the geometries for slicing will be created.
ObserverTagsMapType m_ReceiverToObserverTagsMap
void AdjustSliceStepperRange()
Adjusts the numerical range of the slice stepper according to the current geometry orientation of thi...
AnatomicalPlane m_DefaultViewDirection
AnatomicalPlane m_ViewDirection
itkSetEnumMacro(ViewDirection, AnatomicalPlane)
Set the desired view directions.
~SliceNavigationController() override
TimeGeometry::Pointer m_CreatedWorldGeometry
itkGetEnumMacro(DefaultViewDirection, AnatomicalPlane)
virtual void SendCreatedWorldGeometryUpdate()
Tell observers to re-read the currently selected 2D geometry.
virtual void SendCreatedWorldGeometry()
Send the created geometry to the connected observers (renderers)
virtual void SetViewDirectionToDefault()
Reset the view direction to the default view direction.
itkGetEnumMacro(ViewDirection, AnatomicalPlane)
RenderingManager::Pointer m_RenderingManager
virtual void Update()
Do the actual creation and send it to the connected observers (renderers)
void ConnectGeometrySliceEvent(T *receiver)
Message1< const Point3D & > SetCrosshairEvent
Signal emitted when the crosshair position changes. The parameter is the new position in world coordi...
const char * GetViewDirectionAsString() const
Get the current view direction as a human-readable string.
void ReorientSlices(const Point3D &point, const Vector3D &normal)
Re-orient the slice stack using a normal vector.
virtual void SendSlice()
Send the currently selected slice to the connected observers (renderers)
void ExecuteOperation(Operation *operation) override
Execute an operation (e.g. OpMOVE, OpRESTOREPLANEPOSITION, OpAPPLYTRANSFORMMATRIX).
bool m_SliceRotationLocked
const PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
itkSetEnumMacro(DefaultViewDirection, AnatomicalPlane)
Set the default view direction.
void SelectSliceByPoint(const Point3D &point)
Select the slice closest to the given 3D point.
void Disconnect(T *receiver)
TimeGeometry::ConstPointer m_InputWorldTimeGeometry
virtual void Update(AnatomicalPlane viewDirection, bool top=true, bool frontside=true, bool rotated=false)
Extended version of Update, additionally allowing to specify the direction/orientation of the created...
void ReorientSlices(const Point3D &point, const Vector3D &axisVec0, const Vector3D &axisVec1)
Re-orient the slice stack using two explicit axis vectors.
SliceNavigationController()
#define mitkTimeGeometryEventMacro(classname, super)
Find image slices visible on a given plane.
AnatomicalPlane
Enumeration of standard anatomical image planes.