13 #ifndef mitkSliceNavigationController_h
14 #define mitkSliceNavigationController_h
25 #pragma GCC visibility push(default)
26 #include <itkEventObject.h>
27 #pragma GCC visibility pop
29 #include <itkCommand.h>
33 #define mitkTimeGeometryEventMacro(classname, super) \
34 class MITKCORE_EXPORT classname : public super \
37 typedef classname Self; \
38 typedef super Superclass; \
39 classname(TimeGeometry *aTimeGeometry, unsigned int aPos) : Superclass(aTimeGeometry, aPos) {} \
40 virtual ~classname() {} \
41 virtual const char *GetEventName() const { return #classname; } \
42 virtual bool CheckEvent(const ::itk::EventObject *e) const { return dynamic_cast<const Self *>(e); } \
43 virtual ::itk::EventObject *MakeObject() const { return new Self(GetTimeGeometry(), GetPos()); } \
45 void operator=(const Self &); \
146 void SetInputWorldTimeGeometry(
const TimeGeometry* geometry);
147 itkGetConstObjectMacro(InputWorldTimeGeometry,
TimeGeometry);
152 itkGetConstObjectMacro(CreatedWorldGeometry,
TimeGeometry);
178 const char *GetViewDirectionAsString()
const;
180 virtual void SetViewDirectionToDefault();
187 virtual void Update();
194 virtual void Update(
AnatomicalPlane viewDirection,
bool top =
true,
bool frontside =
true,
bool rotated =
false);
202 virtual void SendCreatedWorldGeometry();
208 virtual void SendCreatedWorldGeometryUpdate();
216 virtual void SendSlice();
224 virtual void SendTime();
234 const char*
GetEventName()
const override {
return "TimeGeometryEvent"; }
235 bool CheckEvent(const ::itk::EventObject* e)
const override {
return dynamic_cast<const Self*
>(e); }
236 ::itk::EventObject*
MakeObject()
const override {
return new Self(m_TimeGeometry, m_Pos); }
238 unsigned int GetPos()
const {
return m_Pos; }
244 void operator=(
const Self&);
253 template <
typename T>
256 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
257 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry);
258 unsigned long tag = AddObserver(
GeometrySendEvent(
nullptr, 0), eventReceptorCommand);
259 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
262 template <
typename T>
265 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
266 eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry);
268 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
271 template <
typename T>
274 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
275 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice);
276 unsigned long tag = AddObserver(
GeometrySliceEvent(
nullptr, 0), eventReceptorCommand);
277 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
280 template <
typename T>
283 auto eventReceptorCommand = itk::ReceptorMemberCommand<T>::New();
284 eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime);
285 unsigned long tag = AddObserver(
GeometryTimeEvent(
nullptr, 0), eventReceptorCommand);
286 m_ReceiverToObserverTagsMap[
static_cast<void*
>(receiver)].push_back(tag);
289 template <
typename T>
293 ConnectGeometrySliceEvent(receiver,
false);
294 ConnectGeometryTimeEvent(receiver);
298 template <
typename T>
301 auto i = m_ReceiverToObserverTagsMap.find(
static_cast<void*
>(receiver));
302 if (i == m_ReceiverToObserverTagsMap.end())
304 const std::list<unsigned long>& tags = i->second;
305 for (
auto tagIter = tags.begin(); tagIter != tags.end(); ++tagIter)
307 RemoveObserver(*tagIter);
309 m_ReceiverToObserverTagsMap.erase(i);
319 virtual void SetGeometry(
const itk::EventObject& geometrySliceEvent);
325 virtual void SetGeometrySlice(
const itk::EventObject& geometrySliceEvent);
331 virtual void SetGeometryTime(
const itk::EventObject& geometryTimeEvent);
363 void ExecuteOperation(
Operation* operation)
override;
370 itkSetMacro(SliceLocked,
bool);
371 itkGetMacro(SliceLocked,
bool);
372 itkBooleanMacro(SliceLocked);
380 itkSetMacro(SliceRotationLocked,
bool);
381 itkGetMacro(SliceRotationLocked,
bool);
382 itkBooleanMacro(SliceRotationLocked);
388 void AdjustSliceStepperRange();
403 void CreateWorldGeometry(
bool top,
bool frontside,
bool rotated);