13 #ifndef mitkSliceNavigationController_h
14 #define mitkSliceNavigationController_h
24 #pragma GCC visibility push(default)
25 #include <itkEventObject.h>
26 #pragma GCC visibility pop
28 #include <itkCommand.h>
32 #define mitkTimeGeometryEventMacro(classname, super) \
33 class MITKCORE_EXPORT classname : public super \
36 typedef classname Self; \
37 typedef super Superclass; \
38 classname(TimeGeometry *aTimeGeometry, unsigned int aPos) : Superclass(aTimeGeometry, aPos) {} \
39 virtual ~classname() {} \
40 virtual const char *GetEventName() const { return #classname; } \
41 virtual bool CheckEvent(const ::itk::EventObject *e) const { return dynamic_cast<const Self *>(e); } \
42 virtual ::itk::EventObject *MakeObject() const { return new Self(GetTimeGeometry(), GetPos()); } \
44 void operator=(const Self &); \
224 const char*
GetEventName()
const override {
return "TimeGeometryEvent"; }
225 bool CheckEvent(const ::itk::EventObject* e)
const override {
return dynamic_cast<const Self*
>(e); }
226 ::itk::EventObject*
MakeObject()
const override {
return new Self(m_TimeGeometry, m_Pos); }
228 unsigned int GetPos()
const {
return m_Pos; }
231 TimeGeometry::Pointer m_TimeGeometry;
234 void operator=(
const Self&);
242 template <
typename T>
245 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
246 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry);
247 unsigned long tag = AddObserver(
GeometrySendEvent(
nullptr, 0), eventReceptorCommand);
248 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
251 template <
typename T>
254 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
255 eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry);
257 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
260 template <
typename T>
263 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
264 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice);
265 unsigned long tag = AddObserver(
GeometrySliceEvent(
nullptr, 0), eventReceptorCommand);
266 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
270 template <
typename T>
273 auto i = m_ReceiverToObserverTagsMap.find(
static_cast<void*
>(receiver));
274 if (i == m_ReceiverToObserverTagsMap.end())
276 const std::list<unsigned long>& tags = i->second;
277 for (
auto tagIter = tags.begin(); tagIter != tags.end(); ++tagIter)
279 RemoveObserver(*tagIter);
281 m_ReceiverToObserverTagsMap.erase(i);
323 itkSetMacro(SliceLocked,
bool);
324 itkGetMacro(SliceLocked,
bool);
325 itkBooleanMacro(SliceLocked);
333 itkSetMacro(SliceRotationLocked,
bool);
334 itkGetMacro(SliceRotationLocked,
bool);
335 itkBooleanMacro(SliceRotationLocked);
Baseclass for renderer slice-/camera-/time-control.
BaseGeometry Describes the geometry of a data object.
Base class of all Operation-classes.
Describes a two-dimensional, rectangular plane.
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()
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
const char * GetViewDirectionAsString() const
void ReorientSlices(const Point3D &point, const Vector3D &normal)
Re-orients the slice stack. All slices will be oriented to the given normal vector....
virtual void SendSlice()
Send the currently selected slice to the connected observers (renderers)
void ExecuteOperation(Operation *operation) override
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)
Positions the SNC according to the specified 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-orients the slice stack so that all planes are oriented according to the given axis vectors....
SliceNavigationController()
#define mitkTimeGeometryEventMacro(classname, super)
Find image slices visible on a given plane.