diff --git a/Core/Code/Controllers/mitkCallbackFromGUIThread.h b/Core/Code/Controllers/mitkCallbackFromGUIThread.h index faa332cd19..6c075c9d1f 100644 --- a/Core/Code/Controllers/mitkCallbackFromGUIThread.h +++ b/Core/Code/Controllers/mitkCallbackFromGUIThread.h @@ -1,205 +1,207 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ #define MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ #include -#include +#pragma GCC visibility push(default) +#include +#pragma GCC visibility pop #include namespace mitk { /*! \brief Used by CallbackFromGUIThread to pass parameters. */ template class CallbackEventOneParameter : public itk::AnyEvent { public: typedef CallbackEventOneParameter Self; typedef itk::AnyEvent Superclass; CallbackEventOneParameter(const T t ) : m_Data(t) {} virtual ~CallbackEventOneParameter() {} virtual const char * GetEventName() const { return "CallbackEventOneParameter"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_Data ); } const T GetData() const { return m_Data; } CallbackEventOneParameter(const Self& s) : itk::AnyEvent(s), m_Data(s.m_Data) {}; protected: const T m_Data; private: void operator=(const Self&); }; /*! \brief Toolkit specific implementation of mitk::CallbackFromGUIThread For any toolkit, this class has to be sub-classed. One instance of that sub-class has to be registered with mitk::CallbackFromGUIThread. See the (very simple) implmentation of QmitkCallbackFromGUIThread for an example. */ class MITK_CORE_EXPORT CallbackFromGUIThreadImplementation { public: /// Change the current application cursor virtual void CallThisFromGUIThread(itk::Command*, itk::EventObject*) = 0; virtual ~CallbackFromGUIThreadImplementation() {}; protected: private: }; /*! \brief Allows threads to call some method from within the GUI thread. This class is useful for use with GUI toolkits that are not thread-safe, e.g. Qt. Any thread that needs to work with the GUI at some time during its execution (e.g. at the end, to display some results) can use this class to ask for a call to a member function from the GUI thread. Usage example We assume that you have a class ThreadedClass, that basically lives in a thread that is different from the GUI thread. Now this class has to change some element of the GUI to indicate its status. This could be dangerous (with Qt it is for sure). The solution is, that ThreadedClass asks mitk::CallbackFromGUIThread to call a method from the GUI thread (main thread). Here is part of the header of ThreadedClass: \code class ThreadedClass : public ParentClass { public: ... // All you need // This function runs in its own thread ! void ThreadedFunction(); // This should be called from the GUI thread void ChangeGUIElementsToIndicateProgress(const itk::EventObject&); ... }; \endcode \code #include "mitkCallbackFromGUIThread.h" #include // This method runs in a thread of its own! So it can't manipulate GUI elements directly without causing trouble void ThreadedClass::ThreadedFunction() { ... // Create a command object (passing parameters comes later) itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); command->SetCallbackFunction(this, &ThreadedClass::ChangeGUIElementsToIndicateProgress); // Ask to execute that command from the GUI thread mitk::CallbackFromGUIThread::GetInstance()->CallThisFromGUIThread(command); ... } // Do dangerous GUI changing stuff here void ThreadedClass::ChangeGUIElementsToIndicateProgress(const itk::EventObject& e) { Application::GetButtonGrid()->AddButton("Stop"); // this is pseudo code } \endcode This obviously won't allow you to pass parameters to ChangeGUIElementsToIndicateProgress. If you need to do that, you have to create a kind of itk::EventObject that can be asked for a parameter (this solution is not nice, if you see a better solution, please mail to mitk-users@lists.sourceforge.net). The itk::EventObject has to be created with "new" (which can also be done by calling MakeObject on an existing EventObject). \code const mitk::OneParameterEvent* event = new mitk::OneParameterEvent(1); // this class is not yet defined but will be itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); command->SetCallbackFunction(this, &ThreadedClass::ChangeGUIElementsToIndicateProgress); mitk::CallbackFromGUIThread::GetInstance()->CallThisFromGUIThread(command, event); // DO NOT delete event now. This will be done by CallThisFromGUIThread after the command will executed. \endcode \todo Create a set of "normal" parameter-event-objects that people might want to use. */ class MITK_CORE_EXPORT CallbackFromGUIThread { public: /// This class is a singleton. static CallbackFromGUIThread* GetInstance(); /// To be called by a toolkit specific CallbackFromGUIThreadImplementation. static void RegisterImplementation(CallbackFromGUIThreadImplementation* implementation); /// Change the current application cursor void CallThisFromGUIThread(itk::Command*, itk::EventObject* e = NULL); protected: /// Purposely hidden - singleton CallbackFromGUIThread(); private: static CallbackFromGUIThreadImplementation* m_Implementation; static CallbackFromGUIThread* m_Instance; }; } // namespace #endif diff --git a/Core/Code/Controllers/mitkFocusManager.h b/Core/Code/Controllers/mitkFocusManager.h index 8eb557e041..0fecea1562 100755 --- a/Core/Code/Controllers/mitkFocusManager.h +++ b/Core/Code/Controllers/mitkFocusManager.h @@ -1,148 +1,150 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 #define MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 #include #include "mitkBaseRenderer.h" #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { //##Documentation //## @brief manages a list of BaseRenderer. //## //## A focuspointer can be set and read. //## GoToNext can be used to switch through the list. //## if the switch m_Loop is set to true, GetNext loops through the list; after //## the last it goes to the first. //## if it is not set, it returnes NULL if it steps behind the last Widget. //## @ingroup Interaction class MITK_CORE_EXPORT FocusManager : public itk::Object { public: mitkClassMacro(FocusManager, itk::Object); itkNewMacro(Self); //##Documentation //##@brief Element, that can be focused and held here. //## //## has to be an itk-Objekct in order to use itk-Smartpointer! typedef mitk::BaseRenderer FocusElement; typedef itk::WeakPointer FocusElementWeakPointer; typedef std::vector FocusElementList; typedef std::vector::iterator FocusListIterator; //##Documentation //## Destructor ~FocusManager(); //##Documentation //## Adds the widget into the set of managed Widgets after the focused //## widget and sets the focus to the added one if the list was empty before bool AddElement(FocusElement* element); //##Documentation //## removes the given widget from the list. //## true if found and removed, else false //## afterwards the focused widget is the one behind the deleted //## or if the deleted was the last, then the one before the deleted //## that way you can delete sequentialy from the back on or from front to back bool RemoveElement(FocusElement* element); //##Documentation //## returns the focused Widget FocusElement* GetFocused() const; //##Documentation //## searches the given Widget in List; //## if found, sets the focus to this widget and returns true bool SetFocused(FocusElement* element); //##Documentation //## returns, if this focused widget points behind the end of the List bool IsLast(); //##Documentation //## returns true, if the focused widget is the first in the list bool IsFirst(); //##Documentation //## returns the first widget in list const FocusElement* GetFirst() const; //##Documentation //## returns the last widget in list const FocusElement* GetLast() const; //##Documentation //## sets the focus to the next in list //## loops the list, if switch loop is true //## returns true if successful, else false bool GoToNext(); //##Documentation //## returns an iterator, that points to the //## beginning of the list //## no changes are made to the current focused element FocusListIterator GetIter(); //##Documentation //## Sets the LoopMode. //## if set to true-> the one after the last is the first void SetLoop(bool loop); friend class GlobalInteraction; protected: //##Documentation //## Constructor FocusManager(); private: //##Documentation //## stores the Widgets FocusElementList m_FocusList; //##Documentation //## holds the focused Widget itk::WeakPointer m_FocElement; //##Documentation //## switch which sets the LoopMode. //## if true, then the next after the last one is the first bool m_Loop; }; #pragma GCC visibility push(default) //##Documentation //## @brief connect to this Event to get noticed when the focus changes itkEventMacro( FocusEvent , itk::AnyEvent ); #pragma GCC visibility pop } // namespace mitk #endif /* MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 */ diff --git a/Core/Code/Controllers/mitkLimitedLinearUndo.h b/Core/Code/Controllers/mitkLimitedLinearUndo.h index 4752bbaecf..b7fcd6afac 100644 --- a/Core/Code/Controllers/mitkLimitedLinearUndo.h +++ b/Core/Code/Controllers/mitkLimitedLinearUndo.h @@ -1,143 +1,145 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 #define LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 // MITK header #include #include "mitkOperationEvent.h" #include "mitkUndoModel.h" // STL header #include // ITK header -#include +#pragma GCC visibility push(default) +#include +#pragma GCC visibility pop namespace mitk { //##Documentation //## @brief A linear undo model with one undo and one redo stack. //## //## Derived from UndoModel AND itk::Object. Invokes ITK-events to signal listening //## GUI elements, whether each of the stacks is empty or not (to enable/disable button, ...) class MITK_CORE_EXPORT LimitedLinearUndo : public UndoModel { public: typedef std::vector UndoContainer; typedef std::vector::reverse_iterator UndoContainerRevIter; mitkClassMacro(LimitedLinearUndo, UndoModel); itkNewMacro(Self); virtual bool SetOperationEvent(UndoStackItem* stackItem); //##Documentation //## @brief Undoes the last changes //## //## Reads the top element of the Undo-Stack, //## executes the operation, //## swaps the OperationEvent-Undo with the Operation //## and sets it to Redo-Stack virtual bool Undo(); virtual bool Undo(bool); //##Documentation //## @brief Undoes all changes until ObjectEventID oeid virtual bool Undo(int oeid); //##Documentation //## @brief Undoes the last changes //## //## Reads the top element of the Redo-Stack, //## executes the operation, //## swaps the OperationEvent-Operation with the Undo-Operation //## and sets it to Undo-Stack virtual bool Redo(); virtual bool Redo(bool); //##Documentation //## @brief Redoes all changes until ObjectEventID oeid virtual bool Redo(int oeid); //##Documentation //## @brief Clears UndoList and RedoList virtual void Clear(); //##Documentation //## @brief Clears the RedoList virtual void ClearRedoList(); //##Documentation //## @brief True, if RedoList is empty virtual bool RedoListEmpty(); //##Documentation //## @brief Returns the ObjectEventId of the //## top element in the OperationHistory virtual int GetLastObjectEventIdInList(); //##Documentation //## @brief Returns the GroupEventId of the //## top element in the OperationHistory virtual int GetLastGroupEventIdInList(); //##Documentation //## @brief Returns the last specified OperationEvent in Undo-list //## corresponding to the given values; if nothing found, then returns NULL virtual OperationEvent* GetLastOfType(OperationActor* destination, OperationType opType); protected: //##Documentation //## Constructor LimitedLinearUndo(); //##Documentation //## Destructor virtual ~LimitedLinearUndo(); //## @brief Convenience method to free the memory of //## elements in the list and to clear the list void ClearList(UndoContainer* list); UndoContainer m_UndoList; UndoContainer m_RedoList; private: int FirstObjectEventIdOfCurrentGroup(UndoContainer& stack); }; #pragma GCC visibility push(default) /// Some itk events to notify listening GUI elements, when the undo or redo stack is empty (diable undo button) /// or when there are items in the stack (enable button) itkEventMacro( UndoStackEvent, itk::ModifiedEvent ); itkEventMacro( UndoEmptyEvent, UndoStackEvent ); itkEventMacro( RedoEmptyEvent, UndoStackEvent ); itkEventMacro( UndoNotEmptyEvent, UndoStackEvent ); itkEventMacro( RedoNotEmptyEvent, UndoStackEvent ); /// Additional unused events, if anybody wants to put an artificial limit to the possible number of items in the stack itkEventMacro( UndoFullEvent, UndoStackEvent ); itkEventMacro( RedoFullEvent, UndoStackEvent ); #pragma GCC visibility pop } //namespace mitk #endif /* LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 */ diff --git a/Core/Code/Controllers/mitkSliceNavigationController.h b/Core/Code/Controllers/mitkSliceNavigationController.h index f6954751fc..74bf7bc9c4 100644 --- a/Core/Code/Controllers/mitkSliceNavigationController.h +++ b/Core/Code/Controllers/mitkSliceNavigationController.h @@ -1,510 +1,512 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F #define SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F #include #include "mitkBaseController.h" #include "mitkRenderingManager.h" #include "mitkTimeSlicedGeometry.h" #include "mitkMessage.h" +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include #include #include namespace mitk { #define mitkTimeSlicedGeometryEventMacro( classname , super ) \ class MITK_CORE_EXPORT classname : public super { \ public: \ typedef classname Self; \ typedef super Superclass; \ classname(TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos) \ : Superclass(aTimeSlicedGeometry, aPos) {} \ virtual ~classname() {} \ virtual const char * GetEventName() const { return #classname; } \ virtual bool CheckEvent(const ::itk::EventObject* e) const \ { return dynamic_cast(e); } \ virtual ::itk::EventObject* MakeObject() const \ { return new Self(GetTimeSlicedGeometry(), GetPos()); } \ private: \ void operator=(const Self&); \ } class PlaneGeometry; class Geometry3D; class BaseRenderer; /** * \brief Controls the selection of the slice the associated BaseRenderer * will display * * A SliceNavigationController takes a Geometry3D as input world geometry * (TODO what are the exact requirements?) and generates a TimeSlicedGeometry * as output. The TimeSlicedGeometry holds a number of SlicedGeometry3Ds and * these in turn hold a series of Geometry2Ds. One of these Geometry2Ds is * selected as world geometry for the BaseRenderers associated to 2D views. * * The SliceNavigationController holds has Steppers (one for the slice, a * second for the time step), which control the selection of a single * Geometry2D from the TimeSlicedGeometry. SliceNavigationController generates * ITK events to tell observers, like a BaseRenderer, when the selected slice * or timestep changes. * * SliceNavigationControllers are registered as listeners to GlobalInteraction * by the QmitkStdMultiWidget. In ExecuteAction, the controllers react to * PositionEvents by setting the steppers to the slice which is nearest to the * point of the PositionEvent. * * Example: * \code * // Initialization * sliceCtrl = mitk::SliceNavigationController::New(); * * // Tell the navigator the geometry to be sliced (with geometry a * // Geometry3D::ConstPointer) * sliceCtrl->SetInputWorldGeometry(geometry.GetPointer()); * * // Tell the navigator in which direction it shall slice the data * sliceCtrl->SetViewDirection(mitk::SliceNavigationController::Transversal); * * // Connect one or more BaseRenderer to this navigator, i.e.: events sent * // by the navigator when stepping through the slices (e.g. by * // sliceCtrl->GetSlice()->Next()) will be received by the BaseRenderer * // (in this example only slice-changes, see also ConnectGeometryTimeEvent * // and ConnectGeometryEvents.) * sliceCtrl->ConnectGeometrySliceEvent(renderer.GetPointer()); * * //create a world geometry and send the information to the connected renderer(s) * sliceCtrl->Update(); * \endcode * * * You can connect visible navigators to a SliceNavigationController, e.g., a * QmitkSliderNavigator (for Qt): * * \code * // Create the visible navigator (a slider with a spin-box) * QmitkSliderNavigator* navigator = * new QmitkSliderNavigator(parent, "slidernavigator"); * * // Connect the navigator to the slice-stepper of the * // SliceNavigationController. For initialization (position, mininal and * // maximal values) the values of the SliceNavigationController are used. * // Thus, accessing methods of a navigator is normally not necessary, since * // everything can be set via the (Qt-independent) SliceNavigationController. * // The QmitkStepperAdapter converts the Qt-signals to Qt-independent * // itk-events. * new QmitkStepperAdapter(navigator, sliceCtrl->GetSlice(), "navigatoradaptor"); * \endcode * * If you do not want that all renderwindows are updated when a new slice is * selected, you can use a specific RenderingManager, which updates only those * renderwindows that should be updated. This is sometimes useful when a 3D view * does not need to be updated when the slices in some 2D views are changed. * QmitkSliderNavigator (for Qt): * * \code * // create a specific RenderingManager * mitk::RenderingManager::Pointer myManager = mitk::RenderingManager::New(); * * // tell the RenderingManager to update only renderwindow1 and renderwindow2 * myManager->AddRenderWindow(renderwindow1); * myManager->AddRenderWindow(renderwindow2); * * // tell the SliceNavigationController of renderwindow1 and renderwindow2 * // to use the specific RenderingManager instead of the global one * renderwindow1->GetSliceNavigationController()->SetRenderingManager(myManager); * renderwindow2->GetSliceNavigationController()->SetRenderingManager(myManager); * \endcode * * \todo implement for non-evenly-timed geometry! * \ingroup NavigationControl */ class MITK_CORE_EXPORT SliceNavigationController : public BaseController { public: mitkClassMacro(SliceNavigationController,BaseController); itkNewMacro(Self); mitkNewMacro1Param(Self, const char *); /** * \brief Possible view directions, \a Original will uses * the Geometry2D instances in a SlicedGeometry3D provided * as input world geometry (by SetInputWorldGeometry). */ enum ViewDirection{Transversal, Sagittal, Frontal, Original}; /** * \brief Set the input world geometry out of which the * geometries for slicing will be created. */ void SetInputWorldGeometry(const mitk::Geometry3D* geometry); itkGetConstObjectMacro(InputWorldGeometry, mitk::Geometry3D); /** * \brief Access the created geometry */ itkGetConstObjectMacro(CreatedWorldGeometry, mitk::Geometry3D); /** * \brief Set the desired view directions * * \sa ViewDirection * \sa Update(ViewDirection viewDirection, bool top = true, * bool frontside = true, bool rotated = false) */ itkSetEnumMacro(ViewDirection, ViewDirection); itkGetEnumMacro(ViewDirection, ViewDirection); /** * \brief Set the default view direction * * This is used to re-initialize the view direction of the SNC to the * default value with SetViewDirectionToDefault() * * \sa ViewDirection * \sa Update(ViewDirection viewDirection, bool top = true, * bool frontside = true, bool rotated = false) */ itkSetEnumMacro(DefaultViewDirection, ViewDirection); itkGetEnumMacro(DefaultViewDirection, ViewDirection); virtual void SetViewDirectionToDefault(); /** * \brief Do the actual creation and send it to the connected * observers (renderers) * */ virtual void Update(); /** * \brief Extended version of Update, additionally allowing to * specify the direction/orientation of the created geometry. * */ virtual void Update(ViewDirection viewDirection, bool top = true, bool frontside = true, bool rotated = false); /** * \brief Send the created geometry to the connected * observers (renderers) * * Called by Update(). */ virtual void SendCreatedWorldGeometry(); /** * \brief Tell observers to re-read the currently selected 2D geometry * * Called by mitk::SlicesRotator during rotation. */ virtual void SendCreatedWorldGeometryUpdate(); /** * \brief Send the currently selected slice to the connected * observers (renderers) * * Called by Update(). */ virtual void SendSlice(); /** * \brief Send the currently selected time to the connected * observers (renderers) * * Called by Update(). */ virtual void SendTime(); /** * \brief Set the RenderingManager to be used * * If \a NULL, the default RenderingManager will be used. */ itkSetObjectMacro(RenderingManager, RenderingManager); mitk::RenderingManager* GetRenderingManager() const; #pragma GCC visibility push(default) itkEventMacro( UpdateEvent, itk::AnyEvent ); #pragma GCC visibility pop class MITK_CORE_EXPORT TimeSlicedGeometryEvent : public itk::AnyEvent { public: typedef TimeSlicedGeometryEvent Self; typedef itk::AnyEvent Superclass; TimeSlicedGeometryEvent( TimeSlicedGeometry* aTimeSlicedGeometry, unsigned int aPos) : m_TimeSlicedGeometry(aTimeSlicedGeometry), m_Pos(aPos) {} virtual ~TimeSlicedGeometryEvent() {} virtual const char * GetEventName() const { return "TimeSlicedGeometryEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self(m_TimeSlicedGeometry, m_Pos); } TimeSlicedGeometry* GetTimeSlicedGeometry() const { return m_TimeSlicedGeometry; } unsigned int GetPos() const { return m_Pos; } private: TimeSlicedGeometry::Pointer m_TimeSlicedGeometry; unsigned int m_Pos; // TimeSlicedGeometryEvent(const Self&); void operator=(const Self&); //just hide }; mitkTimeSlicedGeometryEventMacro( GeometrySendEvent,TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometryUpdateEvent, TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometryTimeEvent, TimeSlicedGeometryEvent ); mitkTimeSlicedGeometryEventMacro( GeometrySliceEvent, TimeSlicedGeometryEvent ); template void ConnectGeometrySendEvent(T* receiver) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry); AddObserver(GeometrySendEvent(NULL,0), eventReceptorCommand); } template void ConnectGeometryUpdateEvent(T* receiver) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry); AddObserver(GeometryUpdateEvent(NULL,0), eventReceptorCommand); } template void ConnectGeometrySliceEvent(T* receiver, bool connectSendEvent=true) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice); AddObserver(GeometrySliceEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); } template void ConnectGeometryTimeEvent(T* receiver, bool connectSendEvent=true) { typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime); AddObserver(GeometryTimeEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); } template void ConnectGeometryEvents(T* receiver) { //connect sendEvent only once ConnectGeometrySliceEvent(receiver, false); ConnectGeometryTimeEvent(receiver); } Message<> crosshairPositionEvent; /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface * \warning not implemented */ virtual void SetGeometry(const itk::EventObject & geometrySliceEvent); /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface */ virtual void SetGeometrySlice(const itk::EventObject & geometrySliceEvent); /** * \brief To connect multiple SliceNavigationController, we can * act as an observer ourselves: implemented interface */ virtual void SetGeometryTime(const itk::EventObject & geometryTimeEvent); /** \brief Positions the SNC according to the specified point */ void SelectSliceByPoint( const mitk::Point3D &point ); /** \brief Returns the TimeSlicedGeometry created by the SNC. */ const mitk::TimeSlicedGeometry *GetCreatedWorldGeometry(); /** \brief Returns the Geometry3D of the currently selected time step. */ const mitk::Geometry3D *GetCurrentGeometry3D(); /** \brief Returns the currently selected Plane in the current * Geometry3D (if existent). */ const mitk::PlaneGeometry *GetCurrentPlaneGeometry(); /** \brief Sets the BaseRenderer associated with this SNC (if any). While * the BaseRenderer is not directly used by SNC, this is a convenience * method to enable BaseRenderer access via the SNC. */ void SetRenderer( BaseRenderer *renderer ); /** \brief Gets the BaseRenderer associated with this SNC (if any). While * the BaseRenderer is not directly used by SNC, this is a convenience * method to enable BaseRenderer access via the SNC. Returns NULL if no * BaseRenderer has been specified*/ BaseRenderer *GetRenderer() const; /** \brief Re-orients the slice stack to include the plane specified by * the given point an normal vector. */ void ReorientSlices( const mitk::Point3D &point, const mitk::Vector3D &normal ); virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent); void ExecuteOperation(Operation* operation); /** * \brief Feature option to lock planes during mouse interaction. * This option flag disables the mouse event which causes the center * cross to move near by. */ itkSetMacro(SliceLocked, bool); itkGetMacro(SliceLocked, bool); itkBooleanMacro(SliceLocked); /** * \brief Feature option to lock slice rotation. * * This option flag disables separately the rotation of a slice which is * implemented in mitkSliceRotator. */ itkSetMacro(SliceRotationLocked, bool); itkGetMacro(SliceRotationLocked, bool); itkBooleanMacro(SliceRotationLocked); /** * \brief Adjusts the numerical range of the slice stepper according to * the current geometry orientation of this SNC's SlicedGeometry. */ void AdjustSliceStepperRange(); protected: SliceNavigationController(const char * type = NULL); virtual ~SliceNavigationController(); template static void buildstring( mitkIpPicDescriptor *pic, itk::Point p, std::string &s, T = 0) { std::string value; std::stringstream stream; stream.imbue(std::locale::classic()); stream<=0 && p[1] >=0 && p[2]>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] ) { if(pic->bpe!=24) { stream<<(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]); } else { stream<<(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); } s = stream.str(); } else { s+= "point out of data"; } }; mitk::Geometry3D::ConstPointer m_InputWorldGeometry; mitk::Geometry3D::Pointer m_ExtendedInputWorldGeometry; mitk::TimeSlicedGeometry::Pointer m_CreatedWorldGeometry; ViewDirection m_ViewDirection; ViewDirection m_DefaultViewDirection; mitk::RenderingManager::Pointer m_RenderingManager; mitk::BaseRenderer *m_Renderer; itkSetMacro(Top, bool); itkGetMacro(Top, bool); itkBooleanMacro(Top); itkSetMacro(FrontSide, bool); itkGetMacro(FrontSide, bool); itkBooleanMacro(FrontSide); itkSetMacro(Rotated, bool); itkGetMacro(Rotated, bool); itkBooleanMacro(Rotated); bool m_Top; bool m_FrontSide; bool m_Rotated; bool m_BlockUpdate; bool m_SliceLocked; bool m_SliceRotationLocked; unsigned int m_OldPos; }; } // namespace mitk #endif /* SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F */ diff --git a/Core/Code/Controllers/mitkSlicesRotator.h b/Core/Code/Controllers/mitkSlicesRotator.h index 25586ec26b..a707ebdf8b 100644 --- a/Core/Code/Controllers/mitkSlicesRotator.h +++ b/Core/Code/Controllers/mitkSlicesRotator.h @@ -1,109 +1,111 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SLICESROTATOR_H_HEADER_INCLUDED_C1C55A2F #define SLICESROTATOR_H_HEADER_INCLUDED_C1C55A2F #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include namespace mitk { /** * \brief Enables rotation of visible slices (for sliced geometries). * \ingroup NavigationControl * * This class takes care of several SliceNavigationControllers and handles * slice selection / slice rotation. It is added as listener to * GlobalInteraction by QmitkStdMultiWidget. * * The SlicesRotator class adds the possibility of slice rotation to the * "normal" behaviour of SliceNavigationControllers. This additional class * is needed, because one has to be aware of several "visible slices" * (selected Geometry2Ds of some SliceNavigationControllers) in order to * choose between rotation and slice selection. * * Rotation is achieved by modifying (rotating) the generated * TimeSlicedGeometry of the corresponding SliceNavigationController. * * With SlicesRotator, the rule to choose between slice rotation and * selection is simple: For a mouse down event, count the number of visible * planes, which are "near" the cursor. If this number equals 2 (one for the * window, which currently holds the cursor, one for the intersection line of * another visible slice), then initiate rotation, else select slices near * the cursor. If "LinkPlanes" is set to true, the rotation is applied to the * planes of all registered SNCs, not only of the one associated with the * directly selected plane. * * In contrast to the situation without the SlicesRotator, the * SliceNavigationControllers are now not directly registered as listeners to * GlobalInteraction. SlicesRotator is registered as a listener and decides * whether something should be rotated or whether another slice should be * selected. In the latter case, a PositionEvent is just forwarded to the * SliceNavigationController. * * \sa SlicesSwiveller */ class MITK_CORE_EXPORT SlicesRotator : public SlicesCoordinator { public: mitkClassMacro(SlicesRotator, SlicesCoordinator); static Pointer New(); /** * @brief New Macro with one parameter for creating this object with static New(..) method **/ mitkNewMacro1Param(Self, const char*); virtual void SetGeometry(const itk::EventObject& EventObject); virtual void RotateToPoint( SliceNavigationController *rotationPlaneSNC, SliceNavigationController *rotatedPlaneSNC, const Point3D &point, bool linked = false ); protected: SlicesRotator(const char* machine); // clear list of controllers virtual ~SlicesRotator(); // check if the slices of this SliceNavigationController can be rotated (???) Possible virtual void OnSliceControllerAdded(SliceNavigationController* snc); virtual void OnSliceControllerRemoved(SliceNavigationController* snc); virtual void UpdateRelevantSNCs(); virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent); SNCVector m_RelevantSNCs; /// all SNCs that currently have CreatedWorldGeometries, that can be rotated. SNCVector m_SNCsToBeRotated; /// all SNCs that will be rotated Point3D m_LastCursorPosition; Point3D m_CenterOfRotation; }; } // namespace #endif diff --git a/Core/Code/Controllers/mitkSlicesSwiveller.h b/Core/Code/Controllers/mitkSlicesSwiveller.h index d005e16792..08f4e983f5 100644 --- a/Core/Code/Controllers/mitkSlicesSwiveller.h +++ b/Core/Code/Controllers/mitkSlicesSwiveller.h @@ -1,118 +1,120 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 7707 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef SLICESSWIVELLER_H_HEADER_INCLUDED #define SLICESSWIVELLER_H_HEADER_INCLUDED #include #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { /** * \brief Enables arbitrary rotation of visible slices around a swivel point * (for sliced geometries). * \ingroup NavigationControl * * This class takes care of several SliceNavigationControllers and handles * slice selection / slice rotation. It is added as listener to * GlobalInteraction by QmitkStdMultiWidget. * * The SlicesSwiveller class adds the possibility of slice rotation to the * "normal" behaviour of SliceNavigationControllers. This additional class * is needed, because one has to be aware of several "visible slices" * (selected Geometry2Ds of some SliceNavigationControllers) in order to * choose between rotation and slice selection. * * Rotation is achieved by modifying (rotating) the generated * TimeSlicedGeometry of the corresponding SliceNavigationController. * * With SlicesSwiveller, slice rotation works as follows: the user clicks onto * a 2D view (2D plane) and drags the mouse; the relative direction and angle * of the dragged mouse movement directly effects the rotation axis and * angle. If "LinkPlanes" is set to true, the rotation is applied to the * planes of all registered SNCs, not only of the one associated with the * plane clicked on. * * In contrast to the situation without the SlicesRotator, the * SliceNavigationControllers are now not directly registered as listeners to * GlobalInteraction. SlicesRotator is registered as a listener and decides * whether something should be rotated or whether another slice should be * selected. In the latter case, a PositionEvent is just forwarded to the * SliceNavigationController. * * \sa SlicesRotator */ class MITK_CORE_EXPORT SlicesSwiveller : public SlicesCoordinator { public: mitkClassMacro(SlicesSwiveller, SlicesCoordinator); static Pointer New(); /** * @brief New Macro with one parameter for creating this object with static New(..) method **/ mitkNewMacro1Param(Self, const char*); virtual void SetGeometry(const itk::EventObject& EventObject); protected: SlicesSwiveller(const char* machine); // clear list of controllers virtual ~SlicesSwiveller(); // check if the slices of this SliceNavigationController can be rotated (???) Possible virtual void OnSliceControllerAdded(SliceNavigationController* snc); virtual void OnSliceControllerRemoved(SliceNavigationController* snc); virtual void UpdateRelevantSNCs(); virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent); /** All SNCs that currently have CreatedWorldGeometries, that can be rotated */ SNCVector m_RelevantSNCs; /** SNCs that will be rotated (clicked plane + all relevant others, if linked) */ SNCVector m_SNCsToBeRotated; Point3D m_LastCursorPosition; Point3D m_CenterOfRotation; Point2D m_ReferenceCursor; Vector3D m_RotationPlaneNormal; Vector3D m_RotationPlaneXVector; Vector3D m_RotationPlaneYVector; Vector3D m_PreviousRotationAxis; ScalarType m_PreviousRotationAngle; }; } // namespace #endif diff --git a/Core/Code/IO/mitkOperation.h b/Core/Code/IO/mitkOperation.h index ef1964f188..a8c085e34d 100644 --- a/Core/Code/IO/mitkOperation.h +++ b/Core/Code/IO/mitkOperation.h @@ -1,67 +1,70 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef OPERATION_H_HEADER_INCLUDED_C16E7D9E #define OPERATION_H_HEADER_INCLUDED_C16E7D9E #include +#pragma GCC visibility push(default) +#include +#pragma GCC visibility pop namespace mitk { typedef int OperationType ; //##Documentation //## @brief Base class of all Operation-classes //## //## @ingroup Undo class MITK_CORE_EXPORT Operation { public: //##Documentation //## Constructor Operation(OperationType operationType); virtual ~Operation(); OperationType GetOperationType(); protected: OperationType m_OperationType; }; class MITK_CORE_EXPORT OperationEndEvent : public itk::EndEvent { public: typedef OperationEndEvent Self; typedef itk::EndEvent Superclass; OperationEndEvent(Operation* operation = NULL) : m_Operation(operation) {} virtual ~OperationEndEvent() {} virtual const char * GetEventName() const { return "OperationEndEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self(m_Operation); } Operation* GetOperation() const { return m_Operation; } private: Operation* m_Operation; OperationEndEvent(const Self&); void operator=(const Self&); }; }//namespace mitk #endif /* OPERATION_H_HEADER_INCLUDED_C16E7D9E */ diff --git a/Core/Code/Rendering/mitkImageMapperGL2D.h b/Core/Code/Rendering/mitkImageMapperGL2D.h index b659b55515..20a79905df 100644 --- a/Core/Code/Rendering/mitkImageMapperGL2D.h +++ b/Core/Code/Rendering/mitkImageMapperGL2D.h @@ -1,298 +1,300 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E #define MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E #include #include "mitkGLMapper2D.h" #include "mitkBaseRenderer.h" #include #include #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include class iil4mitkPicImage; class Vtk2itk; class vtkImageReslice; class vtkLookupTable; class vtkGeneralTransform; class vtkImageChangeInformation; class vtkPoints; class vtkMitkThickSlicesFilter; namespace mitk { /** \brief Mapper to resample and display 2D slices of a 3D image. * * Currently implemented for mapping on PlaneGeometry and * AbstractTransformGeometry. The resulting 2D image (by reslicing the * underlying 3D input image appropriately) can either be directly rendered * in a 2D view or just be calculated to be used later on by another * rendering entity, e.g. in texture mapping in a 3D view. * * This results in a flipped version when used for texture mapping. Furthermore, * not the complete rectangular area described by the Geometry2D from the renderer * is resampled, @em if the Geometry2D is larger than the image dimension in the * requested direction. This results in a stretched version when used for texture * mapping. * * Properties that can be set for images and influence the imageMapper2D are: * * - \b "modality": (mitkModalityProperty) Modality of the image * - \b "opacity": (FloatProperty) Opacity of the image * - \b "color": (ColorProperty) Color of the image * - \b "use color": (BoolProperty) Use the color of the image or not * - \b "binary": (BoolProperty) is the image a binary image or not * - \b "outline binary": (BoolProperty) show outline of the image or not * - \b "texture interpolation": (BoolProperty) texture interpolation of the image * - \b "reslice interpolation": (VtkResliceInterpolationProperty) reslice interpolation of the image * - \b "in plane resample extent by geometry": (BoolProperty) Do it or not * - \b "bounding box": (BoolProperty) Is the Bounding Box of the image shown or not * - \b "layer": (IntProperty) Layer of the image * - \b "volume annotation color": (ColorProperty) color of the volume annotation * - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!) unit is ml/cm3 * The default properties are: * - \b "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite ) * - \b "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ) * - \b "use color", mitk::BoolProperty::New( true ), renderer, overwrite ) * - \b "binary", mitk::BoolProperty::New( true ), renderer, overwrite ) * - \b "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite ) * - \b "texture interpolation", mitk::BoolProperty::New( mitk::DataNodeFactory::m_TextureInterpolationActive ) ) * - \b "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() ) * - \b "in plane resample extent by geometry", mitk::BoolProperty::New( false ) ) * - \b "bounding box", mitk::BoolProperty::New( false ) ) * - \b "layer", mitk::IntProperty::New(10), renderer, overwrite) * If the modality-property is set for an image, the mapper uses modality-specific default properties, * e.g. color maps, if they are defined. * \ingroup Mapper */ class MITK_CORE_EXPORT ImageMapperGL2D : public GLMapper2D { public: /** Standard class typedefs. */ mitkClassMacro( ImageMapperGL2D,GLMapper2D ); /** Method for creation through the object factory. */ itkNewMacro(Self); /** Some convenient typedefs. */ typedef mitk::Image InputImageType; typedef InputImageType::Pointer InputImagePointer; typedef InputImageType::ConstPointer InputImageConstPointer; typedef SlicedData::RegionType InputImageRegionType; /** \brief Get the Image to map */ const InputImageType *GetInput(void); /** \brief Calls Update() for all associated renderers. */ virtual void GenerateAllData(); /** \brief Renders the (priorly) resampled image onto the screen. */ virtual void Paint( mitk::BaseRenderer *renderer ); /** \brief Checks whether this mapper needs to update itself and generate * data. */ virtual void Update(mitk::BaseRenderer * renderer); virtual void ApplyProperties(mitk::BaseRenderer* renderer); /** \brief Internal storage class for data needed for rendering into a * renderer */ class MITK_CORE_EXPORT RendererInfo { /** \brief internal id of the renderer the data is stored for */ int m_RendererID; /** \brief stored iil4mitkPicImage containing the texture to display for * 2D rendering (cf. m_Image) */ iil4mitkPicImage* m_iil4mitkImage; mitk::BaseRenderer* m_Renderer; public: /** \brief timestamp of last update of stored data */ itk::TimeStamp m_LastUpdateTime; /** \brief stored data as a mitkIpPicDescriptor */ mitkIpPicDescriptor *m_Pic; /** \brief number of pixels per mm in x- and y-direction of the resampled */ Vector2D m_PixelsPerMM; /** \brief Extent (in pixels) of the image */ Vector2D m_Extent; /** \brief Overlap (in pixels) to ensure coverage of rotated images also */ Vector2D m_Overlap; /** \brief Using unit spacing for resampling makes life easier */ vtkImageChangeInformation *m_UnitSpacingImageFilter; /** \brief The actual reslicer (one per renderer) */ vtkImageReslice *m_Reslicer; /** \brief Thickslices post filtering */ vtkMitkThickSlicesFilter *m_TSFilter; /** \brief Extracted image for 3D rendering (cf. m_iil4mitkImage) */ vtkImageData *m_Image; /** \brief Reference geometry associated with the world geometry */ const Geometry3D *m_ReferenceGeometry; bool m_TextureInterpolation; /** \brief stores the id of the observer for delete event of renderer */ unsigned long m_ObserverID; RendererInfo(); ~RendererInfo(); inline bool IsInitialized() const { return m_RendererID >= 0; } void Initialize( int rendererID, mitk::BaseRenderer *renderer, unsigned long observerID ); void Set_iil4mitkImage(iil4mitkPicImage* iil4mitkImage); inline iil4mitkPicImage* Get_iil4mitkImage() const { return m_iil4mitkImage; } inline int GetRendererID() const { return m_RendererID; } void RemoveObserver(); void Squeeze(); }; // RendererInfo /** \brief Get the internal id of the renderer * \sa RendererInfo */ virtual int GetAssociatedChannelNr( mitk::BaseRenderer *renderer ); /** \brief Get the RendererInfo for \a renderer */ const RendererInfo *GetRendererInfo( mitk::BaseRenderer *renderer ) { return &this->AccessRendererInfo(renderer); } /** \brief Release memory allocated for buffering */ virtual void Clear(); static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false); protected: ImageMapperGL2D(); virtual ~ImageMapperGL2D(); /** Does the actual resampling, without rendering the image yet. */ virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer); /** \brief Get the RendererInfo for @a renderer */ inline RendererInfo & AccessRendererInfo( mitk::BaseRenderer* renderer ) { RendererInfo& rendererInfo = m_RendererInfo[renderer]; if(rendererInfo.IsInitialized()==false) { // Add observer for renderer reset events (RendererInfo will // automatically be removed from list when a Renderer is deleted) // // Note: observer ID is passed to rendererInfo, which will take // responsiblity to remove the observer upon its destruction typedef itk::MemberCommand< ImageMapperGL2D > MemberCommandType; MemberCommandType::Pointer deleteRendererCommand = MemberCommandType::New(); deleteRendererCommand->SetCallbackFunction( this, &ImageMapperGL2D::DeleteRendererCallback ); unsigned long observerID = renderer->AddObserver( BaseRenderer::RendererResetEvent(), deleteRendererCommand ); // Initialize RendererInfo rendererInfo.Initialize( ImageMapperGL2D::numRenderer++, renderer, observerID ); } return rendererInfo; } void DeleteRendererCallback( itk::Object *object, const itk::EventObject & ); double CalculateSpacing( const mitk::Geometry3D *geometry, const mitk::Vector3D &d ) const; bool LineIntersectZero( vtkPoints *points, int p1, int p2, vtkFloatingPointType *bounds ); bool CalculateClippedPlaneBounds( const Geometry3D *boundingGeometry, const PlaneGeometry *planeGeometry, vtkFloatingPointType *bounds ); /** \brief Number of renderers data is stored for * \todo General concept for keeping data for rendering required * \todo static? */ static int numRenderer; protected: typedef std::map RendererInfoMap; /** \brief Map of instances of RendererInfo * \sa RendererInfo */ RendererInfoMap m_RendererInfo; vtkGeneralTransform *m_ComposedResliceTransform; private: int m_iil4mitkMode; }; } // namespace mitk #endif /* MITKIMAGEMAPPER2D_H_HEADER_INCLUDED_C10E906E */ diff --git a/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp index ac150a6dfa..9f13de5ccb 100644 --- a/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp +++ b/Modules/DiffusionImaging/Tractography/itkGlobalTractographyFilter.cpp @@ -1,473 +1,475 @@ #include "itkGlobalTractographyFilter.h" #include #include #include "itkPointShell.h" #include "GlobalTracking/BuildFibres.cpp" +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include #include #include #include #include #include #include "GlobalTracking/reparametrize_arclen2.cpp" #include struct LessDereference { template bool operator()(const T * lhs, const T * rhs) const { return *lhs < *rhs; } }; namespace itk{ template< class TInputOdfImage, class TInputROIImage > GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::GlobalTractographyFilter(): m_TempStart(0.1), m_TempEnd(0.001), m_NumIt(500000), m_ParticleWeight(0), m_ParticleWidth(0), m_ParticleLength(0), m_ChempotConnection(10), m_ChempotParticle(0), m_InexBalance(0), m_Chempot2(0.2), m_FiberLength(10), m_AbortTracking(false), m_NumConnections(0), m_NumParticles(0), m_NumAcceptedFibers(0), m_CurrentStep(0), m_SubtractMean(true), m_BuildFibers(false), m_Sampler(NULL), m_Steps(10), m_Memory(0), m_ProposalAcceptance(0) { //this->m_MeasurementFrame.set_identity(); this->SetNumberOfRequiredInputs(2); //Filter needs a DWI image + a Mask Image } template< class TInputOdfImage, class TInputROIImage > GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::~GlobalTractographyFilter(){ delete BESSEL_APPROXCOEFF; if (m_Sampler!=NULL) delete m_Sampler; } template< class TInputOdfImage, class TInputROIImage > void GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::ComputeFiberCorrelation(){ // float bD = 15; // vnl_matrix_fixed bDir = // *itk::PointShell >::DistributePointShell(); // const int N = QBALL_ODFSIZE; // vnl_matrix_fixed temp = bDir.transpose(); // vnl_matrix_fixed C = temp*bDir; // vnl_matrix_fixed Q = C; // vnl_vector_fixed mean; // for(int i=0; i repMean; // for (int i=0; i P = Q*Q; // std::vector pointer; // pointer.reserve(N*N); // double * start = C.data_block(); // double * end = start + N*N; // for (double * iter = start; iter != end; ++iter) // { // pointer.push_back(iter); // } // std::sort(pointer.begin(), pointer.end(), LessDereference()); // vnl_vector_fixed alpha; // vnl_vector_fixed beta; // for (int i=0; im_Meanval_sq = (sum*sum)/N; // vnl_vector_fixed alpha_0; // vnl_vector_fixed alpha_2; // vnl_vector_fixed alpha_4; // vnl_vector_fixed alpha_6; // for(int i=0; i T; // T.set_column(0,alpha_0); // T.set_column(1,alpha_2); // T.set_column(2,alpha_4); // T.set_column(3,alpha_6); // vnl_vector_fixed coeff = vnl_matrix_inverse(T).pinverse()*beta; // MITK_INFO << "Bessel oefficients: " << coeff; BESSEL_APPROXCOEFF = new float[4]; // BESSEL_APPROXCOEFF[0] = coeff(0); // BESSEL_APPROXCOEFF[1] = coeff(1); // BESSEL_APPROXCOEFF[2] = coeff(2); // BESSEL_APPROXCOEFF[3] = coeff(3); BESSEL_APPROXCOEFF[0] = -0.1714; BESSEL_APPROXCOEFF[1] = 0.5332; BESSEL_APPROXCOEFF[2] = -1.4889; BESSEL_APPROXCOEFF[3] = 2.0389; } // build fibers from tracking result template< class TInputOdfImage, class TInputROIImage > void GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::BuildFibers(float* points, int numPoints) { MITK_INFO << "Building fibers ..."; typename InputQBallImageType::Pointer odfImage = dynamic_cast(this->GetInput(0)); double spacing[3]; spacing[0] = odfImage->GetSpacing().GetElement(0); spacing[1] = odfImage->GetSpacing().GetElement(1); spacing[2] = odfImage->GetSpacing().GetElement(2); // initialize array of particles CCAnalysis ccana(points, numPoints, spacing); // label the particles according to fiber affiliation and return number of fibers int numFibers = ccana.iterate(m_FiberLength); if (numFibers<=0){ MITK_INFO << "0 fibers accepted"; return; } // fill output datastructure m_FiberBundle.clear(); for (int i = 0; i < numFibers; i++) { vector< Particle* >* particleContainer = ccana.m_FiberContainer->at(i); // resample fibers std::vector< Particle* >* pCon = ResampleFibers(particleContainer, 0.9*spacing[0]); FiberTractType tract; for (int j=0; jsize(); j++) { Particle* particle = pCon->at(j); pVector p = particle->R; itk::Point point; point[0] = p[0]-0.5; point[1] = p[1]-0.5; point[2] = p[2]-0.5; tract.push_back(point); delete(particle); } m_FiberBundle.push_back(tract); delete(pCon); } m_NumAcceptedFibers = numFibers; MITK_INFO << "itkGlobalTractographyFilter: " << numFibers << " fibers accepted"; } // fill output fiber bundle datastructure template< class TInputOdfImage, class TInputROIImage > typename GlobalTractographyFilter< TInputOdfImage, TInputROIImage >::FiberBundleType* GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::GetFiberBundle() { if (!m_AbortTracking) { m_BuildFibers = true; while (m_BuildFibers){} } return &m_FiberBundle; } // get memory allocated for particle grid template< class TInputOdfImage, class TInputROIImage > float GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::GetMemoryUsage() { if (m_Sampler!=NULL) return m_Sampler->m_ParticleGrid.GetMemoryUsage(); return 0; } // perform global tracking template< class TInputOdfImage, class TInputROIImage > void GlobalTractographyFilter< TInputOdfImage, TInputROIImage > ::GenerateData(){ // input qball image m_ItkQBallImage = dynamic_cast(this->GetInput(0)); // approximationscoeffizienten der // teilchenkorrelationen im orientierungsraum // 4er vektor ComputeFiberCorrelation(); // image sizes and spacing int qBallImageSize[4] = {QBALL_ODFSIZE, m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(0), m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(1), m_ItkQBallImage->GetLargestPossibleRegion().GetSize().GetElement(2)}; double qBallImageSpacing[3] = {m_ItkQBallImage->GetSpacing().GetElement(0),m_ItkQBallImage->GetSpacing().GetElement(1),m_ItkQBallImage->GetSpacing().GetElement(2)}; // make sure image has enough slices if (qBallImageSize[1]<3 || qBallImageSize[2]<3 || qBallImageSize[3]<3) { MITK_INFO << "image size < 3 not supported"; return; } // calculate rotation matrix vnl_matrix_fixed directionMatrix = m_ItkQBallImage->GetDirection().GetVnlMatrix(); vnl_vector_fixed d0 = directionMatrix.get_column(0); d0.normalize(); vnl_vector_fixed d1 = directionMatrix.get_column(1); d1.normalize(); vnl_vector_fixed d2 = directionMatrix.get_column(2); d2.normalize(); directionMatrix.set_column(0, d0); directionMatrix.set_column(1, d1); directionMatrix.set_column(2, d2); vnl_matrix_fixed I = directionMatrix*directionMatrix.transpose(); if(!I.is_identity(mitk::eps)){ MITK_INFO << "Image direction is not a rotation matrix. Tracking not possible!"; return; } // generate local working copy of image buffer int bufferSize = qBallImageSize[0]*qBallImageSize[1]*qBallImageSize[2]*qBallImageSize[3]; float* qBallImageBuffer = (float*) m_ItkQBallImage->GetBufferPointer(); float* workingQballImage = new float[bufferSize]; for (int i=0; i0 && i%qBallImageSize[0] == 0 && i>0) { sum /= qBallImageSize[0]; for (int j=i-qBallImageSize[0]; jGetBufferPointer(); maskImageSize[0] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(0); maskImageSize[1] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(1); maskImageSize[2] = m_MaskImage->GetLargestPossibleRegion().GetSize().GetElement(2); } else { mask = 0; maskImageSize[0] = qBallImageSize[1]; maskImageSize[1] = qBallImageSize[2]; maskImageSize[2] = qBallImageSize[3]; } int mask_oversamp_mult = maskImageSize[0]/qBallImageSize[1]; // load lookuptable ifstream BaryCoords; BaryCoords.open("FiberTrackingLUTBaryCoords.bin", ios::in | ios::binary); float* coords; if (BaryCoords.is_open()) { float tmp; coords = new float [1630818]; BaryCoords.seekg (0, ios::beg); for (int i=0; i<1630818; i++) { BaryCoords.read((char *)&tmp, sizeof(tmp)); coords[i] = tmp; } BaryCoords.close(); } else { MITK_INFO << "Unable to open barycoords file"; return; } ifstream Indices; Indices.open("FiberTrackingLUTIndices.bin", ios::in | ios::binary); int* ind; if (Indices.is_open()) { int tmp; ind = new int [1630818]; Indices.seekg (0, ios::beg); for (int i=0; i<1630818; i++) { Indices.read((char *)&tmp, 4); ind[i] = tmp; } Indices.close(); } else { MITK_INFO << "Unable to open indices file"; return; } // initialize sphere interpolator with lookuptables SphereInterpolator *sinterp = new SphereInterpolator(coords, ind, QBALL_ODFSIZE, 301, 0.5); // get paramters float minSpacing; if(qBallImageSpacing[0]m_NumIt) { MITK_INFO << "not enough iterations!"; return; } unsigned long singleIts = (unsigned long)((1.0*m_NumIt) / (1.0*m_Steps)); // setup metropolis hastings sampler MITK_INFO << "itkGlobalTractographyFilter: setting up MH-sampler"; if (m_Sampler!=NULL) delete m_Sampler; m_Sampler = new RJMCMC(NULL, 0, workingQballImage, qBallImageSize, qBallImageSpacing, cellsize); // setup energy computer MITK_INFO << "itkGlobalTractographyFilter: setting up Energy-computer"; EnergyComputer encomp(workingQballImage,qBallImageSize,qBallImageSpacing,sinterp,&(m_Sampler->m_ParticleGrid),mask,mask_oversamp_mult, directionMatrix); encomp.setParameters(m_ParticleWeight,m_ParticleWidth,m_ChempotConnection*m_ParticleLength*m_ParticleLength,m_ParticleLength,curvatureHardThreshold,m_InexBalance,m_Chempot2); m_Sampler->SetEnergyComputer(&encomp); m_Sampler->SetParameters(m_TempStart,singleIts,m_ParticleLength,curvatureHardThreshold,m_ChempotParticle); // main loop for( int step = 0; step < m_Steps; step++ ) { if (m_AbortTracking) break; m_CurrentStep = step+1; float temperature = m_TempStart * exp(alpha*(((1.0)*step)/((1.0)*m_Steps))); MITK_INFO << "iterating step " << m_CurrentStep; m_Sampler->SetTemperature(temperature); m_Sampler->Iterate(&m_ProposalAcceptance, &m_NumConnections, &m_NumParticles, &m_AbortTracking); MITK_INFO << "proposal acceptance: " << 100*m_ProposalAcceptance << "%"; MITK_INFO << "particles: " << m_NumParticles; MITK_INFO << "connections: " << m_NumConnections; MITK_INFO << "progress: " << 100*(float)step/m_Steps << "%"; if (m_BuildFibers) { int numPoints = m_Sampler->m_ParticleGrid.pcnt; float* points = new float[numPoints*m_Sampler->m_NumAttributes]; m_Sampler->WriteOutParticles(points); BuildFibers(points, numPoints); delete points; m_BuildFibers = false; } } int numPoints = m_Sampler->m_ParticleGrid.pcnt; float* points = new float[numPoints*m_Sampler->m_NumAttributes]; m_Sampler->WriteOutParticles(points); BuildFibers(points, numPoints); delete points; delete sinterp; delete coords; delete ind; delete workingQballImage; m_AbortTracking = true; m_BuildFibers = false; MITK_INFO << "done generate data"; } } diff --git a/Modules/MitkExt/Algorithms/mitkNonBlockingAlgorithmEvents.h b/Modules/MitkExt/Algorithms/mitkNonBlockingAlgorithmEvents.h index fe7aa80f2b..e90c3b807d 100644 --- a/Modules/MitkExt/Algorithms/mitkNonBlockingAlgorithmEvents.h +++ b/Modules/MitkExt/Algorithms/mitkNonBlockingAlgorithmEvents.h @@ -1,104 +1,106 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED #define MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include "MitkExtExports.h" namespace mitk { class NonBlockingAlgorithm; class MitkExt_EXPORT NonBlockingAlgorithmEvent : public itk::AnyEvent { public: typedef NonBlockingAlgorithmEvent Self; typedef itk::AnyEvent Superclass; NonBlockingAlgorithmEvent( const NonBlockingAlgorithm* algorithm = NULL ) : m_Algorithm(algorithm) {} virtual ~NonBlockingAlgorithmEvent() {} virtual const char * GetEventName() const { return "NonBlockingAlgorithmEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_Algorithm ); } const mitk::NonBlockingAlgorithm* GetAlgorithm() const { return m_Algorithm.GetPointer(); } NonBlockingAlgorithmEvent(const Self& s) : itk::AnyEvent(s), m_Algorithm(s.m_Algorithm) {}; protected: mitk::NonBlockingAlgorithm::ConstPointer m_Algorithm; private: void operator=(const Self&); }; class MitkExt_EXPORT ResultAvailable : public NonBlockingAlgorithmEvent { public: ResultAvailable( const NonBlockingAlgorithm* algorithm = NULL ) : NonBlockingAlgorithmEvent(algorithm) { } virtual ~ResultAvailable() { } }; class MitkExt_EXPORT ProcessingError : public NonBlockingAlgorithmEvent { public: ProcessingError( const NonBlockingAlgorithm* algorithm = NULL ) : NonBlockingAlgorithmEvent(algorithm) { } virtual ~ProcessingError() { } }; } #endif diff --git a/Modules/MitkExt/Controllers/mitkToolManager.h b/Modules/MitkExt/Controllers/mitkToolManager.h index 7e5c4bdae8..d0d5ffeedb 100644 --- a/Modules/MitkExt/Controllers/mitkToolManager.h +++ b/Modules/MitkExt/Controllers/mitkToolManager.h @@ -1,285 +1,287 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef mitkToolManager_h_Included #define mitkToolManager_h_Included #include "mitkTool.h" #include "MitkExtExports.h" #include "mitkDataNode.h" #include "mitkDataStorage.h" #include "mitkWeakPointer.h" +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include #include namespace mitk { class Image; class PlaneGeometry; /** \brief Manages and coordinates instances of mitk::Tool. \sa QmitkToolSelectionBox \sa QmitkToolReferenceDataSelectionBox \sa QmitkToolWorkingDataSelectionBox \sa Tool \sa QmitkSegmentationView \ingroup Interaction \ingroup ToolManagerEtAl There is a separate page describing the general design of QmitkSegmentationView: \ref QmitkSegmentationTechnicalPage This class creates and manages several instances of mitk::Tool. \li ToolManager creates instances of mitk::Tool by asking the itk::ObjectFactory to list all known implementations of mitk::Tool. As a result, one has to implement both a subclass of mitk::Tool and a matching subclass of itk::ObjectFactoryBase that is registered to the top-level itk::ObjectFactory. For an example, see mitkContourToolFactory.h. (this limitiation of one-class-one-factory is due to the implementation of itk::ObjectFactory). In MITK, the right place to register the factories to itk::ObjectFactory is the mitk::QMCoreObjectFactory or mitk::SBCoreObjectFactory. \li One (and only one - or none at all) of the registered tools can be activated using ActivateTool. This tool is registered to mitk::GlobalInteraction as a listener and will receive all mouse clicks and keyboard strokes that get into the MITK event mechanism. Tools are automatically unregistered from GlobalInteraction when no clients are registered to ToolManager (see RegisterClient()). \li ToolManager knows a set of "reference" DataNodes and a set of "working" DataNodes. The first application are segmentation tools, where the reference is the original image and the working data the (kind of) binary segmentation. However, ToolManager is implemented more generally, so that there could be other tools that work, e.g., with surfaces. \li Any "user/client" of ToolManager, i.e. every functionality that wants to use a tool, should call RegisterClient when the tools should be active. ToolManager keeps track of how many clients want it to be used, and when this count reaches zero, it unregistes the active Tool from GlobalInteraction. In "normal" settings, the functionality does not need to care about that if it uses a QmitkToolSelectionBox, which does exactly that when it is enabled/disabled. \li There is a set of events that are sent by ToolManager. At the moment these are TODO update documentation: - mitk::ToolReferenceDataChangedEvent whenever somebody calls SetReferenceData. Most of the time this actually means that the data has changed, but there might be cases where the same data is passed to SetReferenceData a second time, so don't rely on the assumption that something actually changed. - mitk::ToolSelectedEvent is sent when a (truly) different tool was activated. In reaction to this event you can ask for the active Tool using GetActiveTool or GetActiveToolID (where NULL or -1 indicate that NO tool is active at the moment). Design descisions: \li Not a singleton, because there could be two functionalities using tools, each one with different reference/working data. $Author$ */ class MitkExt_EXPORT ToolManager : public itk::Object { public: typedef std::vector ToolVectorType; typedef std::vector ToolVectorTypeConst; typedef std::vector DataVectorType; // has to be observed for delete events! typedef std::map NodeTagMapType; Message<> NodePropertiesChanged; Message<> NewNodesGenerated; Message1 NewNodeObjectsGenerated; Message<> ActiveToolChanged; Message<> ReferenceDataChanged; Message<> WorkingDataChanged; Message<> RoiDataChanged; Message1 ToolErrorMessage; Message1 GeneralToolMessage; mitkClassMacro(ToolManager, itk::Object); mitkNewMacro1Param(ToolManager, DataStorage*); /** \brief Gives you a list of all tools. This is const on purpose. */ const ToolVectorTypeConst GetTools(); int GetToolID( const Tool* tool ); /* \param id The tool of interest. Counting starts with 0. */ Tool* GetToolById(int id); /** \param id The tool to activate. Provide -1 for disabling any tools. Counting starts with 0. */ bool ActivateTool(int id); template int GetToolIdByToolType() { int id = 0; for ( ToolVectorType::iterator iter = m_Tools.begin(); iter != m_Tools.end(); ++iter, ++id ) { if ( dynamic_cast(iter->GetPointer()) ) { return id; } } return -1; } /** \return -1 for "No tool is active" */ int GetActiveToolID(); /** \return NULL for "No tool is active" */ Tool* GetActiveTool(); /* \brief Set a list of data/images as reference objects. */ void SetReferenceData(DataVectorType); /* \brief Set single data item/image as reference object. */ void SetReferenceData(DataNode*); /* \brief Set a list of data/images as working objects. */ void SetWorkingData(DataVectorType); /* \brief Set single data item/image as working object. */ void SetWorkingData(DataNode*); /* \brief Set a list of data/images as roi objects. */ void SetRoiData(DataVectorType); /* \brief Set a single data item/image as roi object. */ void SetRoiData(DataNode*); /* \brief Get the list of reference data. */ DataVectorType GetReferenceData(); /* \brief Get the current reference data. \warning If there is a list of items, this method will only return the first list item. */ DataNode* GetReferenceData(int); /* \brief Get the list of working data. */ DataVectorType GetWorkingData(); /* \brief Get the current working data. \warning If there is a list of items, this method will only return the first list item. */ DataNode* GetWorkingData(int); /* \brief Get the current roi data */ DataVectorType GetRoiData(); /* \brief Get the roi data at position idx */ DataNode* GetRoiData(int idx); DataStorage* GetDataStorage(); void SetDataStorage(DataStorage& storage); /* \brief Tell that someone is using tools. GUI elements should call this when they become active. This method increases an internal "client count". Tools are only registered to GlobalInteraction when this count is greater than 0. This is useful to automatically deactivate tools when you hide their GUI elements. */ void RegisterClient(); /* \brief Tell that someone is NOT using tools. GUI elements should call this when they become active. This method increases an internal "client count". Tools are only registered to GlobalInteraction when this count is greater than 0. This is useful to automatically deactivate tools when you hide their GUI elements. */ void UnregisterClient(); void OnOneOfTheReferenceDataDeletedConst(const itk::Object* caller, const itk::EventObject& e); void OnOneOfTheReferenceDataDeleted (itk::Object* caller, const itk::EventObject& e); void OnOneOfTheWorkingDataDeletedConst(const itk::Object* caller, const itk::EventObject& e); void OnOneOfTheWorkingDataDeleted (itk::Object* caller, const itk::EventObject& e); void OnOneOfTheRoiDataDeletedConst(const itk::Object* caller, const itk::EventObject& e); void OnOneOfTheRoiDataDeleted (itk::Object* caller, const itk::EventObject& e); /* \brief Connected to tool's messages This method just resends error messages coming from any of the tools. This way clients (GUIs) only have to observe one message. */ void OnToolErrorMessage(std::string s); void OnGeneralToolMessage(std::string s); protected: /** You may specify a list of tool "groups" that should be available for this ToolManager. Every Tool can report its group as a string. This constructor will try to find the tool's group inside the supplied string. If there is a match, the tool is accepted. Effectively, you can provide a human readable list like "default, lymphnodevolumetry, oldERISstuff". */ ToolManager(DataStorage* storage); // purposely hidden virtual ~ToolManager(); ToolVectorType m_Tools; Tool* m_ActiveTool; int m_ActiveToolID; DataVectorType m_ReferenceData; NodeTagMapType m_ReferenceDataObserverTags; DataVectorType m_WorkingData; NodeTagMapType m_WorkingDataObserverTags; DataVectorType m_RoiData; NodeTagMapType m_RoiDataObserverTags; int m_RegisteredClients; WeakPointer m_DataStorage; }; } // namespace #endif diff --git a/Modules/MitkExt/DataManagement/mitkDataStorageSelection.h b/Modules/MitkExt/DataManagement/mitkDataStorageSelection.h index 4612e71090..daf3b94c54 100644 --- a/Modules/MitkExt/DataManagement/mitkDataStorageSelection.h +++ b/Modules/MitkExt/DataManagement/mitkDataStorageSelection.h @@ -1,191 +1,193 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef mitkDataStorageSelection_h #define mitkDataStorageSelection_h #include #include "MitkExtExports.h" #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include #include namespace mitk { class BaseProperty; class PropertyList; class MitkExt_EXPORT DataStorageSelection: public itk::Object { public: typedef std::vector Nodes; typedef Message1 DataNodeEvent; DataNodeEvent NodeChanged; DataNodeEvent NodeAdded; DataNodeEvent NodeRemoved; Message2 PropertyChanged; mitkClassMacro(DataStorageSelection, itk::Object); mitkNewMacro2Param(DataStorageSelection, DataStorage*, bool); mitkNewMacro3Param(DataStorageSelection, DataStorage*, NodePredicateBase*, bool); protected: DataStorageSelection(mitk::DataStorage* _DataStorage, bool _AutoAddNodes); DataStorageSelection(mitk::DataStorage* _DataStorage , mitk::NodePredicateBase* _Predicate, bool _AutoAddNodes); public: virtual ~DataStorageSelection(); /// /// Get the DataStorage. /// mitk::DataStorage::Pointer GetDataStorage() const; /// /// Get the predicate. /// mitk::NodePredicateBase::Pointer GetPredicate() const; /// /// Returns the size of this selection /// unsigned int GetSize() const; /// /// Get node at a specific model index. /// mitk::DataNode::Pointer GetNode(unsigned int index) const; /// /// Returns the first node, same as calling GetNode(0) /// mitk::DataNode::Pointer GetNode() const; /// /// Returns a copy of the node-vector /// std::vector GetNodes() const; /// /// \see m_AutoAddNodes /// bool DoesAutoAddNodes() const; public: /// /// Removes all nodes, sets node as new first element /// DataStorageSelection& operator=(mitk::DataNode* node); /// /// Removes all nodes, sets node as new first element /// DataStorageSelection& operator=(mitk::DataNode::Pointer node); /// /// Sets the DataStorage. /// virtual void SetDataStorage(mitk::DataStorage* _DataStorage); /// /// Sets the predicate. QmitkDataStorageTableModel is owner of the predicate! /// virtual void SetPredicate(mitk::NodePredicateBase* _Predicate); /// /// Add a node (if not already there) /// virtual void AddNode(const mitk::DataNode* node); /// /// Removes a node /// virtual void RemoveNode(const mitk::DataNode* node); /// /// Removes a node /// virtual void RemoveAllNodes(); /// /// Called whenever an itk Object this class holds gets deleted or modified /// virtual void ObjectChanged(const itk::Object *caller, const itk::EventObject &event); protected: /// /// Find a node in the list by the given prop /// mitk::DataNode::Pointer FindNode(const mitk::BaseProperty* prop) const; /// /// Find a node in the list by the given proplist /// mitk::DataNode::Pointer FindNode(const mitk::PropertyList* propList) const; /// /// Removes all nodes and fill the vector again /// void Reset(); /// /// If a node is already in this list, all listeners will be removed /// void RemoveListener(mitk::DataNode* node); /// /// Adds listeners for modified/delete event, for the propertylists /// modified/delete and for the modified/delete event of each property /// and stores listener tags /// void AddListener(mitk::DataNode* node); protected: /// /// Pointer to the DataStorage from which the nodes are selected /// mitk::DataStorage* m_DataStorage; /// /// DeleteTag for the DataStorage /// unsigned int m_DataStorageDeletedTag; /// /// Holds the predicate that defines this SubSet of Nodes. If m_Predicate /// is NULL all Nodes will be selected. /// mitk::NodePredicateBase::Pointer m_Predicate; /// /// Holds all selected Nodes. /// std::vector m_Nodes; /// /// \brief Maps a node to a modified observer tag. /// std::map m_NodeModifiedObserverTags; /// /// \brief Maps a propertylist to a modified observer tag. /// std::map m_PropertyListModifiedObserverTags; /// /// \brief Maps a propertylist to a delete observer tag. /// std::map m_PropertyListDeletedObserverTags; /// /// \brief Maps a property to a modified observer tag. /// std::map m_PropertyModifiedObserverTags; /// /// \brief Maps a property to a delete observer tag. /// std::map m_PropertyDeletedObserverTags; /// /// If set to true no event processing will be performed /// bool m_SelfCall; /// /// Saves if new nodes are automatically added to this selection /// bool m_AutoAddNodes; }; } #endif // mitkDataStorageSelection_h diff --git a/Modules/MitkExt/DataManagement/mitkDataTreeFilterEvents.h b/Modules/MitkExt/DataManagement/mitkDataTreeFilterEvents.h index 0c046ffbe5..cf69d3ac87 100644 --- a/Modules/MitkExt/DataManagement/mitkDataTreeFilterEvents.h +++ b/Modules/MitkExt/DataManagement/mitkDataTreeFilterEvents.h @@ -1,289 +1,291 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_DATATREEFILTEREVENTS_H_INCLUDED #define MITK_DATATREEFILTEREVENTS_H_INCLUDED +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include "MitkExtExports.h" namespace mitk { //------ TreeFilterUpdateAllEvent -------------------------------------------------------- #pragma GCC visibility push(default) itkEventMacro( TreeFilterUpdateAllEvent, itk::ModifiedEvent ); itkEventMacro( TreeFilterRemoveAllEvent, itk::ModifiedEvent ); #pragma GCC visibility pop //------ TreeFilterItemEvent ------------------------------------------------------------- class MitkExt_EXPORT TreeFilterItemEvent : public itk::ModifiedEvent { public: typedef TreeFilterItemEvent Self; typedef itk::ModifiedEvent Superclass; TreeFilterItemEvent() : m_ChangedItem( NULL ){} TreeFilterItemEvent( const mitk::DataTreeFilter::Item* item ) : m_ChangedItem(item) {} virtual ~TreeFilterItemEvent() {} virtual const char * GetEventName() const { return "TreeFilterItemEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } const mitk::DataTreeFilter::Item* GetChangedItem() const { return m_ChangedItem; } TreeFilterItemEvent(const Self& s) : itk::ModifiedEvent(s), m_ChangedItem(s.m_ChangedItem) {}; protected: const mitk::DataTreeFilter::Item* m_ChangedItem; private: void operator=(const Self&); }; //------ TreeFilterEvent -------------------------------------------------------- class MitkExt_EXPORT TreeFilterNewItemEvent : public TreeFilterItemEvent { public: typedef TreeFilterNewItemEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterNewItemEvent() : TreeFilterItemEvent() {} TreeFilterNewItemEvent(const mitk::DataTreeFilter::Item* item) : TreeFilterItemEvent(item) {} virtual ~TreeFilterNewItemEvent() {} virtual const char * GetEventName() const { return "TreeFilterNewItemEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } TreeFilterNewItemEvent(const Self& s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); }; //------ TreeFilterItemAddedEvent -------------------------------------------------------- class MitkExt_EXPORT TreeFilterItemAddedEvent : public TreeFilterItemEvent { public: typedef TreeFilterItemAddedEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterItemAddedEvent() : TreeFilterItemEvent() {} TreeFilterItemAddedEvent(const mitk::DataTreeFilter::Item* item) : TreeFilterItemEvent(item) {} virtual ~TreeFilterItemAddedEvent() {} virtual const char * GetEventName() const { return "TreeFilterItemAddedEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } TreeFilterItemAddedEvent(const Self& s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); }; //------ TreeFilterSelectionChangedEvent ------------------------------------------------- class MitkExt_EXPORT TreeFilterSelectionChangedEvent : public TreeFilterItemEvent { public: typedef TreeFilterSelectionChangedEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterSelectionChangedEvent() : TreeFilterItemEvent() {} TreeFilterSelectionChangedEvent(const mitk::DataTreeFilter::Item* item, bool selected) : TreeFilterItemEvent(item), m_Selected(selected) {} virtual ~TreeFilterSelectionChangedEvent() {} virtual const char * GetEventName() const { return "TreeFilterSelectionChangedEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem, m_Selected ); } virtual bool IsSelected() const { return m_Selected; } TreeFilterSelectionChangedEvent(const Self&s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); bool m_Selected; }; //------ TreeFilterItemChangedEvent ------------------------------------------------------ class MitkExt_EXPORT TreeFilterItemChangedEvent : public TreeFilterItemEvent { public: typedef TreeFilterItemChangedEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterItemChangedEvent() : TreeFilterItemEvent() {} TreeFilterItemChangedEvent(const mitk::DataTreeFilter::Item* item) : TreeFilterItemEvent(item) {} virtual ~TreeFilterItemChangedEvent() {} virtual const char * GetEventName() const { return "TreeFilterItemChangedEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } TreeFilterItemChangedEvent(const Self&s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); }; //------ TreeFilterRemoveItemEvent ------------------------------------------------------- class MitkExt_EXPORT TreeFilterRemoveItemEvent : public TreeFilterItemEvent { public: typedef TreeFilterRemoveItemEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterRemoveItemEvent() : TreeFilterItemEvent() {} TreeFilterRemoveItemEvent(const mitk::DataTreeFilter::Item* item) : TreeFilterItemEvent(item) {} virtual ~TreeFilterRemoveItemEvent() {} virtual const char * GetEventName() const { return "TreeFilterRemoveItemEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } TreeFilterRemoveItemEvent(const Self&s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); }; //------ TreeFilterRemoveChildrenEvent ------------------------------------------------------- class MitkExt_EXPORT TreeFilterRemoveChildrenEvent : public TreeFilterItemEvent { public: typedef TreeFilterRemoveChildrenEvent Self; typedef TreeFilterItemEvent Superclass; TreeFilterRemoveChildrenEvent() : TreeFilterItemEvent() {} TreeFilterRemoveChildrenEvent(const mitk::DataTreeFilter::Item* item) : TreeFilterItemEvent(item) {} virtual ~TreeFilterRemoveChildrenEvent() {} virtual const char * GetEventName() const { return "TreeFilterRemoveChildrenEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_ChangedItem ); } TreeFilterRemoveChildrenEvent(const Self&s) : TreeFilterItemEvent(s) {}; private: void operator=(const Self&); }; } #endif diff --git a/Modules/MitkExt/DataManagement/mitkPropertyObserver.h b/Modules/MitkExt/DataManagement/mitkPropertyObserver.h index 11e2192c1f..9734a61f22 100644 --- a/Modules/MitkExt/DataManagement/mitkPropertyObserver.h +++ b/Modules/MitkExt/DataManagement/mitkPropertyObserver.h @@ -1,95 +1,97 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_BASEPROPERTYOBSERVER_H_INCLUDED #define MITK_BASEPROPERTYOBSERVER_H_INCLUDED +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include "MitkExtExports.h" #include "mitkCommon.h" namespace mitk { /** \brief Convenience class to observe changes of a mitk::BaseProperty. This class registers itself as an ITK observer to a BaseProperty and gets informed of changes to the property. Whenever such a change occurrs, the virtual method PropertyChanged() or PropertyRemoved() is called. This way, derived classes can implement behaviour for more specific properties (e.g. ColorProperty) without the need to reimplement the Subject-Observer handling. */ class BaseProperty; class MitkExt_EXPORT PropertyObserver { public: PropertyObserver(); virtual ~PropertyObserver(); virtual void PropertyChanged() = 0; virtual void PropertyRemoved() = 0; protected: void BeginModifyProperty(); void EndModifyProperty(); unsigned long m_ModifiedTag; unsigned long m_DeleteTag; bool m_SelfCall; }; class MitkExt_EXPORT PropertyView : public PropertyObserver { public: PropertyView( const mitk::BaseProperty* ); virtual ~PropertyView(); void OnModified(const itk::EventObject& e); void OnDelete(const itk::EventObject& e); protected: const mitk::BaseProperty* m_Property; }; class MitkExt_EXPORT PropertyEditor : public PropertyObserver { public: PropertyEditor( mitk::BaseProperty* ); virtual ~PropertyEditor(); void OnModified(const itk::EventObject& e); void OnDelete(const itk::EventObject& e); protected: mitk::BaseProperty* m_Property; }; } #endif diff --git a/Modules/MitkExt/IO/mitkPACSPluginEvents.h b/Modules/MitkExt/IO/mitkPACSPluginEvents.h index 61fb2b4949..6abd8e6dc0 100644 --- a/Modules/MitkExt/IO/mitkPACSPluginEvents.h +++ b/Modules/MitkExt/IO/mitkPACSPluginEvents.h @@ -1,35 +1,37 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 14120 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef mitkPACSPluginEventshincluded #define mitkPACSPluginEventshincluded #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { #pragma GCC visibility push(default) itkEventMacro( PluginEvent, itk::AnyEvent ); itkEventMacro( PluginStudySelected, PluginEvent ); itkEventMacro( PluginLightBoxCountChanged, PluginEvent ); itkEventMacro( PluginAbortPACSImport, PluginEvent ); #pragma GCC visibility pop } #endif diff --git a/Modules/MitkExt/Interactions/mitkToolEvents.h b/Modules/MitkExt/Interactions/mitkToolEvents.h index 1958025aef..7ac6a41b84 100644 --- a/Modules/MitkExt/Interactions/mitkToolEvents.h +++ b/Modules/MitkExt/Interactions/mitkToolEvents.h @@ -1,293 +1,295 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 1.12 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITK_TOOL_EVENTS_H #define MITK_TOOL_EVENTS_H +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { /** \brief Basic tool event without any parameters Can simply be inherited using the itkEventMacro, e.g. \code namespace mitk { class MyTool : public Tool { public: itkEventMacro(MySpecialEvent, ToolEvent); [...] protected: // Invoke your event like this void YourExampleMethod() { InvokeEvent( MySpecialEvent() ); } }; } \endcode */ #pragma GCC visibility push(default) itkEventMacro( ToolEvent, itk::ModifiedEvent ); #pragma GCC visibility pop /** \brief Tool event with 1 parameter Can store one parameter for use within an observer. To derive your own special events, use the mitkToolEventMacro1Param macro. \code namespace mitk { class MyTool : public Tool { public: mitkToolEventMacro1Param(FooToolEvent, int); [...] protected: // Invoke your event like this void YourExampleMethod() { InvokeEvent( FooToolEvent(32) ); } }; } \endcode */ template class ParameterToolEvent : public ToolEvent { public: typedef ParameterToolEvent Self; typedef ToolEvent Superclass; ParameterToolEvent( const T parameter ) : m_Parameter(parameter) { } ParameterToolEvent(const Self& s) : ToolEvent(s), m_Parameter(s.m_Parameter) { } virtual ~ParameterToolEvent() { } virtual const char * GetEventName() const { return "ParameterToolEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_Parameter ); } const T GetParameter() const { return m_Parameter; } protected: const T m_Parameter; private: ParameterToolEvent(); void operator=(const Self&); }; /** \brief Tool event with 1 parameter Can store one parameter for use within an observer. To derive your own special events, use the mitkToolEventMacro1Param macro. \code namespace mitk { class MyTool : public Tool { public: mitkToolEventMacro1Param(FooToolEvent, int); [...] protected: // Invoke your event like this void YourExampleMethod() { InvokeEvent( BarToolEvent(32, false) ); } }; } \endcode */ template class TwoParameterToolEvent : public ToolEvent { public: typedef TwoParameterToolEvent Self; typedef ToolEvent Superclass; TwoParameterToolEvent( const T parameter1, const U parameter2 ) : m_Parameter1(parameter1), m_Parameter2(parameter2) { } TwoParameterToolEvent(const Self& s) : ToolEvent(s), m_Parameter1(s.m_Parameter1), m_Parameter2(s.m_Parameter2) { } virtual ~TwoParameterToolEvent() { } virtual const char * GetEventName() const { return "TwoParameterToolEvent"; } virtual bool CheckEvent(const ::itk::EventObject* e) const { return dynamic_cast(e); } virtual ::itk::EventObject* MakeObject() const { return new Self( m_Parameter1, m_Parameter2 ); } const T GetParameter1() const { return m_Parameter1; } const T GetParameter2() const { return m_Parameter2; } protected: const T m_Parameter1; const U m_Parameter2; private: TwoParameterToolEvent(); void operator=(const Self&); }; typedef ParameterToolEvent IntegerToolEvent; typedef ParameterToolEvent FloatToolEvent; typedef ParameterToolEvent BoolToolEvent; } // namespace // some macros to let tools define their own event classes as inner classes (should then inherit from something like FloatToolEvent // inheritance, because it allows observers to distinguish events #define mitkToolEventMacro( eventname, baseevent ) \ class eventname : public baseevent \ { \ virtual const char * GetEventName() const \ { \ return #eventname ; \ } \ }; #define mitkToolEventMacro1Param( eventname, paramtype1 ) \ class eventname : public ParameterToolEvent \ { \ public: \ virtual const char * GetEventName() const \ { \ return #eventname "(" #paramtype1 ")" ; \ } \ \ eventname( const paramtype1 parameter ) \ : ParameterToolEvent(parameter) \ { \ } \ \ private: \ \ eventname();\ }; #define mitkToolEventMacro2Param( eventname, paramtype1, paramtype2 ) \ class eventname : public TwoParameterToolEvent \ { \ public: \ virtual const char * GetEventName() const \ { \ return #eventname "(" #paramtype1 "," #paramtype2 ")" ; \ } \ \ eventname( const paramtype1 parameter1, const paramtype2 parameter2 ) \ : TwoParameterToolEvent(parameter1, parameter2) \ { \ } \ \ private: \ \ eventname();\ }; #endif diff --git a/Modules/PlanarFigure/Interactions/mitkPlanarFigureInteractor.h b/Modules/PlanarFigure/Interactions/mitkPlanarFigureInteractor.h index 95d6ccdbe6..eba9581e2a 100644 --- a/Modules/PlanarFigure/Interactions/mitkPlanarFigureInteractor.h +++ b/Modules/PlanarFigure/Interactions/mitkPlanarFigureInteractor.h @@ -1,150 +1,152 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-04-18 20:20:25 +0200 (Sa, 18 Apr 2009) $ Version: $Revision: 13129 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED #define MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED #include "PlanarFigureExports.h" #include "mitkCommon.h" #include "mitkVector.h" #include "mitkInteractor.h" #include "mitkBaseRenderer.h" +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { class DataNode; class Geometry2D; class DisplayGeometry; class PlanarFigure; class PositionEvent; #pragma GCC visibility push(default) // Define events for PlanarFigure interaction notifications itkEventMacro( PlanarFigureEvent, itk::AnyEvent ); itkEventMacro( StartPlacementPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( EndPlacementPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( SelectPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( StartInteractionPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( EndInteractionPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( StartHoverPlanarFigureEvent, PlanarFigureEvent ); itkEventMacro( EndHoverPlanarFigureEvent, PlanarFigureEvent ); #pragma GCC visibility pop /** * \brief Interaction with mitk::PlanarFigure objects via control-points * * \ingroup Interaction */ class PlanarFigure_EXPORT PlanarFigureInteractor : public Interactor { public: mitkClassMacro(PlanarFigureInteractor, Interactor); mitkNewMacro3Param(Self, const char *, DataNode *, int); mitkNewMacro2Param(Self, const char *, DataNode *); /** \brief Sets the amount of precision */ void SetPrecision( ScalarType precision ); /** * \brief calculates how good the data, this statemachine handles, is hit * by the event. * * overwritten, cause we don't look at the boundingbox, we look at each point */ virtual float CanHandleEvent(StateEvent const *stateEvent) const; protected: /** * \brief Constructor with Param n for limited Set of Points * * if no n is set, then the number of points is unlimited* */ PlanarFigureInteractor(const char *type, DataNode *dataNode, int n = -1); /** * \brief Default Destructor **/ virtual ~PlanarFigureInteractor(); virtual bool ExecuteAction( Action *action, mitk::StateEvent const *stateEvent ); /** \brief Used when clicking to determine if a point is too close to the previous point. */ bool IsMousePositionAcceptableAsNewControlPoint( const PositionEvent*, const PlanarFigure* ); bool TransformPositionEventToPoint2D( const StateEvent *stateEvent, Point2D &point2D, const Geometry2D *planarFigureGeometry ); bool TransformObjectToDisplay( const mitk::Point2D &point2D, mitk::Point2D &displayPoint, const mitk::Geometry2D *objectGeometry, const mitk::Geometry2D *rendererGeometry, const mitk::DisplayGeometry *displayGeometry ) const; /** \brief Returns true if the first specified point is in proximity of the line defined * the other two point; false otherwise. * * Proximity is defined as the rectangle around the line with pre-defined distance * from the line. */ bool IsPointNearLine( const mitk::Point2D& point, const mitk::Point2D& startPoint, const mitk::Point2D& endPoint, mitk::Point2D& projectedPoint ) const; /** \brief Returns true if the point contained in the passed event (in display coordinates) * is over the planar figure (with a pre-defined tolerance range); false otherwise. */ int IsPositionOverFigure( const StateEvent *StateEvent, PlanarFigure *planarFigure, const Geometry2D *planarFigureGeometry, const Geometry2D *rendererGeometry, const DisplayGeometry *displayGeometry, Point2D& pointProjectedOntoLine) const; /** \brief Returns the index of the marker (control point) over which the point contained * in the passed event (in display coordinates) currently is; -1 if the point is not over * a marker. */ int IsPositionInsideMarker( const StateEvent *StateEvent, const PlanarFigure *planarFigure, const Geometry2D *planarFigureGeometry, const Geometry2D *rendererGeometry, const DisplayGeometry *displayGeometry ) const; void LogPrintPlanarFigureQuantities( const PlanarFigure *planarFigure ); private: /** \brief to store the value of precision to pick a point */ ScalarType m_Precision; /** \brief True if the mouse is currently hovering over the image. */ bool m_IsHovering; }; } #endif // MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED diff --git a/Modules/ToFHardware/mitkToFImageRecorder.cpp b/Modules/ToFHardware/mitkToFImageRecorder.cpp index ce18e6f73d..8a9c424d50 100644 --- a/Modules/ToFHardware/mitkToFImageRecorder.cpp +++ b/Modules/ToFHardware/mitkToFImageRecorder.cpp @@ -1,235 +1,237 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $ Version: $Revision: $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkToFImageRecorder.h" #include "mitkRealTimeClock.h" #include "itkMultiThreader.h" #include +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop namespace mitk { ToFImageRecorder::ToFImageRecorder() { this->m_ToFCameraDevice = NULL; this->m_MultiThreader = itk::MultiThreader::New(); this->m_AbortMutex = itk::FastMutexLock::New(); this->m_ThreadID = 0; this->m_NumOfFrames = 0; this->m_ToFImageWriter = NULL; this->m_DistanceImageSelected = true; this->m_AmplitudeImageSelected = true; this->m_IntensityImageSelected = true; this->m_Abort = true; this->m_CaptureWidth = 0; this->m_CaptureHeight = 0; this->m_FileFormat = ""; this->m_PixelNumber = 0; this->m_SourceDataSize = 0; this->m_ToFImageType = ToFImageWriter::ToFImageType3D; this->m_RecordMode = ToFImageRecorder::PerFrames; this->m_DistanceImageFileName = ""; this->m_AmplitudeImageFileName = ""; this->m_IntensityImageFileName = ""; this->m_ImageSequence = 0; this->m_DistanceArray = NULL; this->m_AmplitudeArray = NULL; this->m_IntensityArray = NULL; this->m_SourceDataArray = NULL; } ToFImageRecorder::~ToFImageRecorder() { delete[] m_DistanceArray; delete[] m_AmplitudeArray; delete[] m_IntensityArray; delete[] m_SourceDataArray; } void ToFImageRecorder::StopRecording() { this->m_AbortMutex->Lock(); this->m_Abort = true; this->m_AbortMutex->Unlock(); } void ToFImageRecorder::StartRecording() { if (this->m_ToFCameraDevice.IsNull()) { throw std::invalid_argument("ToFCameraDevice is NULL."); return; } if (this->m_FileFormat.compare("csv") == 0) { this->m_ToFImageWriter = ToFImageCsvWriter::New(); } else { this->m_ToFImageWriter = ToFImageWriter::New(); } this->m_CaptureWidth = this->m_ToFCameraDevice->GetCaptureWidth(); this->m_CaptureHeight = this->m_ToFCameraDevice->GetCaptureHeight(); this->m_PixelNumber = this->m_CaptureWidth * this->m_CaptureHeight; this->m_SourceDataSize = this->m_ToFCameraDevice->GetSourceDataSize(); // allocate buffer if(m_IntensityArray == NULL) { this->m_IntensityArray = new float[m_PixelNumber]; } if(this->m_DistanceArray == NULL) { this->m_DistanceArray = new float[m_PixelNumber]; } if(this->m_AmplitudeArray == NULL) { this->m_AmplitudeArray = new float[m_PixelNumber]; } if(this->m_SourceDataArray == NULL) { this->m_SourceDataArray = new char[m_SourceDataSize]; } this->m_ToFImageWriter->SetDistanceImageFileName(this->m_DistanceImageFileName); this->m_ToFImageWriter->SetAmplitudeImageFileName(this->m_AmplitudeImageFileName); this->m_ToFImageWriter->SetIntensityImageFileName(this->m_IntensityImageFileName); this->m_ToFImageWriter->SetCaptureWidth(this->m_CaptureWidth); this->m_ToFImageWriter->SetCaptureHeight(this->m_CaptureHeight); this->m_ToFImageWriter->SetToFImageType(this->m_ToFImageType); this->m_ToFImageWriter->SetDistanceImageSelected(this->m_DistanceImageSelected); this->m_ToFImageWriter->SetAmplitudeImageSelected(this->m_AmplitudeImageSelected); this->m_ToFImageWriter->SetIntensityImageSelected(this->m_IntensityImageSelected); this->m_ToFImageWriter->Open(); this->m_AbortMutex->Lock(); this->m_Abort = false; this->m_AbortMutex->Unlock(); this->m_ThreadID = this->m_MultiThreader->SpawnThread(this->RecordData, this); } ITK_THREAD_RETURN_TYPE ToFImageRecorder::RecordData(void* pInfoStruct) { struct itk::MultiThreader::ThreadInfoStruct * pInfo = (struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct; if (pInfo == NULL) { return ITK_THREAD_RETURN_VALUE; } if (pInfo->UserData == NULL) { return ITK_THREAD_RETURN_VALUE; } ToFImageRecorder* toFImageRecorder = (ToFImageRecorder*)pInfo->UserData; if (toFImageRecorder!=NULL) { ToFCameraDevice::Pointer toFCameraDevice = toFImageRecorder->GetCameraDevice(); mitk::RealTimeClock::Pointer realTimeClock; realTimeClock = mitk::RealTimeClock::New(); int n = 100; double t1 = 0; double t2 = 0; t1 = realTimeClock->GetCurrentStamp(); bool overflow = false; bool printStatus = false; int requiredImageSequence = 0; int numOfFramesRecorded = 0; bool abort = false; toFImageRecorder->m_AbortMutex->Lock(); abort = toFImageRecorder->m_Abort; toFImageRecorder->m_AbortMutex->Unlock(); while ( !abort ) { if ( ((toFImageRecorder->m_RecordMode == ToFImageRecorder::PerFrames) && (numOfFramesRecorded < toFImageRecorder->m_NumOfFrames)) || (toFImageRecorder->m_RecordMode == ToFImageRecorder::Infinite) ) { toFCameraDevice->GetAllImages(toFImageRecorder->m_DistanceArray, toFImageRecorder->m_AmplitudeArray, toFImageRecorder->m_IntensityArray, toFImageRecorder->m_SourceDataArray, requiredImageSequence, toFImageRecorder->m_ImageSequence ); if (toFImageRecorder->m_ImageSequence >= requiredImageSequence) { if (toFImageRecorder->m_ImageSequence > requiredImageSequence) { MITK_INFO << "Problem! required: " << requiredImageSequence << " captured: " << toFImageRecorder->m_ImageSequence; } requiredImageSequence = toFImageRecorder->m_ImageSequence + 1; toFImageRecorder->m_ToFImageWriter->Add( toFImageRecorder->m_DistanceArray, toFImageRecorder->m_AmplitudeArray, toFImageRecorder->m_IntensityArray ); numOfFramesRecorded++; if (numOfFramesRecorded % n == 0) { printStatus = true; } if (printStatus) { t2 = realTimeClock->GetCurrentStamp() - t1; MITK_INFO << " Framerate (fps): " << n / (t2/1000) << " Sequence: " << toFImageRecorder->m_ImageSequence; t1 = realTimeClock->GetCurrentStamp(); printStatus = false; } } toFImageRecorder->m_AbortMutex->Lock(); abort = toFImageRecorder->m_Abort; toFImageRecorder->m_AbortMutex->Unlock(); } else { abort = true; } } // end of while loop toFImageRecorder->InvokeEvent(itk::AbortEvent()); toFImageRecorder->m_ToFImageWriter->Close(); } return ITK_THREAD_RETURN_VALUE; } void ToFImageRecorder::SetCameraDevice(ToFCameraDevice* aToFCameraDevice) { this->m_ToFCameraDevice = aToFCameraDevice; } ToFCameraDevice* ToFImageRecorder::GetCameraDevice() { return this->m_ToFCameraDevice; } ToFImageWriter::ToFImageType ToFImageRecorder::GetToFImageType() { return this->m_ToFImageType; } void ToFImageRecorder::SetToFImageType(ToFImageWriter::ToFImageType toFImageType) { this->m_ToFImageType = toFImageType; } ToFImageRecorder::RecordMode ToFImageRecorder::GetRecordMode() { return this->m_RecordMode; } void ToFImageRecorder::SetRecordMode(ToFImageRecorder::RecordMode recordMode) { this->m_RecordMode = recordMode; } } diff --git a/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.cpp b/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.cpp index d394238e61..e6a0dfe2f6 100644 --- a/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.cpp +++ b/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.cpp @@ -1,379 +1,381 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2009-05-20 13:35:09 +0200 (Mi, 20 Mai 2009) $ Version: $Revision: 17332 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #define _USE_MATH_DEFINES #include "QmitkToFRecorderWidget.h" //QT headers #include #include #include #include #include #include //mitk headers #include //itk headers +#pragma GCC visibility push(default) #include +#pragma GCC visibility pop #include struct QFileDialogArgs; class QFileDialogPrivate; const std::string QmitkToFRecorderWidget::VIEW_ID = "org.mitk.views.qmitktofrecorderwidget"; QmitkToFRecorderWidget::QmitkToFRecorderWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) { this->m_ToFImageRecorder = NULL; this->m_ToFImageGrabber = NULL; this->m_RecordMode = mitk::ToFImageRecorder::PerFrames; this-> m_Controls = NULL; CreateQtPartControl(this); } QmitkToFRecorderWidget::~QmitkToFRecorderWidget() { } void QmitkToFRecorderWidget::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets this->m_Controls = new Ui::QmitkToFRecorderWidgetControls; this->m_Controls->setupUi(parent); this->CreateConnections(); } } void QmitkToFRecorderWidget::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->m_PlayButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnPlay()) ); connect( (QObject*)(m_Controls->m_StopButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnStop()) ); connect( (QObject*)(m_Controls->m_StartRecordingButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnStartRecorder()) ); connect( (QObject*)(m_Controls->m_RecordModeComboBox), SIGNAL(currentIndexChanged(int)),(QObject*) this, SLOT(OnChangeRecordModeComboBox(int)) ); connect(this, SIGNAL(RecordingStopped()), this, SLOT(OnRecordingStopped()), Qt::BlockingQueuedConnection); } } void QmitkToFRecorderWidget::SetParameter(mitk::ToFImageGrabber* ToFImageGrabber, mitk::ToFImageRecorder* toFImageRecorder) { this->m_ToFImageGrabber = ToFImageGrabber; this->m_ToFImageRecorder = toFImageRecorder; this->m_StopRecordingCommand = CommandType::New(); this->m_StopRecordingCommand->SetCallbackFunction(this, &QmitkToFRecorderWidget::StopRecordingCallback); this->m_ToFImageRecorder->RemoveAllObservers(); this->m_ToFImageRecorder->AddObserver(itk::AbortEvent(), this->m_StopRecordingCommand); m_Controls->m_PlayButton->setChecked(false); m_Controls->m_PlayButton->setEnabled(true); m_Controls->m_StartRecordingButton->setChecked(false); m_Controls->m_RecorderGroupBox->setEnabled(true); } void QmitkToFRecorderWidget::StopRecordingCallback() { emit RecordingStopped(); } void QmitkToFRecorderWidget::ResetGUIToInitial() { m_Controls->m_PlayButton->setChecked(false); m_Controls->m_PlayButton->setEnabled(true); m_Controls->m_RecorderGroupBox->setEnabled(false); } void QmitkToFRecorderWidget::OnRecordingStopped() { m_Controls->m_StartRecordingButton->setChecked(false); m_Controls->m_RecorderGroupBox->setEnabled(true); } void QmitkToFRecorderWidget::OnStop() { StopCamera(); StopRecorder(); ResetGUIToInitial(); emit ToFCameraStopped(); } void QmitkToFRecorderWidget::OnPlay() { m_Controls->m_PlayButton->setChecked(true); m_Controls->m_PlayButton->setEnabled(false); m_Controls->m_RecorderGroupBox->setEnabled(true); this->repaint(); StartCamera(); emit ToFCameraStarted(); } void QmitkToFRecorderWidget::StartCamera() { bool ok = false; if (!m_ToFImageGrabber->IsCameraActive()) { m_ToFImageGrabber->StartCamera(); } } void QmitkToFRecorderWidget::StopCamera() { m_ToFImageGrabber->StopCamera(); } void QmitkToFRecorderWidget::StopRecorder() { this->m_ToFImageRecorder->StopRecording(); } void QmitkToFRecorderWidget::OnStartRecorder() { m_Controls->m_StartRecordingButton->setChecked(true); m_Controls->m_RecorderGroupBox->setEnabled(false); this->repaint(); int numOfFrames = m_Controls->m_NumOfFramesSpinBox->value(); try { bool fileOK = true; bool distanceImageSelected = true; bool amplitudeImageSelected = true; bool intensityImageSelected = true; bool rawDataSelected = false; QString tmpFileName(""); QString selectedFilter(""); QString imageFileName(""); mitk::ToFImageWriter::ToFImageType tofImageType; tmpFileName = QmitkToFRecorderWidget::getSaveFileName(tofImageType, distanceImageSelected, amplitudeImageSelected, intensityImageSelected, rawDataSelected, NULL, "Save Image To...", imageFileName, "MITK Images (*.pic);;Text (*.csv)", &selectedFilter); if (tmpFileName.isEmpty()) { fileOK = false; } else { imageFileName = tmpFileName; } if (fileOK) { std::string dir = itksys::SystemTools::GetFilenamePath( imageFileName.toStdString() ); std::string baseFilename = itksys::SystemTools::GetFilenameWithoutLastExtension( imageFileName.toStdString() ); std::string extension = itksys::SystemTools::GetFilenameLastExtension( imageFileName.toStdString() ); int integrationTime = this->m_ToFImageGrabber->GetIntegrationTime(); int modulationFreq = this->m_ToFImageGrabber->GetModulationFrequency(); QString integrationTimeStr; integrationTimeStr.setNum(integrationTime); QString modulationFreqStr; modulationFreqStr.setNum(modulationFreq); QString numOfFramesStr(""); if (this->m_RecordMode == mitk::ToFImageRecorder::PerFrames) { numOfFramesStr.setNum(numOfFrames); } std::string distImageFileName = prepareFilename(dir, baseFilename, modulationFreqStr.toStdString(), integrationTimeStr.toStdString(), numOfFramesStr.toStdString(), extension, "_DistanceImage"); MITK_INFO << "Save distance data to: " << distImageFileName; std::string amplImageFileName = prepareFilename(dir, baseFilename, modulationFreqStr.toStdString(), integrationTimeStr.toStdString(), numOfFramesStr.toStdString(), extension, "_AmplitudeImage"); MITK_INFO << "Save amplitude data to: " << amplImageFileName; std::string intenImageFileName = prepareFilename(dir, baseFilename, modulationFreqStr.toStdString(), integrationTimeStr.toStdString(), numOfFramesStr.toStdString(), extension, "_IntensityImage"); MITK_INFO << "Save intensity data to: " << intenImageFileName; if (selectedFilter.compare("Text (*.csv)") == 0) { this->m_ToFImageRecorder->SetFileFormat("csv"); } else { //default this->m_ToFImageRecorder->SetFileFormat("pic"); } numOfFrames = m_Controls->m_NumOfFramesSpinBox->value(); this->m_ToFImageRecorder->SetDistanceImageFileName(distImageFileName); this->m_ToFImageRecorder->SetAmplitudeImageFileName(amplImageFileName); this->m_ToFImageRecorder->SetIntensityImageFileName(intenImageFileName); this->m_ToFImageRecorder->SetToFImageType(tofImageType); this->m_ToFImageRecorder->SetDistanceImageSelected(distanceImageSelected); this->m_ToFImageRecorder->SetAmplitudeImageSelected(amplitudeImageSelected); this->m_ToFImageRecorder->SetIntensityImageSelected(intensityImageSelected); this->m_ToFImageRecorder->SetRecordMode(this->m_RecordMode); this->m_ToFImageRecorder->SetNumOfFrames(numOfFrames); this->m_ToFImageRecorder->StartRecording(); } else { OnRecordingStopped(); } } catch(std::exception& e) { QMessageBox::critical(NULL, "Error", QString(e.what())); OnRecordingStopped(); } } QString QmitkToFRecorderWidget::getSaveFileName(mitk::ToFImageWriter::ToFImageType& tofImageType, bool& distanceImageSelected, bool& amplitudeImageSelected, bool& intensityImageSelected, bool& rawDataSelected, QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options ) { QString selectedFileName = ""; QComboBox* combo = new QComboBox; combo->addItem("3D"); combo->addItem("2D + t"); QHBoxLayout* checkBoxGroup = new QHBoxLayout(); QCheckBox* distanceImageCheckBox = new QCheckBox; distanceImageCheckBox->setText("Distance image"); distanceImageCheckBox->setChecked(true); QCheckBox* amplitudeImageCheckBox = new QCheckBox; amplitudeImageCheckBox->setText("Amplitude image"); amplitudeImageCheckBox->setChecked(true); QCheckBox* intensityImageCheckBox = new QCheckBox; intensityImageCheckBox->setText("Intensity image"); intensityImageCheckBox->setChecked(true); QCheckBox* rawDataCheckBox = new QCheckBox; rawDataCheckBox->setText("Raw data"); rawDataCheckBox->setChecked(false); rawDataCheckBox->setEnabled(false); checkBoxGroup->addWidget(distanceImageCheckBox); checkBoxGroup->addWidget(amplitudeImageCheckBox); checkBoxGroup->addWidget(intensityImageCheckBox); checkBoxGroup->addWidget(rawDataCheckBox); QFileDialog* fileDialog = new QFileDialog(parent, caption, dir, filter); QLayout* layout = fileDialog->layout(); QGridLayout* gridbox = qobject_cast(layout); if (gridbox) { gridbox->addWidget(new QLabel("ToF-Image type:")); gridbox->addWidget(combo); int lastRow = gridbox->rowCount(); gridbox->addLayout(checkBoxGroup, lastRow, 0, 1, -1); } fileDialog->setLayout(gridbox); fileDialog->setAcceptMode(QFileDialog::AcceptSave); if (selectedFilter) { fileDialog->selectNameFilter(*selectedFilter); } if (fileDialog->exec() == QDialog::Accepted) { if (selectedFilter) { *selectedFilter = fileDialog->selectedFilter(); } if (combo->currentIndex() == 0) { tofImageType = mitk::ToFImageWriter::ToFImageType3D; } else { tofImageType = mitk::ToFImageWriter::ToFImageType2DPlusT; } distanceImageSelected = distanceImageCheckBox->isChecked(); amplitudeImageSelected = amplitudeImageCheckBox->isChecked(); intensityImageSelected = intensityImageCheckBox->isChecked(); rawDataSelected = rawDataCheckBox->isChecked(); selectedFileName = fileDialog->selectedFiles().value(0); } delete fileDialog; return selectedFileName; } std::string QmitkToFRecorderWidget::prepareFilename(std::string dir, std::string baseFilename, std::string modulationFreq, std::string integrationTime, std::string numOfFrames, std::string extension, std::string imageType) { std::string filenName(""); filenName.append(dir); filenName.append("/"); filenName.append(baseFilename); filenName.append("_MF"); filenName.append(modulationFreq); filenName.append("_IT"); filenName.append(integrationTime); filenName.append("_"); filenName.append(numOfFrames); filenName.append("Images"); filenName.append(imageType); filenName.append(extension); return filenName; } void QmitkToFRecorderWidget::OnChangeRecordModeComboBox(int index) { if (index == 0) { this->m_RecordMode = mitk::ToFImageRecorder::PerFrames; m_Controls->m_NumOfFramesSpinBox->setEnabled(true); } else { this->m_RecordMode = mitk::ToFImageRecorder::Infinite; m_Controls->m_NumOfFramesSpinBox->setEnabled(false); } } diff --git a/Wrapping/CSwig/Core/wrap_mitkCommonSuperclasses.cxx b/Wrapping/CSwig/Core/wrap_mitkCommonSuperclasses.cxx index 22cec6b759..6396822453 100644 --- a/Wrapping/CSwig/Core/wrap_mitkCommonSuperclasses.cxx +++ b/Wrapping/CSwig/Core/wrap_mitkCommonSuperclasses.cxx @@ -1,37 +1,39 @@ #include "mitkCommon.h" #include "mitkBaseProcess.h" #include "mitkCSwigMacros.h" #include "mbilog.h" #include "itkObject.h" #include "itkDataObject.h" #include "itkProcessObject.h" #include "itkLightObject.h" #include "itkObjectFactoryBase.h" -#include "itkEventObject.h" +#pragma GCC visibility push(default) +#include +#pragma GCC visibility pop #include "itkSmartPointerForwardReference.h" #include "itkAffineTransform.h" #include "itkMatrixOffsetTransformBase.h" #ifdef CABLE_CONFIGURATION namespace _cable_ { const char* const group="CommonSuperclasses"; namespace wrappers { ITK_WRAP_OBJECT(Object) ITK_WRAP_OBJECT(DataObject) ITK_WRAP_OBJECT(ProcessObject) ITK_WRAP_OBJECT(LightObject) ITK_WRAP_OBJECT(ObjectFactoryBase) typedef itk::EndEvent::EndEvent EndEvent; typedef mbilog::AbstractBackend::AbstractBackend AbstractBackend; typedef itk::AffineTransform::AffineTransform AffineTransform_F3U; typedef itk::AffineTransform::Pointer::SmartPointer AffineTransform_F3U_Pointer; typedef itk::MatrixOffsetTransformBase::MatrixOffsetTransformBase MatrixOffsetTransformBase_F3U3U; typedef itk::MatrixOffsetTransformBase::Pointer::SmartPointer MatrixOffsetTransformBase_F3U3U_Pointer; } } #endif