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 &); \
144 void SetInputWorldTimeGeometry(
const TimeGeometry* geometry);
145 itkGetConstObjectMacro(InputWorldTimeGeometry,
TimeGeometry);
150 itkGetConstObjectMacro(CreatedWorldGeometry,
TimeGeometry);
176 const char *GetViewDirectionAsString()
const;
178 virtual void SetViewDirectionToDefault();
185 virtual void Update();
192 virtual void Update(
AnatomicalPlane viewDirection,
bool top =
true,
bool frontside =
true,
bool rotated =
false);
200 virtual void SendCreatedWorldGeometry();
206 virtual void SendCreatedWorldGeometryUpdate();
214 virtual void SendSlice();
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; }
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);
316 void ExecuteOperation(
Operation* operation)
override;
323 itkSetMacro(SliceLocked,
bool);
324 itkGetMacro(SliceLocked,
bool);
325 itkBooleanMacro(SliceLocked);
333 itkSetMacro(SliceRotationLocked,
bool);
334 itkGetMacro(SliceRotationLocked,
bool);
335 itkBooleanMacro(SliceRotationLocked);
341 void AdjustSliceStepperRange();
348 void CreateWorldGeometry(
bool top,
bool frontside,
bool rotated);