diff --git a/Modules/Qmitk/Documentation/Doxygen/Modules.dox b/Modules/Qmitk/Documentation/Doxygen/Modules.dox new file mode 100644 index 0000000000..8ad60c754c --- /dev/null +++ b/Modules/Qmitk/Documentation/Doxygen/Modules.dox @@ -0,0 +1,22 @@ +/** + \defgroup QmitkModule Qmitk + \ingroup MITKModules + + \brief Basic Qt widgets and classes for MITK. + + This module provides a set of Qt widgets and classes generally useful for + any MITK application. The main widgets are: + + - QmitkLevelWindowWidget + - QmitkProgressBar + - QmitkRenderWindow + - QmitkStdMultiWidget + + A couple of Qt models for use in the model/view architecture of Qt are also + provided. Among them are: + + - QmitkDataStorageListModel + - QmitkDataStorageTableModel + - QmitkDataStorageTreeModel + - QmitkPropertiesTableModel +*/ diff --git a/Modules/Qmitk/QmitkApplicationCursor.h b/Modules/Qmitk/QmitkApplicationCursor.h index bebfb5ff8c..9742cf7bfe 100644 --- a/Modules/Qmitk/QmitkApplicationCursor.h +++ b/Modules/Qmitk/QmitkApplicationCursor.h @@ -1,47 +1,48 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITK_APPLICATION_CURSOR_H_INCLUDED #define QMITK_APPLICATION_CURSOR_H_INCLUDED #include #include "mitkApplicationCursor.h" /*! + \ingroup QmitkModule \brief Qt specific implementation of ApplicationCursorImplementation This class very simply calls the QApplication's methods setOverrideCursor() and restoreOverrideCursor(). */ class QMITK_EXPORT QmitkApplicationCursor : public mitk::ApplicationCursorImplementation { public: // Will be instantiated automatically from QmitkApplicationCursor.cpp once QmitkApplicationCursor(); virtual void PushCursor(const char* XPM[], int hotspotX, int hotspotY); virtual void PopCursor(); virtual const mitk::Point2I GetCursorPosition(); virtual void SetCursorPosition(const mitk::Point2I&); protected: private: }; #endif diff --git a/Modules/Qmitk/QmitkDataStorageComboBox.h b/Modules/Qmitk/QmitkDataStorageComboBox.h index 0ece83d2ba..635ea5685d 100644 --- a/Modules/Qmitk/QmitkDataStorageComboBox.h +++ b/Modules/Qmitk/QmitkDataStorageComboBox.h @@ -1,241 +1,242 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDataStorageComboBox_h #define QmitkDataStorageComboBox_h #include // Own Includes #include "mitkDataStorage.h" #include "mitkDataNode.h" #include "mitkWeakPointer.h" #include "mitkNodePredicateBase.h" // Toolkit Includes #include #include // Forward Declartions /// +/// \ingroup QmitkModule /// \class QmitkDataStorageComboBox /// \author Michael Mueller /// \version 4.0 /// \date 2009-02-09 /// \ingroup Widgets /// \brief Displays all or a subset (defined by a predicate) of nodes of the Data Storage. /// /// Dont forget that this class inherits from QComboBox and you can therefore use the whole API of QComboBox. /// class QMITK_EXPORT QmitkDataStorageComboBox : public QComboBox { //#CLASS-MACROS,FRIENDS Q_OBJECT //#CTORS/DTOR public: /// /// \brief Ctor for an empty combobox. Use setDataStorage and setPredicate afterwards. /// QmitkDataStorageComboBox(QWidget* parent = 0, bool _AutoSelectNewNodes=false); /// /// \brief Ctor for constructing QmitkDataStorageComboBox with given DataStorageComboBox and given _Predicate. /// QmitkDataStorageComboBox( mitk::DataStorage* _DataStorage, const mitk::NodePredicateBase* _Predicate, QWidget* parent = 0, bool _AutoSelectNewNodes=false); /// /// \brief Standard Dtor. Nothing to do here. /// ~QmitkDataStorageComboBox(); /// /// \brief Seaches for a given node and returns a valid index or -1 if the node was not found. /// int Find( const mitk::DataNode* _DataNode ) const; //#PUBLIC GETTER public: /// /// \brief Get the DataStorage this ComboBox listens to. /// mitk::DataStorage::Pointer GetDataStorage() const; /// /// \brief Return the predicate (may be NULL) that is responsible for the _DataNode selection of this ComboBox. /// const mitk::NodePredicateBase::ConstPointer GetPredicate() const; /// /// \brief Returns the _DataNode at Index index or 0 if the index is out of bounds. /// mitk::DataNode::Pointer GetNode(int index) const; /// /// \brief Returns the selected _DataNode or 0 if there is none. /// mitk::DataNode::Pointer GetSelectedNode() const; /// /// \brief Returns all nodes that are stored in this combobox. /// mitk::DataStorage::SetOfObjects::ConstPointer GetNodes() const; /// /// Returns the AutoSelectNewItems. /// \see SetAutoSelectNewItems /// virtual bool GetAutoSelectNewItems(); //#PUBLIC SETTER public: /// /// \brief Set the DataStorage this ComboBox should listen to. /// /// If DataStorage is 0 nothing will be shown. If DataStorage is re-set the combobox will be resetted. void SetDataStorage(mitk::DataStorage* dataStorage); /// /// \brief Set the predicate for this ComboBox. (QmitkDataStorageComboBox is now owner of the predicate) /// /// If predicate is NULL all nodes will be selected. If predicate changes the whole combobox will be resetted. void SetPredicate(const mitk::NodePredicateBase* _Predicate); /// /// Adds a node to the ComboBox. Gets called everytime a DataStorage Add Event was thrown. /// virtual void AddNode(const mitk::DataNode* _DataNode); /// /// Removes a node from the ComboBox at a specified index (if the index exists). Gets called when a DataStorage Remove Event was thrown. /// virtual void RemoveNode(int index); /// /// Removes a node from the ComboBox. Gets called when a DataStorage Remove Event was thrown. /// virtual void RemoveNode(const mitk::DataNode* _DataNode); /// /// Set a _DataNode in the ComboBox at the specified index (if the index exists). /// Internally the method just calls RemoveNode(unsigned int) /// virtual void SetNode(int index, const mitk::DataNode* _DataNode); /// /// Replaces a _DataNode in the combobox by an _OtherDataNode. /// Internally the method just calls SetNode(unsigned int, mitk::DataNode*) /// virtual void SetNode(const mitk::DataNode* _DataNode, const mitk::DataNode* _OtherDataNode); /// /// Sets AutoSelectNewItems flag. If set to true new Nodes will be automatically selected. Default is false. /// virtual void SetAutoSelectNewItems(bool _AutoSelectNewItems); /// /// \brief Called when a node is deleted or the name property of the node was modified. Calls RemoveNode or SetNode then. /// virtual void OnDataNodeDeleteOrModified(const itk::Object *caller, const itk::EventObject &event); signals: /// /// \brief Throw a signal when the _DataNode selection changed. /// void OnSelectionChanged(const mitk::DataNode*); //#PROTECTED GETTER protected: /// /// \brief Checks if the given index is within the range of the m_Nodes vector. /// bool HasIndex(unsigned int index) const; //#PROTECTED SETTER protected slots: /// /// \brief Slot for signal when the user selects another item. /// void OnCurrentIndexChanged(int); //#PUBLIC SETTER public slots: /// /// \brief Slot for signal when user wants to set a node as current selected node. /// void SetSelectedNode(mitk::DataNode::Pointer item); protected: /// /// \brief Inserts a new node at the given index. If the index does not exist, the _DataNode is simply appended to the combobox. /// /// This function is used by AddNode() and SetNode() because they just to the same: /// 1. If node is replaced (that is when index exists), /// the itk::Event observer will be removed /// 2. Check Node against Predicate /// 3. Register for itk::Events on the node /// 4. Insert Node and show in combobox virtual void InsertNode(int index, const mitk::DataNode* _DataNode); /// /// \brief Init-function this class with the given dataStorage and _Predicate. This function is called by all ctors. /// void Init(); /// /// \brief Reset function whenever datastorage or predicate changes. /// void Reset(); protected: //#PROTECTED MEMBER VARS /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// mitk::WeakPointer m_DataStorage; /// /// \brief Holds the predicate that is responsible for the _DataNode selection of this ComboBox. /// If the predicate is 0, every _DataNode will be selected. /// mitk::NodePredicateBase::ConstPointer m_Predicate; /// /// Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class. /// std::vector m_Nodes; /// /// \brief Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) /// std::vector m_NodesModifiedObserverTags; /// /// \brief Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) /// std::vector m_NodesDeleteObserverTags; /// /// \brief Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated node /// whenever the name property of a node changed. /// std::map m_PropertyToNode; /// /// \brief Event function guard. Each function which is called by an event mechanism /// first checks if this is true in order to avoid endless loops. bool m_BlockEvents; /// /// \brief If set to "true" new Nodes will be automatically selected. bool m_AutoSelectNewNodes; }; #endif // QmitkDataStorageComboBox_h diff --git a/Modules/Qmitk/QmitkDataStorageListModel.h b/Modules/Qmitk/QmitkDataStorageListModel.h index 44a7c55697..8fbf016e3b 100755 --- a/Modules/Qmitk/QmitkDataStorageListModel.h +++ b/Modules/Qmitk/QmitkDataStorageListModel.h @@ -1,125 +1,126 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKDATASTORAGELISTMODEL_H_ #define QMITKDATASTORAGELISTMODEL_H_ #include //# Own includes // mitk #include "mitkDataStorage.h" #include "mitkNodePredicateBase.h" // Qmitk //# Toolkit includes // Qt #include // stl #include +/// \ingroup QmitkModule class QMITK_EXPORT QmitkDataStorageListModel: public QAbstractListModel { public: //# Ctors / Dtor /// /// The NodePredicate is owned by the model /// QmitkDataStorageListModel(mitk::DataStorage::Pointer dataStorage = 0, mitk::NodePredicateBase* pred = 0, QObject* parent = 0); ~QmitkDataStorageListModel(); //# Getter / Setter void SetDataStorage(mitk::DataStorage::Pointer dataStorage); mitk::DataStorage::Pointer GetDataStorage() const; void SetPredicate(mitk::NodePredicateBase* pred); mitk::NodePredicateBase* GetPredicate() const; std::vector GetDataNodes() const; mitk::DataNode::Pointer getNode(const QModelIndex &index) const; //# From QAbstractListModel Qt::ItemFlags flags(const QModelIndex& index) const; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; /// /// Called when a DataStorage Add Event was thrown. May be reimplemented /// by deriving classes. /// virtual void NodeAdded(const mitk::DataNode* node); /// /// Called when a DataStorage Remove Event was thrown. May be reimplemented /// by deriving classes. /// virtual void NodeRemoved(const mitk::DataNode* node); /// /// \brief Called when a itk::Object that is hold as a member variable was /// modified in order to react to it. /// virtual void OnModified(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Called when a itk::Object that is hold as a member variable is about to be /// deleted in order to react to it. /// virtual void OnDelete(const itk::Object *caller, const itk::EventObject &event); protected: /// /// \brief Resets the whole model. Get all nodes matching the predicate from the data storage. /// void reset(); /// /// Holds the predicate that defines this SubSet of Nodes. If m_Predicate /// is NULL all Nodes will be selected. *Attention: this class owns the predicate and deletes it* /// mitk::NodePredicateBase::Pointer m_NodePredicate; /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// mitk::DataStorage* m_DataStorage; /// /// \brief Holds the tag of the datastorage-delete observer. /// unsigned long m_DataStorageDeleteObserverTag; /// /// Holds all selected Nodes. Dont hold smart pointer as we are in a GUI class. /// std::vector m_DataNodes; /// /// \brief Holds the tags of the node-modified observers. /// std::vector m_DataNodesModifiedObserversTags; /// /// Saves if this model is currently working on events to prevent endless event loops. /// bool m_BlockEvents; }; #endif /* QMITKDATASTORAGELISTMODEL_H_ */ diff --git a/Modules/Qmitk/QmitkDataStorageTableModel.h b/Modules/Qmitk/QmitkDataStorageTableModel.h index 3c511bd747..fac0b03a69 100644 --- a/Modules/Qmitk/QmitkDataStorageTableModel.h +++ b/Modules/Qmitk/QmitkDataStorageTableModel.h @@ -1,228 +1,229 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDataStorageTableModel_h #define QmitkDataStorageTableModel_h #include /// Own includes. #include "mitkDataStorage.h" #include "mitkBaseProperty.h" #include "mitkWeakPointer.h" #include "mitkNodePredicateBase.h" /// Toolkit includes. #include /// Forward declarations. /// +/// \ingroup QmitkModule /// \class QmitkDataStorageTableModel /// /// \brief A table model for a set of DataNodes defined by a predicate. /// \TODO make columns interchangeable, select which properties to show as columns /// class QMITK_EXPORT QmitkDataStorageTableModel : public QAbstractTableModel { Q_OBJECT //#Ctors/Dtor public: /// /// Constructs a new QmitkDataStorageTableModel and sets a predicate that defines /// this list. /// \see setPredicate() /// QmitkDataStorageTableModel(mitk::DataStorage::Pointer _DataStorage, mitk::NodePredicateBase* _Predicate = 0 , QObject* parent = 0 ); /// /// Standard dtor. Delete predicate, disconnect from DataStorage. /// virtual ~QmitkDataStorageTableModel(); //# Public GETTER public: /// /// Get the DataStorage. /// const mitk::DataStorage::Pointer GetDataStorage() const; /// /// Get the predicate. /// mitk::NodePredicateBase::Pointer GetPredicate() const; /// /// Get node at a specific model index. Another way to implement this, is /// by introducing a new role like "DateTreeNode" and capture /// that in the data function. /// mitk::DataNode::Pointer GetNode(const QModelIndex &index) const; /// /// Overridden from QAbstractTableModel. Returns the header data at section /// for given orientation and role. /// virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; /// /// Overridden from QAbstractTableModel. Returns what can be done /// with an item. /// virtual Qt::ItemFlags flags(const QModelIndex &index) const; /// /// Overridden from QAbstractTableModel. Returns the node count. /// virtual int rowCount(const QModelIndex &parent) const; /// /// Overridden from QAbstractTableModel. Returns the number of features (columns) to display. /// virtual int columnCount(const QModelIndex &parent) const; /// /// Overridden from QAbstractTableModel. Returns the data at index for given role. /// virtual QVariant data(const QModelIndex &index, int role) const; //# Public SETTERS public: /// /// Sets the DataStorage. /// void SetDataStorage(mitk::DataStorage::Pointer _DataStorage); /// /// Sets the predicate. QmitkDataStorageTableModel is owner of the predicate! /// void SetPredicate(mitk::NodePredicateBase* _Predicate); /// /// Adds a node to this model. /// There are two constraints for nodes in this model: /// 1. If a predicate is set (not null) the node will be checked against it. /// 2. The node has to have a data object (no one wants to see empty nodes). /// Also adds event listeners to the node. /// virtual void AddNode(const mitk::DataNode* node); /// /// Removes a node from this model. Also removes any event listener from the node. /// virtual void RemoveNode(const mitk::DataNode* node); /// /// Returns a copy of the node-vector that is shown by this model /// virtual std::vector GetNodeSet() const; /// /// \brief Called when a single property was changed. /// The function searches through the list of nodes in this model for the changed /// property. If the property was found a dataChanged signal is emitted forcing /// all observing views to request the data again. /// virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event); /// /// Overridden from QAbstractTableModel. Sets data at index for given role. /// bool setData(const QModelIndex &index, const QVariant &value, int role); /// /// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table. /// void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); //#PROTECTED INNER CLASSES protected: /// /// \struct DataNodeCompareFunction /// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the node list elements. /// struct DataNodeCompareFunction : public std::binary_function { /// /// \brief Specifies field of the property with which it will be sorted. /// enum CompareCriteria { CompareByName = 0, CompareByClassName, CompareByVisibility }; /// /// \brief Specifies Ascending/descending ordering. /// enum CompareOperator { Less = 0, Greater }; /// /// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given. /// DataNodeCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less); /// /// \brief The reimplemented compare function. /// bool operator()(const mitk::DataNode::Pointer& _Left , const mitk::DataNode::Pointer& _Right) const; protected: CompareCriteria m_CompareCriteria; CompareOperator m_CompareOperator; }; //#Protected SETTER protected: /// /// Called when DataStorage or Predicate changed. Resets whole model and reads all nodes /// in again. /// virtual void Reset(); //#Protected MEMBER VARIABLES protected: /// /// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there /// might be more than one DataStorage). /// Store it in a weak pointer. This is a GUI class which should not hold a strong reference /// to any non-GUI Object. /// mitk::WeakPointer m_DataStorage; /// /// 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_NodeSet; /// /// \brief Maps a property to an observer tag. /// std::map m_NamePropertyModifiedObserverTags; /// /// \brief Maps a property to an observer tag. /// std::map m_VisiblePropertyModifiedObserverTags; /// /// Saves if this model is currently working on events to prevent endless event loops. /// bool m_BlockEvents; /// /// \brief The property is true when the property list is sorted in descending order. /// bool m_SortDescending; }; #endif diff --git a/Modules/Qmitk/QmitkDataStorageTreeModel.h b/Modules/Qmitk/QmitkDataStorageTreeModel.h index 7cbf6c87b3..fc3674964a 100644 --- a/Modules/Qmitk/QmitkDataStorageTreeModel.h +++ b/Modules/Qmitk/QmitkDataStorageTreeModel.h @@ -1,292 +1,293 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKDATASTORAGETREEMODEL_H_ #define QMITKDATASTORAGETREEMODEL_H_ #include #include #include #include #include #include "QmitkEnums.h" #include "QmitkCustomVariants.h" #include #include #include +/// \ingroup QmitkModule class QMITK_EXPORT QmitkDataStorageTreeModel : public QAbstractItemModel { //# CONSTANTS,TYPEDEFS public: static const std::string COLUMN_NAME; static const std::string COLUMN_TYPE; static const std::string COLUMN_VISIBILITY; //# CTORS,DTOR public: QmitkDataStorageTreeModel(mitk::DataStorage* _DataStorage , bool _PlaceNewNodesOnTop=false , bool _ShowHelperObjects=false , bool _ShowNodesContainingNoData=false , QObject* parent = 0); ~QmitkDataStorageTreeModel(); //# GETTER public: typedef std::map NodeTagMapType; /// /// Get node at a specific model index. /// This function is used to get a node from a QModelIndex /// mitk::DataNode::Pointer GetNode(const QModelIndex &index) const; /// /// Returns a copy of the node-vector that is shown by this model /// virtual QList GetNodeSet() const; /// /// Get the DataStorage. /// const mitk::DataStorage::Pointer GetDataStorage() const; /// /// Get the top placement flag /// bool GetPlaceNewNodesOnTopFlag() { return m_PlaceNewNodesOnTop; } /// /// Get the helper object visibility flag /// bool GetShowHelperObjectsFlag() { return m_ShowHelperObjects; } /// /// Get the visibility flag for showing nodes that contain no data /// bool GetShowNodesContainingNoDataFlag() { return m_ShowNodesContainingNoData; } /// /// Set the top placement flag /// void SetPlaceNewNodesOnTop(bool _PlaceNewNodesOnTop); //# (Re-)implemented from QAbstractItemModel //# Read model Qt::ItemFlags flags(const QModelIndex& index) const; QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount ( const QModelIndex & parent = QModelIndex() ) const; int columnCount ( const QModelIndex & parent = QModelIndex() ) const; //# hierarchical model /// /// called whenever the model or the view needs to create a QModelIndex for a particular /// child item (or a top-level item if parent is an invalid QModelIndex) /// QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex parent ( const QModelIndex & index ) const; //# editable model bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDragActions() const; QStringList mimeTypes() const; QMimeData * mimeData(const QModelIndexList & indexes) const; //# End of QAbstractItemModel //# SETTER public: /// /// Sets the DataStorage. The whole model will be resetted. /// void SetDataStorage(mitk::DataStorage* _DataStorage); /// /// Notify that the DataStorage was deleted. The whole model will be resetted. /// void SetDataStorageDeleted(const itk::Object* _DataStorage); /// /// Adds a node to this model. /// If a predicate is set (not null) the node will be checked against it.The node has to have a data object (no one wants to see empty nodes). /// virtual void AddNode(const mitk::DataNode* node); /// /// Removes a node from this model. Also removes any event listener from the node. /// virtual void RemoveNode(const mitk::DataNode* node); /// /// Sets a node to modfified. Called by the DataStorage /// virtual void SetNodeModified(const mitk::DataNode* node); /// /// \return an index for the given datatreenode in the tree. If the node is not found /// QModelIndex GetIndex(const mitk::DataNode*) const; /// /// Show or hide helper objects /// void SetShowHelperObjects(bool _ShowHelperObjects); /// /// Show or hide objects that contain no data /// void SetShowNodesContainingNoData(bool _ShowNodesContainingNoData); /// /// Update the visibility of data nodes according to the preference settings /// void UpdateNodeVisibility(); //# MISC protected: /// /// Helper class to represent a tree structure of DataNodes /// class TreeItem { public: /// /// Constructs a new TreeItem with the given DataNode (must not be 0) /// TreeItem(mitk::DataNode* _DataNode, TreeItem* _Parent=0); /// /// Removes itself as child from its parent-> Does not delete its children /// \sa Delete() /// virtual ~TreeItem(); /// /// Find the index of an item /// int IndexOfChild(const TreeItem* item) const; /// /// \child The child at pos index or 0 if it not exists /// TreeItem* GetChild(int index) const; /// /// Find the TreeItem containing a special tree node (recursive tree function) /// TreeItem* Find( const mitk::DataNode* _DataNode) const; /// /// Get the amount of children /// int GetChildCount() const; /// /// \return the index of this node in its parent list /// int GetIndex() const; /// /// \return the parent of this tree item /// TreeItem* GetParent() const; /// /// Return the DataNode associated with this node /// mitk::DataNode::Pointer GetDataNode() const; /// /// Get all children as vector /// std::vector GetChildren() const; /// /// add another item as a child of this (only if not already in that list) /// void AddChild( TreeItem* item); /// /// remove another item as child from this /// void RemoveChild( TreeItem* item); /// /// inserts a child at the given position. if pos is not in range /// the element is added at the end /// void InsertChild( TreeItem* item, int index=-1 ); /// Sets the parent on the treeitem void SetParent(TreeItem* _Parent); /// /// Deletes the whole tree branch /// void Delete(); protected: TreeItem* m_Parent; std::vector m_Children; mitk::DataNode::Pointer m_DataNode; }; /// /// Adjusts the LayerProperty according to the nodes position /// void AdjustLayerProperty(); /// /// invoked after m_DataStorage or m_Predicate changed /// TreeItem* TreeItemFromIndex(const QModelIndex &index) const; /// /// Gives a ModelIndex for the Tree Item /// QModelIndex IndexFromTreeItem(TreeItem*) const; /// /// Returns the first element in the nodes sources list (if available) or 0 /// mitk::DataNode* GetParentNode(const mitk::DataNode* node) const; /// /// Adds all Childs in parent to vec. Before a child is added the function is called recursively /// void TreeToVector(TreeItem* parent, std::vector& vec) const; /// /// Adds all Childs in parent to vec. Before a child is added the function is called recursively /// void TreeToNodeSet(TreeItem* parent, QList &vec) const; /// /// Update Tree Model according to predicates /// void Update(); //# ATTRIBUTES protected: mitk::WeakPointer m_DataStorage; mitk::NodePredicateBase::Pointer m_Predicate; bool m_PlaceNewNodesOnTop; bool m_ShowHelperObjects; bool m_ShowNodesContainingNoData; TreeItem* m_Root; NodeTagMapType m_HelperObjectObserverTags; private: void AddNodeInternal(const mitk::DataNode*); void RemoveNodeInternal(const mitk::DataNode*); /// /// Checks if dicom properties patient name, study names and series name exists /// bool DicomPropertiesExists(const mitk::DataNode&) const; }; #endif /* QMITKDATASTORAGETREEMODEL_H_ */ diff --git a/Modules/Qmitk/QmitkEnums.h b/Modules/Qmitk/QmitkEnums.h index b3b0bc73a5..ea1d7b9714 100755 --- a/Modules/Qmitk/QmitkEnums.h +++ b/Modules/Qmitk/QmitkEnums.h @@ -1,27 +1,28 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKENUMS_H_ #define QMITKENUMS_H_ +/// \ingroup QmitkModule enum QmitkItemModelRole { QmitkDataNodeRole = 64, QmitkDataNodeRawPointerRole = 65 }; #endif /* QMITKENUMS_H_ */ diff --git a/Modules/Qmitk/QmitkEventAdapter.h b/Modules/Qmitk/QmitkEventAdapter.h index f83ca791c5..6b6cc67622 100644 --- a/Modules/Qmitk/QmitkEventAdapter.h +++ b/Modules/Qmitk/QmitkEventAdapter.h @@ -1,41 +1,44 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKEVENTADAPTER_H_ #define QMITKEVENTADAPTER_H_ #include #include #include #include #include #include + /** -* \deprecatedSince{2013_03} mitk::QmitkEventAdapter is deprecated. It will become obsolete. Adaption of events is now handeled (for Qt events) in -* QmitkRenderWindow. - * Refer to \see DataInteractionPage for general information about the concept of the new implementation + * \ingroup QmitkModule + * \deprecatedSince{2013_03} mitk::QmitkEventAdapter is deprecated. It will become + * obsolete. Adaption of events is now handeled (for Qt events) in QmitkRenderWindow. + * Refer to \see DataInteractionPage for general information about the concept of + * the new implementation */ class QMITK_EXPORT QmitkEventAdapter { public: static mitk::MouseEvent AdaptMouseEvent(mitk::BaseRenderer* sender, QMouseEvent* mouseEvent); static mitk::WheelEvent AdaptWheelEvent(mitk::BaseRenderer* sender, QWheelEvent* wheelEvent); static mitk::KeyEvent AdaptKeyEvent(mitk::BaseRenderer* sender, QKeyEvent* keyEvent, const QPoint& point); }; #endif /*QMITKEVENTADAPTER_H_*/ diff --git a/Modules/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h b/Modules/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h index 03dbf06296..5ce80e4a7c 100644 --- a/Modules/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h +++ b/Modules/Qmitk/QmitkLevelWindowPresetDefinitionDialog.h @@ -1,107 +1,108 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_ #define QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_ #include #include "ui_QmitkLevelWindowPresetDefinition.h" #include #include #include #include +/// \ingroup QmitkModule class QMITK_EXPORT QmitkLevelWindowPresetDefinitionDialog : public QDialog, public Ui::QmitkLevelWindowPresetDefinition { Q_OBJECT public: QmitkLevelWindowPresetDefinitionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); ~QmitkLevelWindowPresetDefinitionDialog(); void setPresets(std::map& level, std::map& window, QString initLevel, QString initWindow); std::map getLevelPresets(); std::map getWindowPresets(); protected slots: void addPreset(); void removePreset(); void changePreset(); void ListViewSelectionChanged(const QItemSelection&, const QItemSelection&); void sortPresets(int index); protected: class PresetTableModel : public QAbstractTableModel { public: struct Entry { std::string name; double level; double window; Entry(const std::string& n, double l, double w) : name(n), level(l), window(w) {} }; PresetTableModel(std::map& levels, std::map& windows, QObject* parent = 0); int rowCount(const QModelIndex&) const; int columnCount(const QModelIndex&) const; QVariant data(const QModelIndex& index, int) const; QVariant headerData(int section, Qt::Orientation orientation, int) const; void addPreset(std::string& name, double level, double window); void removePreset(const QModelIndex&); void changePreset(int row, std::string& name, double level, double window); void getLevels(std::map& levels); void getWindows(std::map& windows); bool contains(std::string& name); Entry getPreset(const QModelIndex&) const; private: std::vector m_Entries; }; void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); void resizeColumns(); PresetTableModel* m_TableModel; QSortFilterProxyModel m_SortModel; }; #endif /*QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_*/ diff --git a/Modules/Qmitk/QmitkLevelWindowRangeChangeDialog.h b/Modules/Qmitk/QmitkLevelWindowRangeChangeDialog.h index 1092ff707a..1de4adab8e 100644 --- a/Modules/Qmitk/QmitkLevelWindowRangeChangeDialog.h +++ b/Modules/Qmitk/QmitkLevelWindowRangeChangeDialog.h @@ -1,48 +1,49 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKLEVELWINDOWRANGECHANGEDIALOG_H_ #define QMITKLEVELWINDOWRANGECHANGEDIALOG_H_ #include #include "ui_QmitkLevelWindowRangeChange.h" #include +/// \ingroup QmitkModule class QMITK_EXPORT QmitkLevelWindowRangeChangeDialog : public QDialog, public Ui::QmitkLevelWindowRangeChange { Q_OBJECT public: QmitkLevelWindowRangeChangeDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); int getLowerLimit(); int getUpperLimit(); void setLowerLimit( int rangeMin ); void setUpperLimit( int rangeMax ); protected slots: void inputValidator(); }; #endif /*QMITKLEVELWINDOWRANGECHANGEDIALOG_H_*/ diff --git a/Modules/Qmitk/QmitkLevelWindowWidget.h b/Modules/Qmitk/QmitkLevelWindowWidget.h index 7d2724a3a2..052081690e 100644 --- a/Modules/Qmitk/QmitkLevelWindowWidget.h +++ b/Modules/Qmitk/QmitkLevelWindowWidget.h @@ -1,40 +1,41 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKLEVELWINDOWWIDGET_H_ #define QMITKLEVELWINDOWWIDGET_H_ #include #include "ui_QmitkLevelWindowWidget.h" #include +/// \ingroup QmitkModule class QMITK_EXPORT QmitkLevelWindowWidget : public QWidget, public Ui::QmitkLevelWindow { Q_OBJECT public: QmitkLevelWindowWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); mitk::LevelWindowManager* GetManager(); public slots: void SetDataStorage( mitk::DataStorage* ds ); protected: //unsigned long m_ObserverTag; mitk::LevelWindowManager::Pointer m_Manager; }; #endif /*QMITKLEVELWINDOWWIDGET_H_*/ diff --git a/Modules/Qmitk/QmitkLevelWindowWidgetContextMenu.h b/Modules/Qmitk/QmitkLevelWindowWidgetContextMenu.h index 268a736ea0..0ea3acd554 100644 --- a/Modules/Qmitk/QmitkLevelWindowWidgetContextMenu.h +++ b/Modules/Qmitk/QmitkLevelWindowWidgetContextMenu.h @@ -1,120 +1,120 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKLEVELWINDOWWIDGETCONTEXTMENU_H #define QMITKLEVELWINDOWWIDGETCONTEXTMENU_H #include #include #include #include /** - \class QmitkLevelWindowWidgetContextMenu QmitkLevelWindowWidgetContextMenu.h QmitkLevelWindowWidgetContextMenu.h - \ingroup Widgets - - \brief Provides a contextmenu for Level/Window functionality. Either creates a new contextmenu with standard functions or adds Level/Window standard functions to an predefined contextmenu. - - */ - + * \ingroup QmitkModule + * \brief Provides a contextmenu for Level/Window functionality. + * + * Either creates + * a new contextmenu with standard functions or adds Level/Window standard + * functions to an predefined contextmenu. + */ class QMITK_EXPORT QmitkLevelWindowWidgetContextMenu : public QWidget { Q_OBJECT public: /// constructor QmitkLevelWindowWidgetContextMenu(QWidget * parent, Qt::WindowFlags f = 0 ); virtual ~QmitkLevelWindowWidgetContextMenu(); /*! * data structure which reads and writes presets defined in a XML-file */ mitk::LevelWindowPreset* m_LevelWindowPreset; /*! * data structure which stores the values manipulated * by a QmitkLevelWindowWidgetContextMenu */ mitk::LevelWindow m_LevelWindow; /// submenu with all presets for contextmenu QMenu* m_PresetSubmenu; /// submenu with all images for contextmenu QMenu* m_ImageSubmenu; /// pointer to the object which manages all Level/Window changes on images and holds the LevelWindowProperty /// of the current image mitk::LevelWindowManager* m_Manager; /// map to hold all image-properties, one can get the image which is selected in the contextmenu /// with the QAction representing the image for the contextmenu std::map m_Images; /*! * returns the contextmenu with standard functions for Level/Window * * input is a prefilled contextmenu to which standard functions will be added */ void getContextMenu(QMenu* contextmenu); /// returns the contextmenu with standard functions for Level/Window void getContextMenu(); /// lets this object know about the LevelWindowManager to get all images and tell about changes void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); protected: /// ID of preset selected in contextmenu QAction* m_PresetAction; /// ID of image selected in contextmenu QAction* m_ImageAction; protected slots: /// sets level and window value of the current image to the values defined for the selected preset void setPreset(QAction* presetAction); /// calls the mitkLevelWindow SetAuto method with guessByCentralSlice false, so that the greyvalues from whole image will be considered void useAllGreyvaluesFromImage(); /// sets the level window slider to be fixed void setFixed(); /// adds a new Preset for presets-contextmenu void addPreset(); /// resets the current images Level/Window to its default values void setDefaultLevelWindow(); /// resets the current images scalerange to its default values void setDefaultScaleRange(); /// changes the current images scalerange void changeScaleRange(); /// sets the selected image or the topmost layer image to the new current image void setImage(QAction* imageAction); /// sets the window to its maximum Size to fit the scalerange void setMaximumWindow(); }; #endif diff --git a/Modules/Qmitk/QmitkLineEditLevelWindowWidget.h b/Modules/Qmitk/QmitkLineEditLevelWindowWidget.h index a226d086af..329b38f4ad 100644 --- a/Modules/Qmitk/QmitkLineEditLevelWindowWidget.h +++ b/Modules/Qmitk/QmitkLineEditLevelWindowWidget.h @@ -1,102 +1,100 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKLINEEDITLEVELWINDOWWIDGET #define QMITKLINEEDITLEVELWINDOWWIDGET #include #include #include class QmitkLevelWindowWidgetContextMenu; class QLineEdit; /** - \class QmitkLineEditLevelWindowWidget QmitkLineEditLevelWindowWidget.h QmitkLineEditLevelWindowWidget.h - \ingroup Widgets - - \brief Provides a widget with two lineedit fields, one to change the window value of the current image and one to change the level value of the current image. - - */ - + * \ingroup QmitkModule + * \brief Provides a widget with two lineedit fields, one to change the + * window value of the current image and one to change the level value of + * the current image. + */ class QMITK_EXPORT QmitkLineEditLevelWindowWidget : public QWidget { Q_OBJECT public: /// constructor QmitkLineEditLevelWindowWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkLineEditLevelWindowWidget(); /// inputfield for level value QLineEdit* m_LevelInput; /// inputfield for window value QLineEdit* m_WindowInput; /*! * data structure which stores the values manipulated * by a QmitkLineEditLevelWindowWidget */ mitk::LevelWindow m_LevelWindow; /// manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager::Pointer m_Manager; /// sets the manager who is responsible to collect and deliver changes on Level/Window void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); /// sets the DataStorage which holds all image-nodes void SetDataStorage( mitk::DataStorage* ds ); /// returns the manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager* GetManager(); private: /// creates the contextmenu for this widget from class QmitkLevelWindowWidgetContextMenu void contextMenuEvent ( QContextMenuEvent * ); /// change notifications from the mitkLevelWindowManager void OnPropertyModified(const itk::EventObject& e); public slots: /// called when return is pressed in levelinput field void SetLevelValue(); /// called when return is pressed in windowinput field void SetWindowValue(); // validator to accept only possible values for Level/Window in lineedits //void setValidator(); protected: unsigned long m_ObserverTag; bool m_IsObserverTagSet; /*! * data structure which creates the contextmenu for QmitkLineEditLevelWindowWidget */ QmitkLevelWindowWidgetContextMenu* m_Contextmenu; }; #endif // QMITKLINEEDITLEVELWINDOWWIDGET diff --git a/Modules/Qmitk/QmitkMemoryUsageIndicatorView.h b/Modules/Qmitk/QmitkMemoryUsageIndicatorView.h index 56ad1bb829..72e7df3de6 100644 --- a/Modules/Qmitk/QmitkMemoryUsageIndicatorView.h +++ b/Modules/Qmitk/QmitkMemoryUsageIndicatorView.h @@ -1,54 +1,55 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKMEMORYUSAGEINDICATORVIEW_WIDGET #define QMITKMEMORYUSAGEINDICATORVIEW_WIDGET #include #include #include #include "ui_QmitkMemoryUsageIndicator.h" +/// \ingroup QmitkModule class QMITK_EXPORT QmitkMemoryUsageIndicatorView : public QWidget, public Ui::QmitkMemoryUsageIndicator { Q_OBJECT public: /// constructor QmitkMemoryUsageIndicatorView( QWidget * parent=0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkMemoryUsageIndicatorView(); protected slots: void UpdateMemoryUsage(); protected: std::string FormatMemorySize( size_t size ); std::string FormatPercentage( double val ); std::string GetMemoryDescription( size_t processSize, float percentage ); QPixmap m_LEDGreen; QPixmap m_LEDYellow; QPixmap m_LEDOrange; QPixmap m_LEDRed; char m_PreviousState; }; #endif //QMITKMEMORYUSAGEINDICATORVIEW_WIDGET diff --git a/Modules/Qmitk/QmitkMouseModeSwitcher.h b/Modules/Qmitk/QmitkMouseModeSwitcher.h index 5f94bf2304..5e53b5e6e1 100644 --- a/Modules/Qmitk/QmitkMouseModeSwitcher.h +++ b/Modules/Qmitk/QmitkMouseModeSwitcher.h @@ -1,86 +1,87 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkMouseModeSwitcher_h #define QmitkMouseModeSwitcher_h #include "QmitkExports.h" #include "mitkMouseModeSwitcher.h" #include /** - \brief Qt toolbar representing mitk::MouseModeSwitcher. - - Provides buttons for the interaction modes defined in mitk::MouseModeSwitcher - and communicates with this non-graphical class. - - Can be used in a GUI to provide a mouse mode selector to the user. -*/ + * \ingroup QmitkModule + * \brief Qt toolbar representing mitk::MouseModeSwitcher. + * + * Provides buttons for the interaction modes defined in mitk::MouseModeSwitcher + * and communicates with this non-graphical class. + * + * Can be used in a GUI to provide a mouse mode selector to the user. + */ class QMITK_EXPORT QmitkMouseModeSwitcher : public QToolBar { Q_OBJECT public: QmitkMouseModeSwitcher( QWidget* parent = 0 ); virtual ~QmitkMouseModeSwitcher(); typedef mitk::MouseModeSwitcher::MouseMode MouseMode; public slots: /** \brief Connect to non-GUI class. When a button is pressed, given mitk::MouseModeSwitcher is informed to adapt interactors. \todo QmitkMouseModeSwitcher could be enhanced to actively observe mitk::MouseModeSwitcher and change available actions or visibility appropriately. */ void setMouseModeSwitcher( mitk::MouseModeSwitcher* ); signals: /** \brief Mode activated. This signal is needed for other GUI element to react appropriately. Sadly this is needed to provide "normal" functionality of QmitkStdMultiWidget, because this must enable/disable automatic reaction of SliceNavigationControllers to mouse clicks - depending on which mode is active. */ void MouseModeSelected(mitk::MouseModeSwitcher::MouseMode id); // TODO change int to enum of MouseModeSwitcher protected slots: void modeSelectedByUser(); void addButton( MouseMode id, const QString& toolName, const QIcon& icon, bool on = false ); // TODO change int to enum of MouseModeSwitcher protected: void OnMouseModeChanged(const itk::EventObject&); QActionGroup* m_ActionGroup; mitk::MouseModeSwitcher* m_MouseModeSwitcher; unsigned long m_ObserverTag; bool m_InObservationReaction; }; #endif diff --git a/Modules/Qmitk/QmitkNodeDescriptor.h b/Modules/Qmitk/QmitkNodeDescriptor.h index 6a01aae666..8eda6004ed 100644 --- a/Modules/Qmitk/QmitkNodeDescriptor.h +++ b/Modules/Qmitk/QmitkNodeDescriptor.h @@ -1,101 +1,102 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkNodeDescriptor_h #define QmitkNodeDescriptor_h #include #include #include "mitkDataNode.h" #include #include #include #include #include #include -/// -/// \class QmitkNodeQmitkNodeDescriptor -/// \brief QmitkNodeQmitkNodeDescriptor is Decorator class for the mitk::DataNode -/// which enhances certain mitk::DataNode by additional infos needed by the GUI (Icon, ...) -/// -/// Moreover, QmitkNodeQmitkNodeDescriptor stores a Menu for actions that can be taken -/// for a certain DataNode, e.g. for DataNodes containing images this menu -/// can be filled with Image Filter Actions, etc. -/// -/// \sa QmitkDataNodeQmitkNodeDescriptorManager -/// +/** + * \ingroup QmitkModule + * \brief QmitkNodeQmitkNodeDescriptor is Decorator class for + * the mitk::DataNode which enhances certain mitk::DataNode by additional + * infos needed by the GUI (Icon, ...) + * + * Moreover, QmitkNodeQmitkNodeDescriptor stores a Menu for actions that can be taken + * for a certain DataNode, e.g. for DataNodes containing images this menu + * can be filled with Image Filter Actions, etc. + * + * \sa QmitkDataNodeQmitkNodeDescriptorManager + */ class QMITK_EXPORT QmitkNodeDescriptor : public QObject { Q_OBJECT public: /// /// Creates a new QmitkNodeQmitkNodeDescriptor /// QmitkNodeDescriptor(const QString& _ClassName, const QString& _PathToIcon , mitk::NodePredicateBase* _Predicate, QObject* parent); /// /// Deletes all actions /// virtual ~QmitkNodeDescriptor(); /// /// Returns a name for this class of DataNodes (e.g. "Image", "Image Mask", etc.) /// virtual QString GetClassName() const; /// /// Returns an Icon for this class of DataNodes /// virtual QIcon GetIcon() const; /// /// Returns an Icon for this class of DataNodes /// virtual QAction* GetSeparator() const; /// /// Check if this class describes the given node /// virtual bool CheckNode(const mitk::DataNode* node) const; /// /// Create and return an action with this descriptor as owner /// virtual void AddAction ( QAction * action, bool isBatchAction=true ); /// /// Remove and delete (!) an action /// virtual void RemoveAction(QAction* _Action); /// /// Get all actions associated with this class of nodes /// virtual QList GetActions() const; /// /// Get all actions for this descriptor class that can be executed on multiple nodes /// (no priot knowledge abpout the node is required) /// virtual QList GetBatchActions() const; public slots: /// Called when an action was destroyed void ActionDestroyed ( QObject * obj = 0 ); protected: QString m_ClassName; QString m_PathToIcon; mitk::NodePredicateBase::Pointer m_Predicate; QList m_Actions; QList m_BatchActions; QAction* m_Separator; }; #endif // QmitkNodeDescriptor_h diff --git a/Modules/Qmitk/QmitkNodeDescriptorManager.h b/Modules/Qmitk/QmitkNodeDescriptorManager.h index 7b7784fb57..af4a1ba8fb 100644 --- a/Modules/Qmitk/QmitkNodeDescriptorManager.h +++ b/Modules/Qmitk/QmitkNodeDescriptorManager.h @@ -1,116 +1,116 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkNodeDescriptorManager_h #define QmitkNodeDescriptorManager_h #include #include "QmitkNodeDescriptor.h" -/// -/// \class QmitkNodeDescriptorManager -/// \brief QmitkNodeDescriptorManager manages a set of QmitkNodeDescriptors -/// -/// \sa QmitkNodeDescriptor -/// +/** + * \ingroup QmitkModule + * \brief QmitkNodeDescriptorManager manages a set of QmitkNodeDescriptors + * + * \sa QmitkNodeDescriptor + */ class QMITK_EXPORT QmitkNodeDescriptorManager : public QObject { Q_OBJECT public: /// /// \return the solely instance of QmitkNodeDescriptorManager /// static QmitkNodeDescriptorManager* GetInstance(); /// /// Initializes the QmitkNodeDescriptorManager. /// Adds a few standard Descriptors. /// This Descriptors are added: /// - A QmitkNodeDescriptor for the class of "Image" DataNodes /// - A QmitkNodeDescriptor for the class of "Image Mask" DataNodes /// - A QmitkNodeDescriptor for the class of "Surface" DataNodes /// - A QmitkNodeDescriptor for the class of "PointSet" DataNodes /// virtual void Initialize(); /// /// Adds a new descriptor to the manager. The manager takes the ownership. /// void AddDescriptor(QmitkNodeDescriptor* _Descriptor); /// /// Removes and deletes a descriptor from the manager /// void RemoveDescriptor(QmitkNodeDescriptor* _Descriptor); /// /// Get the last descriptor in the descriptors list that matches the given node. /// *Attention*: More specialized Descriptors should therefore be appended at /// the end of the list, e.g. first add "Image", then add "Image Mask" /// /// \return a QmitkNodeDescriptor for the given node or a QmitkNodeDescriptor describing unknown nodes (never 0) /// \sa AddDescriptor() /// QmitkNodeDescriptor* GetDescriptor(const mitk::DataNode* _Node) const; /// /// Get the last QmitkNodeDescriptor for the given class name /// /// \return a QmitkNodeDescriptor for the given class name or 0 if there is no QmitkNodeDescriptor for _ClassName /// QmitkNodeDescriptor* GetDescriptor(const QString& _ClassName) const; /// /// \return The UnknownDataNodeDescriptor, which is the default Descriptor for all Nodes. /// QmitkNodeDescriptor* GetUnknownDataNodeDescriptor() const; /// /// Returns a list of all actions that are associated with the given node. /// If there are more than one Descriptors for this node all actions /// will be merged together. /// E.g. all actions from the "unknown" DataNodes will be added to /// this list. Generic Actions like Save, Load, etc. are stored there. /// QList GetActions(const mitk::DataNode* _Node) const; /// /// \return a list of actions associated with the given nodes /// QList GetActions( const QList& _Nodes ) const; /// /// Deletes all Descriptors in the list /// virtual ~QmitkNodeDescriptorManager(); protected: /// /// Creates the m_UnknownDataNodeDescriptor /// Calls Initialize /// QmitkNodeDescriptorManager(); protected: /// /// This is the standard QmitkNodeDescriptor matching every node /// QmitkNodeDescriptor* m_UnknownDataNodeDescriptor; /// /// Holds all user defined descriptors /// QList m_NodeDescriptors; }; #endif // QmitkNodeDescriptorManager_h diff --git a/Modules/Qmitk/QmitkProgressBar.h b/Modules/Qmitk/QmitkProgressBar.h index 1771572883..dbbf1fed9b 100644 --- a/Modules/Qmitk/QmitkProgressBar.h +++ b/Modules/Qmitk/QmitkProgressBar.h @@ -1,85 +1,86 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKPROGRESSBAR_H #define QMITKPROGRESSBAR_H #include #include #include -//##Documentation -//## @brief QT-Toolkit/GUI dependent class that provides the QT's ProgressBar -//## -//## All mitk-classes will call this class for output: -//## mitk::ProgressBar::GetInstance(); - +/** + * \ingroup QmitkModule + * \brief QT-Toolkit/GUI dependent class that provides the QT's ProgressBar + * + * All mitk-classes will call this class for output: + * mitk::ProgressBar::GetInstance(); + */ class QMITK_EXPORT QmitkProgressBar : public QProgressBar, public mitk::ProgressBarImplementation { Q_OBJECT public: //##Documentation //##@brief Constructor; //## holds param instance internally and connects this to the mitkProgressBar QmitkProgressBar(QWidget * parent = 0, const char * name = 0); //##Documentation //##@brief Destructor virtual ~QmitkProgressBar(); //##Documentation //## @brief Sets whether the current progress value is displayed. virtual void SetPercentageVisible(bool visible); //##Documentation //## @brief Adds steps to totalSteps. virtual void AddStepsToDo(unsigned int steps); //##Documentation //## @brief Sets the current amount of progress to current progress + steps. //## @param: steps the number of steps done since last Progress(int steps) call. virtual void Progress(unsigned int steps); signals: void SignalAddStepsToDo(unsigned int steps); void SignalProgress(unsigned int steps); void SignalSetPercentageVisible(bool visible); protected slots: virtual void SlotAddStepsToDo(unsigned int steps); virtual void SlotProgress(unsigned int steps); virtual void SlotSetPercentageVisible(bool visible); private: //##Documentation //## @brief Reset the progress bar. The progress bar "rewinds" and shows no progress. void Reset(); unsigned int m_TotalSteps; unsigned int m_Progress; }; #endif /* define QMITKPROGRESSBAR_H */ diff --git a/Modules/Qmitk/QmitkPropertiesTableEditor.h b/Modules/Qmitk/QmitkPropertiesTableEditor.h index a449024f4c..cc58d6539f 100644 --- a/Modules/Qmitk/QmitkPropertiesTableEditor.h +++ b/Modules/Qmitk/QmitkPropertiesTableEditor.h @@ -1,90 +1,91 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkPropertiesTableEditor_h #define QmitkPropertiesTableEditor_h #include /// Own includes. #include "mitkDataNode.h" /// Toolkit includes. #include /// Forward declarations. class QmitkPropertiesTableModel; class QTableView; class QLineEdit; -/// -/// \class QmitkPropertiesTableEditor -/// \brief Combines a QTableView along with a QmitkPropertiesTableModel to a reusable -/// Property Editor component. -/// -/// \see QmitkPropertyDelegate +/** + * \ingroup QmitkModule + * \brief Combines a QTableView along with a QmitkPropertiesTableModel to a reusable + * Property Editor component. + * + * \see QmitkPropertyDelegate + */ class QMITK_EXPORT QmitkPropertiesTableEditor : public QWidget { Q_OBJECT public: /// /// Constructs a new QmitkDataStorageTableModel /// and sets the DataNode for this TableModel. QmitkPropertiesTableEditor(QWidget* parent = 0, Qt::WindowFlags f = 0,mitk::DataNode::Pointer _Node = 0); /// /// Standard dtor. Nothing to do here. virtual ~QmitkPropertiesTableEditor(); /// /// Convenience method. Sets the property list in the model. /// void SetPropertyList(mitk::PropertyList::Pointer _List); /// /// Get the model. /// QmitkPropertiesTableModel* getModel() const; QTableView* getTable() const; protected slots: void PropertyFilterKeyWordTextChanged(const QString & text); protected: /// /// Initialise empty GUI. /// virtual void init(); /// /// The table view that renders the property list. /// QTableView* m_NodePropertiesTableView; /// /// A text field in which the user can enter a filter keyword for the properties. Only properties containing with this keyword /// will be selected. /// QLineEdit* m_TxtPropertyFilterKeyWord; /// /// The property list table model. /// QmitkPropertiesTableModel* m_Model; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/Modules/Qmitk/QmitkPropertiesTableModel.h b/Modules/Qmitk/QmitkPropertiesTableModel.h index 31fd07ab3e..cb32daef5f 100644 --- a/Modules/Qmitk/QmitkPropertiesTableModel.h +++ b/Modules/Qmitk/QmitkPropertiesTableModel.h @@ -1,252 +1,252 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ /// Header guard. #ifndef QmitkPropertiesTableModel_h #define QmitkPropertiesTableModel_h #include //# Own includes #include "mitkDataNode.h" #include "mitkWeakPointer.h" //# Toolkit includes #include #include #include //# Forward declarations -/// -/// \class QmitkPropertiesTableModel -/// \brief A table model for showing and editing mitk::Properties. -/// -/// \see QmitkPropertyDelegate -/// +/** + * \ingroup QmitkModule + * \brief A table model for showing and editing mitk::Properties. + * + * \see QmitkPropertyDelegate + */ class QMITK_EXPORT QmitkPropertiesTableModel : public QAbstractTableModel { //# PUBLIC CTORS,DTOR,TYPEDEFS,CONSTANTS public: static const int PROPERTY_NAME_COLUMN = 0; static const int PROPERTY_VALUE_COLUMN = 1; /// /// Typedef for the complete Property Datastructure, which may be written as follows: /// Name->(mitk::BaseProperty::Pointer) /// typedef std::pair PropertyDataSet; /// /// Constructs a new QmitkDataStorageTableModel /// and sets the DataNode for this TableModel. QmitkPropertiesTableModel(QObject* parent = 0, mitk::PropertyList::Pointer _PropertyList=0); /// /// Standard dtor. Nothing to do here. virtual ~QmitkPropertiesTableModel(); //# PUBLIC GETTER public: /// /// Returns the property list of this table model. /// mitk::PropertyList::Pointer GetPropertyList() const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) Qt::ItemFlags flags(const QModelIndex& index) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; /// /// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...) int rowCount(const QModelIndex& parent = QModelIndex()) const; /// /// Overwritten from QAbstractTableModel. Returns the number of columns. That is usually two in this model: /// the properties name and its value. int columnCount(const QModelIndex &parent) const; //# PUBLIC SETTER public: /// /// Sets the Property List to show. Resets the whole model. If _PropertyList is NULL the model is empty. /// void SetPropertyList(mitk::PropertyList* _PropertyList); /// /// \brief Gets called when the list is about to be deleted. /// virtual void PropertyListDelete(const itk::Object *_PropertyList); /// /// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world. /// virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Called when a single property was changed. Send a model changed event to the Qt-outer world. /// virtual void PropertyDelete(const itk::Object *caller, const itk::EventObject &event); /// /// \brief Set a keyword for filtering of properties. Only properties beginning with this string will be shown /// virtual void SetFilterPropertiesKeyWord(std::string _FilterKeyWord); /// /// Overridden from QAbstractTableModel. Sets data at index for given role. /// bool setData(const QModelIndex &index, const QVariant &value, int role); /// /// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table. /// void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); //#PROTECTED INNER CLASSES protected: /// /// \struct PropertyDataSetCompareFunction /// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the property list elements. /// struct PropertyDataSetCompareFunction : public std::binary_function { /// /// \brief Specifies field of the property with which it will be sorted. /// enum CompareCriteria { CompareByName = 0, CompareByValue }; /// /// \brief Specifies Ascending/descending ordering. /// enum CompareOperator { Less = 0, Greater }; /// /// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given. /// PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less); /// /// \brief The reimplemented compare function. /// bool operator()(const PropertyDataSet& _Left , const PropertyDataSet& _Right) const; protected: CompareCriteria m_CompareCriteria; CompareOperator m_CompareOperator; }; /// /// An unary function for selecting Properties in a vector by a key word. /// struct PropertyListElementFilterFunction : public std::unary_function { PropertyListElementFilterFunction(const std::string& m_FilterKeyWord); /// /// \brief The reimplemented compare function. /// bool operator()(const PropertyDataSet& _Elem) const; protected: std::string m_FilterKeyWord; }; //# PROTECTED GETTER protected: /// /// \brief Searches for the specified property and returns the row of the element in this QTableModel. /// If any errors occur, the function returns -1. /// int FindProperty(const mitk::BaseProperty* _Property) const; //# PROTECTED SETTER protected: /// /// Adds a property dataset to the current selection. /// When a property is added a modified and delete listener /// is appended. /// void AddSelectedProperty(PropertyDataSet& _PropertyDataSet); /// /// Removes a property dataset from the current selection. /// When a property is removed the modified and delete listener /// are also removed. /// void RemoveSelectedProperty(unsigned int _Index); /// /// Reset is called when a new filter keyword is set or a new /// PropertyList is set. First of all, all priorly selected /// properties are removed. Then all properties to be /// selected (specified by the keyword) are added to the selection. /// void Reset(); //# PROTECTED MEMBERS protected: /// /// Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen /// to the delete event. mitk::WeakPointer m_PropertyList; /// /// Store the properties in a vector so that they may be sorted std::vector m_SelectedProperties; /// /// \brief Holds all tags of Modified Event Listeners. We need it to remove them again. /// std::vector m_PropertyModifiedObserverTags; /// /// \brief Holds all tags of Modified Event Listeners. We need it to remove them again. /// std::vector m_PropertyDeleteObserverTags; /// /// \brief Indicates if this class should neglect all incoming events because /// the class itself triggered the event (e.g. when a property was edited). /// bool m_BlockEvents; /// /// \brief The property is true when the property list is sorted in descending order. /// bool m_SortDescending; /// /// \brief If set to any value, only properties containing the specified keyword in their name will be shown. /// std::string m_FilterKeyWord; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/Modules/Qmitk/QmitkPropertyDelegate.h b/Modules/Qmitk/QmitkPropertyDelegate.h index 8b040edd22..b1faf40a2b 100644 --- a/Modules/Qmitk/QmitkPropertyDelegate.h +++ b/Modules/Qmitk/QmitkPropertyDelegate.h @@ -1,88 +1,89 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkPropertyDelegate_h #define QmitkPropertyDelegate_h #include /// Own includes. #include "mitkBaseProperty.h" /// Toolkit includes. #include /// Forward declarations. -/// -/// \class QmitkPropertyDelegate -/// \brief An item delegate for rendering and editing mitk::Properties in a QTableView. -/// -/// \see QmitkPropertiesTableModel +/** + * \ingroup QmitkModule + * \brief An item delegate for rendering and editing mitk::Properties in a QTableView. + * + * \see QmitkPropertiesTableModel + */ class QMITK_EXPORT QmitkPropertyDelegate : public QStyledItemDelegate { Q_OBJECT public: /// /// Creates a new PropertyDelegate. /// QmitkPropertyDelegate(QObject *parent = 0); /// /// Renders a specific property (overwritten from QItemDelegate) /// void paint(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option , const QModelIndex &index) const; /// /// Create an editor for a specific property (overwritten from QItemDelegate) /// void setEditorData(QWidget *editor, const QModelIndex &index) const; /// /// When the user accepts input this func commits the data to the model (overwritten from QItemDelegate) /// void setModelData(QWidget *editor, QAbstractItemModel* model , const QModelIndex &index) const; /// /// \brief Fit an editor to some geometry (overwritten from QItemDelegate) /// void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; protected: bool eventFilter( QObject *o, QEvent *e ); private slots: /// /// Invoked when the user accepts editor input, that is when he does not pushes ESC. /// void commitAndCloseEditor(); void showColorDialog(); void ComboBoxCurrentIndexChanged ( int index ) ; void SpinBoxValueChanged ( const QString& value ) ; }; #endif /* QMITKPROPERTIESTABLEMODEL_H_ */ diff --git a/Modules/Qmitk/QmitkRegisterClasses.h b/Modules/Qmitk/QmitkRegisterClasses.h index 36292c926d..f172313e99 100644 --- a/Modules/Qmitk/QmitkRegisterClasses.h +++ b/Modules/Qmitk/QmitkRegisterClasses.h @@ -1,25 +1,26 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkRegisterClassesHIncluded #define QmitkRegisterClassesHIncluded #include +/// \ingroup QmitkModule QMITK_EXPORT void QmitkRegisterClasses(); #endif diff --git a/Modules/Qmitk/QmitkRenderWindow.h b/Modules/Qmitk/QmitkRenderWindow.h index 1af9baba04..0763cd2e1e 100644 --- a/Modules/Qmitk/QmitkRenderWindow.h +++ b/Modules/Qmitk/QmitkRenderWindow.h @@ -1,180 +1,180 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66 #define QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66 #include "mitkRenderWindowBase.h" #include #include "QVTKWidget.h" #include "QmitkRenderWindowMenu.h" #include "mitkInteractionEventConst.h" class QmitkStdMultiWidget; class QDragEnterEvent; class QDropEvent; /** + * \ingroup QmitkModule * \brief MITK implementation of the QVTKWidget - * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderWindow: public QVTKWidget, public mitk::RenderWindowBase { Q_OBJECT public: QmitkRenderWindow(QWidget *parent = 0, QString name = "unnamed renderwindow", mitk::VtkPropRenderer* renderer = NULL, mitk::RenderingManager* renderingManager = NULL); virtual ~QmitkRenderWindow(); /** * \brief Whether Qt events should be passed to parent (default: true) * * With introduction of the QVTKWidget the behaviour regarding Qt events changed. * QVTKWidget "accepts" Qt events like mouse clicks (i.e. set an "accepted" flag). * When this flag is set, Qt fininshed handling of this event -- otherwise it is * reached through to the widget's parent. * * This reaching through to the parent was implicitly required by QmitkMaterialWidget / QmitkMaterialShowCase. *QmitkStdMultiWidget * The default behaviour of QmitkRenderWindow is now to clear the "accepted" flag * of Qt events after they were handled by QVTKWidget. This way parents can also * handle events. * * If you don't want this behaviour, call SetResendQtEvents(true) on your render window. */ virtual void SetResendQtEvents(bool resend); // Set Layout Index to define the Layout Type void SetLayoutIndex(unsigned int layoutIndex); // Get Layout Index to define the Layout Type unsigned int GetLayoutIndex(); //MenuWidget need to update the Layout Design List when Layout had changed void LayoutDesignListChanged(int layoutDesignIndex); void HideRenderWindowMenu(); //Activate or Deactivate MenuWidget. void ActivateMenuWidget(bool state, QmitkStdMultiWidget* stdMultiWidget = 0); bool GetActivateMenuWidgetFlag() { return m_MenuWidgetActivated; } // Get it from the QVTKWidget parent virtual vtkRenderWindow* GetVtkRenderWindow() { return GetRenderWindow(); } virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() { return NULL; } void FullScreenMode(bool state); protected: // overloaded move handler virtual void moveEvent(QMoveEvent* event); // overloaded show handler void showEvent(QShowEvent* event); // overloaded resize handler virtual void resizeEvent(QResizeEvent* event); // overloaded paint handler virtual void paintEvent(QPaintEvent* event); // overloaded mouse press handler virtual void mousePressEvent(QMouseEvent* event); // overloaded mouse move handler virtual void mouseMoveEvent(QMouseEvent* event); // overloaded mouse release handler virtual void mouseReleaseEvent(QMouseEvent* event); // overloaded key press handler virtual void keyPressEvent(QKeyEvent* event); // overloaded enter handler virtual void enterEvent(QEvent*); // overloaded leave handler virtual void leaveEvent(QEvent*); /// \brief Simply says we accept the event type. virtual void dragEnterEvent(QDragEnterEvent *event); /// \brief If the dropped type is application/x-mitk-datanodes we process the request by converting to mitk::DataNode pointers and emitting the NodesDropped signal. virtual void dropEvent(QDropEvent * event); #ifndef QT_NO_WHEELEVENT // overload wheel mouse event virtual void wheelEvent(QWheelEvent*); #endif void AdjustRenderWindowMenuVisibility(const QPoint& pos); signals: void ResetView(); // \brief int parameters are enum from QmitkStdMultiWidget void ChangeCrosshairRotationMode(int); void SignalLayoutDesignChanged(int layoutDesignIndex); void moved(); void resized(); /// \brief Emits a signal to say that this window has had the following nodes dropped on it. void NodesDropped(QmitkRenderWindow *thisWindow, std::vector nodes); protected slots: void OnChangeLayoutDesign(int layoutDesignIndex); void OnWidgetPlaneModeChanged(int); void DeferredHideMenu(); private: // Helper Functions to Convert Qt-Events to Mitk-Events mitk::Point2D GetMousePosition(QMouseEvent* me); mitk::Point2D GetMousePosition(QWheelEvent* we); mitk::MouseButtons GetEventButton(QMouseEvent* me); mitk::MouseButtons GetButtonState(QMouseEvent* me); mitk::ModifierKeys GetModifiers(QMouseEvent* me); mitk::MouseButtons GetButtonState(QWheelEvent* we); mitk::ModifierKeys GetModifiers(QWheelEvent* we); mitk::ModifierKeys GetModifiers(QKeyEvent* ke); std::string GetKeyLetter(QKeyEvent* ke); int GetDelta(QWheelEvent* we); bool m_ResendQtEvents; QmitkRenderWindowMenu* m_MenuWidget; bool m_MenuWidgetActivated; unsigned int m_LayoutIndex; }; #endif diff --git a/Modules/Qmitk/QmitkRenderWindowMenu.h b/Modules/Qmitk/QmitkRenderWindowMenu.h index 0c4646b7c1..9661a30ea8 100644 --- a/Modules/Qmitk/QmitkRenderWindowMenu.h +++ b/Modules/Qmitk/QmitkRenderWindowMenu.h @@ -1,339 +1,342 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkRenderWindowMenu_h #define QmitkRenderWindowMenu_h #if defined(_WIN32) || defined(__APPLE__) #define QMITK_USE_EXTERNAL_RENDERWINDOW_MENU #endif #include #include "mitkBaseRenderer.h" #include #include #include #include #include #include #include class QmitkStdMultiWidget; /** -* \brief The QmitkRenderWindowMenu is a popup Widget which shows up when the mouse curser enter a QmitkRenderWindow. -* The Menu Widget is located in the right top corner of each RenderWindow. It includes different settings. For example -* the layout design can be changed with the setting button. Switching between full-screen mode and layout design can be done -* with the full-screen button. Splitting the Widget horizontal or vertical as well closing the Widget is not implemented yet. -* The popup Widget can be deactivated with ActivateMenuWidget(false) in QmitkRenderWindow. -* -* \ingroup Renderer -* -* \sa QmitkRenderWindow -* \sa QmitkStdMultiWidget -* -*/ - + * \ingroup QmitkModule + * \brief The QmitkRenderWindowMenu is a popup Widget which shows + * up when the mouse curser enter a QmitkRenderWindow. + * The Menu Widget is located in the right top corner of each + * RenderWindow. It includes different settings. For example + * the layout design can be changed with the setting button. Switching + * between full-screen mode and layout design can be done + * with the full-screen button. Splitting the Widget horizontal or + * vertical as well closing the Widget is not implemented yet. + * The popup Widget can be deactivated with ActivateMenuWidget(false) in + * QmitkRenderWindow. + * + * \sa QmitkRenderWindow + * \sa QmitkStdMultiWidget + * + */ class QMITK_EXPORT QmitkRenderWindowMenu : public QWidget { Q_OBJECT public: QmitkRenderWindowMenu( QWidget* parent = 0, Qt::WFlags f = 0, mitk::BaseRenderer * b = 0, QmitkStdMultiWidget* mw = 0 ); virtual ~QmitkRenderWindowMenu(); /*! Return visibility of settings menu. The menu is connected with m_SettingsButton and includes layout direction (axial, coronal .. ) and layout design (standard layout, 2D images top, 3D bottom ... ). */ bool GetSettingsMenuVisibilty() { if( m_Settings == NULL) return false; else return m_Settings->isVisible(); } /*! Set layout index. Defines layout direction (axial, coronal, sagital or threeD) of the parent. */ void SetLayoutIndex( unsigned int layoutIndex ); /*! Return layout direction of parent (axial, coronal, sagital or threeD) */ unsigned int GetLayoutIndex() { return m_Layout; } /*! Update list of layout design (standard layout, 2D images top, 3D bottom ..). Set action of current layout design to disable and all other to enable. */ void UpdateLayoutDesignList( int layoutDesignIndex ); /*! Move menu widget to correct position (right upper corner). E.g. it is necessary when the full-screen mode is activated.*/ #ifdef QMITK_USE_EXTERNAL_RENDERWINDOW_MENU void MoveWidgetToCorrectPos(float opacity); #else void MoveWidgetToCorrectPos(float /*opacity*/); #endif void ChangeFullScreenMode( bool state ); void NotifyNewWidgetPlanesMode( int mode ); protected: /*! Create menu widget. The menu contains five QPushButtons (hori-split, verti-split, full-screen, settings and close button) and their signal/slot connection for handling. */ void CreateMenuWidget(); /*! Create settings menu which contains layout direction and the different layout designs. */ void CreateSettingsWidget(); /*! Reimplemented from QWidget. The paint event is a request to repaint all or part of a widget.*/ void paintEvent(QPaintEvent *event); /*! Update list of layout direction (axial, coronal, sagital or threeD). Set action of currect layout direction to disable and all other to enable. Normaly the user can switch here between the different layout direction, but this is not supported yet. */ void UpdateLayoutList(); /*! Change Icon of full-screen button depending on full-screen mode. */ void ChangeFullScreenIcon(); int currentCrosshairRotationMode; public slots: void SetCrossHairVisibility( bool state ) ; signals: void ResetView(); // == "global reinit" // \brief int parameters are enum from QmitkStdMultiWidget void ChangeCrosshairRotationMode(int); /*! emit signal, when layout design changed by the setting menu.*/ void SignalChangeLayoutDesign( int layoutDesign ); public slots: void DeferredHideMenu( ); void DeferredShowMenu( ); void smoothHide( ); protected slots: /// /// this function is continously called by a timer /// to do the auto rotation /// void AutoRotateNextStep(); /// /// this function is invoked when the auto-rotate action /// is clicked /// void OnAutoRotationActionTriggered(); void enterEvent( QEvent* /*e*/ ); void leaveEvent( QEvent* /*e*/ ); void OnTSNumChanged(int); void OnCrosshairRotationModeSelected(QAction*); /*! slot for activating/deactivating the full-screen mode. The slot is connected to the clicked() event of m_FullScreenButton. Activating the full-screen maximize the current widget, deactivating restore If layout design changed by the settings menu, the full-Screen mode is automatically switch to false. */ void OnFullScreenButton( bool checked ); /*! Slot for opening setting menu. The slot is connected to the clicked() event of m_SettingsButton. The settings menu includes differen layout directions (axial, coronal, saggital and 3D) as well all layout design (standard layout, 2D images top, 3D bottom ..)*/ void OnSettingsButton( bool checked ); /*! Slot for changing layout design to standard layout. The slot is connected to the triggered() signal of m_DefaultLayoutAction. */ void OnChangeLayoutToDefault(bool); /*! Slot for changing layout design to 2D images top, 3D bottom layout. The slot is connected to the triggered() signal of m_2DImagesUpLayoutAction. */ void OnChangeLayoutTo2DImagesUp(bool); /*! Slot for changing layout design to 2D images left, 3D right layout. The slot is connected to the triggered() signal of m_2DImagesLeftLayoutAction. */ void OnChangeLayoutTo2DImagesLeft(bool); /*! Slot for changing layout to Big 3D layout. The slot is connected to the triggered() signal of m_Big3DLayoutAction. */ void OnChangeLayoutToBig3D(bool); /*! Slot for changing layout design to Axial plane layout. The slot is connected to the triggered() signal of m_Widget1LayoutAction. */ void OnChangeLayoutToWidget1(bool); /*! Slot for changing layout design to Sagittal plane layout. The slot is connected to the triggered() signal of m_Widget2LayoutAction. */ void OnChangeLayoutToWidget2(bool); /*! Slot for changing layout design to Coronal plane layout. The slot is connected to the triggered() signal of m_Widget3LayoutAction. */ void OnChangeLayoutToWidget3(bool); /*! Slot for changing layout design to Coronal top, 3D bottom layout. The slot is connected to the triggered() signal of m_RowWidget3And4LayoutAction. */ void OnChangeLayoutToRowWidget3And4(bool); /*! Slot for changing layout design to Coronal left, 3D right layout. The slot is connected to the triggered() signal of m_ColumnWidget3And4LayoutAction. */ void OnChangeLayoutToColumnWidget3And4(bool); /*! Slot for changing layout design to Sagittal top, Coronal n 3D bottom layout. The slot is connected to the triggered() signal of m_SmallUpperWidget2Big3and4LayoutAction. */ void OnChangeLayoutToSmallUpperWidget2Big3and4(bool); /*! Slot for changing layout design to Axial n Sagittal left, 3D right layout. The slot is connected to the triggered() signal of m_2x2Dand3DWidgetLayoutAction. */ void OnChangeLayoutTo2x2Dand3DWidget(bool); /*! Slot for changing layout design to Axial n 3D left, Sagittal right layout. The slot is connected to the triggered() signal of m_Left2Dand3DRight2DLayoutAction. */ void OnChangeLayoutToLeft2Dand3DRight2D(bool); void OnCrossHairMenuAboutToShow(); public: /*! enum for layout direction*/ enum { #ifdef _MSC_VER TRANSVERSAL, // deprecated #endif AXIAL = 0, SAGITTAL, CORONAL, THREE_D }; #ifdef __GNUC__ __attribute__ ((deprecated)) static const int TRANSVERSAL = AXIAL; #endif /*! enum for layout design */ enum { LAYOUT_DEFAULT, LAYOUT_2DIMAGEUP, LAYOUT_2DIMAGELEFT, LAYOUT_BIG3D, #ifdef _MSC_VER LAYOUT_TRANSVERSAL, // deprecated #endif LAYOUT_AXIAL = LAYOUT_BIG3D + 1, LAYOUT_SAGITTAL, LAYOUT_CORONAL, LAYOUT_2X2DAND3DWIDGET, LAYOUT_ROWWIDGET3AND4, LAYOUT_COLUMNWIDGET3AND4, LAYOUT_ROWWIDGETSMALL3ANDBIG4, //not in use in this class, but we need it here to synchronize with the SdtMultiWidget. LAYOUT_SMALLUPPERWIDGET2BIGAND4, LAYOUT_LEFT2DAND3DRIGHT2D }; #ifdef __GNUC__ __attribute__ ((deprecated)) static const int LAYOUT_TRANSVERSAL = LAYOUT_AXIAL; #endif void ShowMenu(); void HideMenu(); protected: QPushButton* m_CrosshairModeButton; //QAction* m_ShowHideCrosshairVisibilityAction; /*! QPushButton for activating/deactivating full-screen mode*/ QPushButton* m_FullScreenButton; /*! QPushButton for open the settings menu*/ QPushButton* m_SettingsButton; /*! QAction for Default layout design */ QAction* m_DefaultLayoutAction; /*! QAction for 2D images up layout design */ QAction* m_2DImagesUpLayoutAction; /*! QAction for 2D images left layout design */ QAction* m_2DImagesLeftLayoutAction; /*! QAction for big 3D layout design */ QAction* m_Big3DLayoutAction; /*! QAction for big axial layout design */ QAction* m_Widget1LayoutAction; /*! QAction for big saggital layout design */ QAction* m_Widget2LayoutAction; /*! QAction for big coronal layout design */ QAction* m_Widget3LayoutAction; /*! QAction for coronal top, 3D bottom layout design */ QAction* m_RowWidget3And4LayoutAction; /*! QAction for coronal left, 3D right layout design */ QAction* m_ColumnWidget3And4LayoutAction; /*! QAction for sagittal top, coronal n 3D bottom layout design */ QAction* m_SmallUpperWidget2Big3and4LayoutAction; /*! QAction for axial n sagittal left, 3D right layout design */ QAction* m_2x2Dand3DWidgetLayoutAction; /*! QAction for axial n 3D left, sagittal right layout design*/ QAction* m_Left2Dand3DRight2DLayoutAction; QLabel *m_TSLabel; /*! QMenu containg all layout direction and layout design settings.*/ QMenu* m_Settings; QMenu* m_CrosshairMenu; /*! Index of layout direction. 0: axial; 1: saggital; 2: coronal; 3: threeD */ unsigned int m_Layout; /*! Index of layout design. 0: LAYOUT_DEFAULT; 1: LAYOUT_2DIMAGEUP; 2: LAYOUT_2DIMAGELEFT; 3: LAYOUT_BIG3D 4: LAYOUT_AXIAL; 5: LAYOUT_SAGITTAL; 6: LAYOUT_CORONAL; 7: LAYOUT_2X2DAND3DWIDGET; 8: LAYOUT_ROWWIDGET3AND4; 9: LAYOUT_COLUMNWIDGET3AND4; 10: LAYOUT_ROWWIDGETSMALL3ANDBIG4; 11: LAYOUT_SMALLUPPERWIDGET2BIGAND4; 12: LAYOUT_LEFT2DAND3DRIGHT2D */ unsigned int m_LayoutDesign; /*! Store index of old layout design. It is used e.g. for the full-screen mode, when deactivating the mode the former layout design will restore.*/ unsigned int m_OldLayoutDesign; /*! Flag if full-screen mode is activated or deactivated. */ bool m_FullScreenMode; bool m_Entered; bool m_Hidden; private: mitk::BaseRenderer::Pointer m_Renderer; QmitkStdMultiWidget* m_MultiWidget; /// /// a timer for the auto rotate action /// QTimer m_AutoRotationTimer; }; #endif // QmitkRenderWindowMenu_H diff --git a/Modules/Qmitk/QmitkRenderingManager.h b/Modules/Qmitk/QmitkRenderingManager.h index 610d1be80e..dd0b526c49 100644 --- a/Modules/Qmitk/QmitkRenderingManager.h +++ b/Modules/Qmitk/QmitkRenderingManager.h @@ -1,88 +1,88 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 #define QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197 #include #include "mitkRenderingManager.h" #include #include class QmitkRenderingManagerInternal; class QmitkRenderingManagerFactory; /** + * \ingroup QmitkModule * \brief Qt specific implementation of mitk::RenderingManager. * * This implementation defines a QmitkRenderingRequestEvent to realize the * rendering request process. The event must be handled by the Qmitk * interface to Qt (QmitkRenderWindow). * * Note: it may be necessary to remove all pending RenderingRequestEvents * from the system's event processing pipeline during system shutdown to * make sure that dangling events do not lead to unexpected behavior. * - * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderingManager : public QObject, public mitk::RenderingManager { Q_OBJECT public: mitkClassMacro( QmitkRenderingManager, mitk::RenderingManager ); virtual ~QmitkRenderingManager(); virtual void DoMonitorRendering(); virtual void DoFinishAbortRendering(); virtual bool event( QEvent *event ); protected: itkFactorylessNewMacro(Self); QmitkRenderingManager(); virtual void GenerateRenderingRequestEvent(); virtual void StartOrResetTimer(); int pendingTimerCallbacks; protected slots: void TimerCallback(); private: friend class QmitkRenderingManagerFactory; }; class QmitkRenderingRequestEvent : public QEvent { public: enum Type { RenderingRequest = QEvent::MaxUser - 1024 }; QmitkRenderingRequestEvent() : QEvent( (QEvent::Type) RenderingRequest ) {}; }; #endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */ diff --git a/Modules/Qmitk/QmitkRenderingManagerFactory.h b/Modules/Qmitk/QmitkRenderingManagerFactory.h index a9d7bd927a..635afdb5e1 100644 --- a/Modules/Qmitk/QmitkRenderingManagerFactory.h +++ b/Modules/Qmitk/QmitkRenderingManagerFactory.h @@ -1,51 +1,51 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197 #define QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197 #include #include "mitkRenderingManagerFactory.h" /** + * \ingroup QmitkModule * \brief Qt specific implementation of mitk::RenderingManagerFactory. * * This class create QmitkRenderingManager instances via * #CreateRenderingManager. * * A static instance of QmitkRenderingManagerFactory is created in * QmitkRenderWindow, forcing the usage of QmitkRenderingManager for the Qt * platform. - * \ingroup Renderer */ class QMITK_EXPORT QmitkRenderingManagerFactory : public mitk::RenderingManagerFactory { public: QmitkRenderingManagerFactory(); ~QmitkRenderingManagerFactory(); virtual mitk::RenderingManager::Pointer CreateRenderingManager() const; private: }; #endif diff --git a/Modules/Qmitk/QmitkServiceListWidget.h b/Modules/Qmitk/QmitkServiceListWidget.h index 0c5e5d037b..aefac9a464 100644 --- a/Modules/Qmitk/QmitkServiceListWidget.h +++ b/Modules/Qmitk/QmitkServiceListWidget.h @@ -1,239 +1,245 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _QmitkServiceListWidget_H_INCLUDED #define _QmitkServiceListWidget_H_INCLUDED #include "QmitkExports.h" #include "ui_QmitkServiceListWidgetControls.h" #include //QT headers #include #include //Microservices #include "usServiceReference.h" #include "usModuleContext.h" #include "usServiceEvent.h" #include "usServiceInterface.h" /** -* @brief This widget provides abstraction for the handling of MicroServices . Place one in your Plugin and set it to look for a certain interface. -* One can also specify a filter and / or a property to use for captioning of the services. It also offers functionality to signal -* ServiceEvents and to return the actual classes, so only a minimum of interaction with the MicroserviceInterface is required. -* To get started, just put it in your Plugin or Widget, call the Initialize Method and optionally connect it's signals. -* As QT limits templating possibilities, events only throw ServiceReferences. You can manually dereference them using TranslateServiceReference() -* -* @ingroup QMITK + * \ingroup QmitkModule + * + * \brief This widget provides abstraction for the handling of MicroServices. + * + * Place one in your Plugin and set it to look for a certain interface. + * One can also specify a filter and / or a property to use for captioning of + * the services. It also offers functionality to signal + * ServiceEvents and to return the actual classes, so only a minimum of + * interaction with the MicroserviceInterface is required. + * To get started, just put it in your Plugin or Widget, call the Initialize + * Method and optionally connect it's signals. + * As QT limits templating possibilities, events only throw ServiceReferences. + * You can manually dereference them using TranslateServiceReference() */ class QMITK_EXPORT QmitkServiceListWidget :public QWidget { //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT private: mitk::ModuleContext* m_Context; /** \brief a filter to further narrow down the list of results*/ std::string m_Filter; /** \brief The name of the ServiceInterface that this class should list */ std::string m_Interface; /** \brief The name of the ServiceProperty that will be displayed in the list to represent the service */ std::string m_NamingProperty; public: static const std::string VIEW_ID; QmitkServiceListWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); virtual ~QmitkServiceListWidget(); /** \brief This method is part of the widget an needs not to be called separately. */ virtual void CreateQtPartControl(QWidget *parent); /** \brief This method is part of the widget an needs not to be called separately. (Creation of the connections of main and control widget.)*/ virtual void CreateConnections(); /** * \brief Will return true, if a service is currently selected and false otherwise. * * Call this before requesting service references to avoid invalid ServiceReferences. */ bool GetIsServiceSelected(); /** * \brief Returns the currently selected Service as a ServiceReference. * * If no Service is selected, the result will probably be a bad pointer. call GetIsServiceSelected() * beforehand to avoid this */ mitk::ServiceReference GetSelectedServiceReference(); /** * \brief Use this function to return the currently selected service as a class directly. * * Make sure you pass the appropriate type, or else this call will fail. * Usually, you will pass the class itself, not the SmartPointer, but the function returns a pointer. Example: * \verbatim mitk::USDevice::Pointer device = GetSelectedService(); \endverbatim */ template T* GetSelectedService() { mitk::ServiceReference ref = GetServiceForListItem( this->m_Controls->m_ServiceList->currentItem() ); return ( m_Context->GetService(ref) ); } /** * \brief Initializes the Widget with essential parameters. * * The string filter is an LDAP parsable String, compare mitk::ModuleContext for examples on filtering. * Pass class T to tell the widget which class it should filter for - only services of this class will be listed. * NamingProperty is a property that will be used to caption the Items in the list. If no filter is supplied, all * matching interfaces are shown. If no namingProperty is supplied, the interfaceName will be used to caption Items in the list. * For example, this Initialization will filter for all USDevices that are set to active. The USDevice's model will be used to display it in the list: * \verbatim std::string filter = "(&(" + mitk::ServiceConstants::OBJECTCLASS() + "=" + "org.mitk.services.UltrasoundDevice)(IsActive=true))"; m_Controls.m_ActiveVideoDevices->Initialize(mitk::USImageMetadata::PROP_DEV_MODEL ,filter); * \endverbatim */ template void Initialize(const std::string& namingProperty = static_cast< std::string >(""),const std::string& filter = static_cast< std::string >("")) { std::string interfaceName ( us_service_interface_iid() ); m_Interface = interfaceName; InitPrivate(namingProperty, filter); } /** * \brief Translates a serviceReference to a class of the given type. * * Use this to translate the signal's parameters. To adhere to the MicroService contract, * only ServiceReferences stemming from the same widget should be used as parameters for this method. * \verbatim mitk::USDevice::Pointer device = TranslateReference(myDeviceReference); \endverbatim */ template T* TranslateReference(mitk::ServiceReference reference) { return dynamic_cast ( m_Context->GetService(reference) ); } /** *\brief This Function listens to ServiceRegistry changes and updates the list of services accordingly. * * The user of this widget does not need to call this method, it is instead used to recieve events from the module registry. */ void OnServiceEvent(const mitk::ServiceEvent event); signals: /** *\brief Emitted when a new Service matching the filter is being registered. * * Be careful if you use a filter: * If a device does not match the filter when registering, but modifies it's properties later to match the filter, * then the first signal you will see this device in will be ServiceModified. */ void ServiceRegistered(mitk::ServiceReference); /** *\brief Emitted directly before a Service matching the filter is being unregistered. */ void ServiceUnregistering(mitk::ServiceReference); /** *\brief Emitted when a Service matching the filter changes it's properties, or when a service that formerly not matched the filter * changed it's properties and now matches the filter. */ void ServiceModified(mitk::ServiceReference); /** *\brief Emitted when a Service matching the filter changes it's properties, * * and the new properties make it fall trough the filter. This effectively means that * the widget will not track the service anymore. Usually, the Service should still be useable though */ void ServiceModifiedEndMatch(mitk::ServiceReference); /** *\brief Emitted if the user selects a Service from the list. * * If no service is selected, an invalid serviceReference is returned. The user can easily check for this. * if (serviceReference) will evaluate to false, if the reference is invalid and true if valid. */ void ServiceSelectionChanged(mitk::ServiceReference); public slots: protected slots: /** \brief Called, when the selection in the list of Services changes. */ void OnServiceSelectionChanged(); protected: Ui::QmitkServiceListWidgetControls* m_Controls; ///< member holding the UI elements of this widget /** * \brief Internal structure used to link ServiceReferences to their QListWidgetItems */ struct ServiceListLink { mitk::ServiceReference service; QListWidgetItem* item; }; /** * \brief Finishes initialization after Initialize has been called. * * This function assumes that m_Interface is set correctly (Which Initialize does). */ void InitPrivate(const std::string& namingProperty, const std::string& filter); /** * \brief Contains a list of currently active services and their entires in the list. This is wiped with every ServiceRegistryEvent. */ std::vector m_ListContent; /** * \brief Constructs a ListItem from the given service, displays it, and locally stores the service. */ QListWidgetItem* AddServiceToList(mitk::ServiceReference serviceRef); /** * \brief Removes the given service from the list and cleans up. Returns true if successful, false if service was not found. */ bool RemoveServiceFromList(mitk::ServiceReference serviceRef); /** * \brief Returns the serviceReference corresponding to the given ListEntry or an invalid one if none was found (will evaluate to false in bool expressions). */ mitk::ServiceReference GetServiceForListItem(QListWidgetItem* item); /** * \brief Returns a list of ServiceReferences matching the filter criteria by querying the service registry. */ std::list GetAllRegisteredServices(); }; #endif // _QmitkServiceListWidget_H_INCLUDED diff --git a/Modules/Qmitk/QmitkSliderLevelWindowWidget.h b/Modules/Qmitk/QmitkSliderLevelWindowWidget.h index b43d32922a..b3663fa1a6 100644 --- a/Modules/Qmitk/QmitkSliderLevelWindowWidget.h +++ b/Modules/Qmitk/QmitkSliderLevelWindowWidget.h @@ -1,183 +1,195 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKSLIDERLEVELWINDOW_WIDGET #define QMITKSLIDERLEVELWINDOW_WIDGET #include #include #include class QmitkLevelWindowWidgetContextMenu; /** - \class QmitkSliderLevelWindowWidget QmitkSliderLevelWindowWidget.h QmitkSliderLevelWindowWidget.h - \ingroup Widgets - - \brief Provides a widget with a slider to change the level and window value of the current image. - - This documentation actually refers to the QmitkLevelWindowWidget and is only put in this class due to technical issues (should be moved later). - - The QmitkLevelWindowWidget is a kind of container for a - QmitkSliderLevelWindowWidget (this is the cyan bar above the text input - fields) and a QmitkLineEditLevelWindowWidget (with two text input fields). It holds a reference to a - mitk::LevelWindowManager variable, which keeps the LevelWindowProperty of the currently selected image. - Level/Window is manipulated by the text inputs and the Slider to adjust brightness/contrast of a single image. - All changes on the slider or in the text input fields affect the current image by giving new values to LevelWindowManager. - LevelWindowManager then sends a signal to tell other listeners about changes. - - Which image is changed is determined by mitkLevelWindowManager. If m_AutoTopMost is true, always the topmost image - in data tree (layer property) is affected by changes. - The image which is affected by changes can also be changed by QmitkLevelWindowWidgetContextMenu, the context menu - for QmitkSliderLevelWindowWidget and QmitkLineEditLevelWindowWidget. There you have the possibility to set - a certain image or always the topmost image in the data tree (layer property) to be affected by changes. - - The internal mitk::LevelWindow variable contains a range that is valid for - a given image. It should not be possible to move the level/window - parameters outside this range. The range can be changed and reset to its default values - by QmitkLevelWindowWidgetContextMenu, the context menu for QmitkSliderLevelWindowWidget and - QmitkLineEditLevelWindowWidget. - - Now for the behaviour of the text inputs: The upper one contains the - value of the level (brightness), the lower one shows the window (contrast). - - The behaviour of the cyan bar is more obvious: the scale in the background shows the valid range. - The cyan bar in front displays the currently selected level/window setting. - You can change the level by dragging the bar with the left mouse button or clicking somewhere inside the scalerange with the left mouse button. - The window is changed by moving the mouse on the upper or lower bound of the bar until the cursor becomes an vertical double-arrowed symbol. - Then you can change the windowsize by clicking the left mouse button and move the mouse upwards or downwards. - The bar becomes greater upwards as well as downwards. If you want to change the size of the window in only one - direction you have to press the CTRL-key while doing the same as mentioned above. - This information is also presented by a tooltip text when moving the mouse on the upper or lower bound of the bar. - - */ - + * \ingroup QmitkModule + * + * \brief Provides a widget with a slider to change the level and + * window value of the current image. + * + * This documentation actually refers to the QmitkLevelWindowWidget + * and is only put in this class due to technical issues (should be + * moved later). + * + * The QmitkLevelWindowWidget is a kind of container for a + * QmitkSliderLevelWindowWidget (this is the cyan bar above the text + * input fields) and a QmitkLineEditLevelWindowWidget (with two text + * input fields). It holds a reference to a mitk::LevelWindowManager + * variable, which keeps the LevelWindowProperty of the currently + * selected image. Level/Window is manipulated by the text inputs and + * the Slider to adjust brightness/contrast of a single image. All + * changes on the slider or in the text input fields affect the current + * image by giving new values to LevelWindowManager. LevelWindowManager + * then sends a signal to tell other listeners about changes. + * + * Which image is changed is determined by mitkLevelWindowManager. If + * m_AutoTopMost is true, always the topmost image in data tree (layer + * property) is affected by changes. The image which is affected by + * changes can also be changed by QmitkLevelWindowWidgetContextMenu, + * the context menu for QmitkSliderLevelWindowWidget and + * QmitkLineEditLevelWindowWidget. There you have the possibility to + * set a certain image or always the topmost image in the data tree + * (layer property) to be affected by changes. + * + * The internal mitk::LevelWindow variable contains a range that is + * valid for a given image. It should not be possible to move the + * level/window parameters outside this range. The range can be changed + * and reset to its default values by QmitkLevelWindowWidgetContextMenu, + * the context menu for QmitkSliderLevelWindowWidget and + * QmitkLineEditLevelWindowWidget. + * + * Now for the behaviour of the text inputs: The upper one contains the + * value of the level (brightness), the lower one shows the window (contrast). + * + * The behaviour of the cyan bar is more obvious: the scale in the + * background shows the valid range. The cyan bar in front displays the + * currently selected level/window setting. You can change the level by + * dragging the bar with the left mouse button or clicking somewhere inside + * the scalerange with the left mouse button. The window is changed by + * moving the mouse on the upper or lower bound of the bar until the cursor + * becomes an vertical double-arrowed symbol. Then you can change the + * windowsize by clicking the left mouse button and move the mouse upwards + * or downwards. The bar becomes greater upwards as well as downwards. If + * you want to change the size of the window in only one direction you + * have to press the CTRL-key while doing the same as mentioned above. + * This information is also presented by a tooltip text when moving the + * mouse on the upper or lower bound of the bar. + */ class QMITK_EXPORT QmitkSliderLevelWindowWidget : public QWidget { Q_OBJECT public: /// constructor QmitkSliderLevelWindowWidget( QWidget * parent=0, Qt::WindowFlags f = 0 ); /// destructor ~QmitkSliderLevelWindowWidget(); /*! * data structure which stores the values manipulated * by a QmitkSliderLevelWindowWidget */ mitk::LevelWindow m_LevelWindow; /// manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager::Pointer m_Manager; /// sets the manager who is responsible to collect and deliver changes on Level/Window void setLevelWindowManager(mitk::LevelWindowManager* levelWindowManager); /// sets the DataStorage which holds all image-nodes void setDataStorage(mitk::DataStorage* ds); /// returns the manager who is responsible to collect and deliver changes on Level/Window mitk::LevelWindowManager* GetManager(); private: /// creates the contextmenu for this widget from class QmitkLevelWindowWidgetContextMenu void contextMenuEvent ( QContextMenuEvent * ); /// change notifications from the mitkLevelWindowManager void OnPropertyModified(const itk::EventObject& e); protected: /// recalculate the size and position of the slider bar virtual void update( ); /*! * helper for drawing the component */ QRect m_Rect; /*! * helper for drawing the component */ QPoint m_StartPos; bool m_Resize; bool m_Bottom; bool m_MouseDown; bool m_Leftbutton; bool m_CtrlPressed; int m_MoveHeight; bool m_ScaleVisible; QRect m_LowerBound; QRect m_UpperBound; unsigned long m_ObserverTag; bool m_IsObserverTagSet; QFont m_Font; /*! * data structure which creates the contextmenu for QmitkLineEditLevelWindowWidget */ QmitkLevelWindowWidgetContextMenu* m_Contextmenu; /*! * repaint the slider and the scale */ void paintEvent( QPaintEvent* e ); /*! * method implements the component behaviour * * checks if cursor is on upper or lower bound of slider bar and changes cursor symbol * * checks if left mouse button is pressed and if CTRL is pressed and changes sliderbar in movedirection accordingly */ void mouseMoveEvent( QMouseEvent* mouseEvent ); void enterEvent ( QEvent * event ); /*! * registers events when a mousebutton is pressed * * if leftbutton is pressed m_Leftbutton is set to true * * also checks if CTRL is pressed and sets the bool variable m_CtrlPressed */ void mousePressEvent( QMouseEvent* mouseEvent ); /*! * sets the variable m_MouseDown to false */ void mouseReleaseEvent( QMouseEvent* mouseEvent ); /*! * causes an update of the sliderbar when resizing the window */ void virtual resizeEvent ( QResizeEvent * event ); protected slots: /// hides the scale if "Hide Scale" is selected in contextmenu void hideScale(); /// shows the scale if "Show Scale" is selected in contextmenu void showScale(); }; #endif //QMITKSLIDERLEVELWINDOW_WIDGET diff --git a/Modules/Qmitk/QmitkStdMultiWidget.h b/Modules/Qmitk/QmitkStdMultiWidget.h index 2daaa8866b..e68e3ec9d4 100644 --- a/Modules/Qmitk/QmitkStdMultiWidget.h +++ b/Modules/Qmitk/QmitkStdMultiWidget.h @@ -1,359 +1,360 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKSTDMULTIWIDGET_H_ #define QMITKSTDMULTIWIDGET_H_ #include #include "mitkPositionTracker.h" #include "mitkSlicesRotator.h" #include "mitkSlicesSwiveller.h" #include "mitkRenderWindowFrame.h" #include "mitkManufacturerLogo.h" #include "mitkGradientBackground.h" #include "mitkCoordinateSupplier.h" #include "mitkDataStorage.h" #include "mitkMouseModeSwitcher.h" #include #include #include #include #include #include "vtkTextProperty.h" #include "vtkCornerAnnotation.h" class QHBoxLayout; class QVBoxLayout; class QGridLayout; class QSpacerItem; class QmitkLevelWindowWidget; class QmitkRenderWindow; namespace mitk { class RenderingManager; } +/// \ingroup QmitkModule class QMITK_EXPORT QmitkStdMultiWidget : public QWidget { Q_OBJECT public: QmitkStdMultiWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, mitk::RenderingManager* renderingManager = 0); virtual ~QmitkStdMultiWidget(); mitk::SliceNavigationController* GetTimeNavigationController(); void RequestUpdate(); void ForceImmediateUpdate(); mitk::MouseModeSwitcher* GetMouseModeSwitcher(); QmitkRenderWindow* GetRenderWindow1() const; QmitkRenderWindow* GetRenderWindow2() const; QmitkRenderWindow* GetRenderWindow3() const; QmitkRenderWindow* GetRenderWindow4() const; const mitk::Point3D & GetLastLeftClickPosition() const; const mitk::Point3D GetCrossPosition() const; void EnablePositionTracking(); void DisablePositionTracking(); int GetLayout() const; mitk::SlicesRotator * GetSlicesRotator() const; mitk::SlicesSwiveller * GetSlicesSwiveller() const; bool GetGradientBackgroundFlag() const; /*! \brief Access node of widget plane 1 \return DataNode holding widget plane 1 */ mitk::DataNode::Pointer GetWidgetPlane1(); /*! \brief Access node of widget plane 2 \return DataNode holding widget plane 2 */ mitk::DataNode::Pointer GetWidgetPlane2(); /*! \brief Access node of widget plane 3 \return DataNode holding widget plane 3 */ mitk::DataNode::Pointer GetWidgetPlane3(); /*! \brief Convenience method to access node of widget planes \param id number of widget plane to be returned \return DataNode holding widget plane 3 */ mitk::DataNode::Pointer GetWidgetPlane(int id); bool IsColoredRectanglesEnabled() const; bool IsDepartmentLogoEnabled() const; bool IsCrosshairNavigationEnabled() const; void InitializeWidget(); /// called when the StdMultiWidget is closed to remove the 3 widget planes and the helper node from the DataStorage void RemovePlanesFromDataStorage(); void AddPlanesToDataStorage(); void SetDataStorage( mitk::DataStorage* ds ); /** \brief Listener to the CrosshairPositionEvent Ensures the CrosshairPositionEvent is handled only once and at the end of the Qt-Event loop */ void HandleCrosshairPositionEvent(); /// activate Menu Widget. true: activated, false: deactivated void ActivateMenuWidget( bool state ); bool IsMenuWidgetEnabled() const; protected: void UpdateAllWidgets(); void HideAllWidgetToolbars(); public slots: /// Receives the signal from HandleCrosshairPositionEvent, executes the StatusBar update void HandleCrosshairPositionEventDelayed(); void changeLayoutTo2DImagesUp(); void changeLayoutTo2DImagesLeft(); void changeLayoutToDefault(); void changeLayoutToBig3D(); void changeLayoutToWidget1(); void changeLayoutToWidget2(); void changeLayoutToWidget3(); void changeLayoutToRowWidget3And4(); void changeLayoutToColumnWidget3And4(); void changeLayoutToRowWidgetSmall3andBig4(); void changeLayoutToSmallUpperWidget2Big3and4(); void changeLayoutTo2x2Dand3DWidget(); void changeLayoutToLeft2Dand3DRight2D(); void changeLayoutTo2DUpAnd3DDown(); void Fit(); void InitPositionTracking(); void AddDisplayPlaneSubTree(); void EnableStandardLevelWindow(); void DisableStandardLevelWindow(); bool InitializeStandardViews( const mitk::Geometry3D * geometry ); void wheelEvent( QWheelEvent * e ); void mousePressEvent(QMouseEvent * e); void moveEvent( QMoveEvent* e ); void leaveEvent ( QEvent * e ); void EnsureDisplayContainsPoint( mitk::DisplayGeometry* displayGeometry, const mitk::Point3D& p); void MoveCrossToPosition(const mitk::Point3D& newPosition); void EnableNavigationControllerEventListening(); void DisableNavigationControllerEventListening(); void EnableGradientBackground(); void DisableGradientBackground(); void EnableDepartmentLogo(); void DisableDepartmentLogo(); void EnableColoredRectangles(); void DisableColoredRectangles(); void SetWidgetPlaneVisibility(const char* widgetName, bool visible, mitk::BaseRenderer *renderer=NULL); void SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer=NULL); void SetWidgetPlanesLocked(bool locked); void SetWidgetPlanesRotationLocked(bool locked); void SetWidgetPlanesRotationLinked( bool link ); void SetWidgetPlaneMode( int mode ); void SetGradientBackgroundColors( const mitk::Color & upper, const mitk::Color & lower ); void SetDepartmentLogoPath( const char * path ); void SetWidgetPlaneModeToSlicing( bool activate ); void SetWidgetPlaneModeToRotation( bool activate ); void SetWidgetPlaneModeToSwivel( bool activate ); void OnLayoutDesignChanged( int layoutDesignIndex ); void ResetCrosshair(); void MouseModeSelected( mitk::MouseModeSwitcher::MouseMode mouseMode ); signals: void LeftMouseClicked(mitk::Point3D pointValue); void WheelMoved(QWheelEvent*); void WidgetPlanesRotationLinked(bool); void WidgetPlanesRotationEnabled(bool); void ViewsInitialized(); void WidgetPlaneModeSlicing(bool); void WidgetPlaneModeRotation(bool); void WidgetPlaneModeSwivel(bool); void WidgetPlaneModeChange(int); void WidgetNotifyNewCrossHairMode(int); void Moved(); public: /** Define RenderWindow (public)*/ QmitkRenderWindow* mitkWidget1; QmitkRenderWindow* mitkWidget2; QmitkRenderWindow* mitkWidget3; QmitkRenderWindow* mitkWidget4; QmitkLevelWindowWidget* levelWindowWidget; /********************************/ enum { PLANE_MODE_SLICING = 0, PLANE_MODE_ROTATION, PLANE_MODE_SWIVEL }; enum { LAYOUT_DEFAULT = 0, LAYOUT_2D_IMAGES_UP, LAYOUT_2D_IMAGES_LEFT, LAYOUT_BIG_3D, LAYOUT_WIDGET1, LAYOUT_WIDGET2, LAYOUT_WIDGET3, LAYOUT_2X_2D_AND_3D_WIDGET, LAYOUT_ROW_WIDGET_3_AND_4, LAYOUT_COLUMN_WIDGET_3_AND_4, LAYOUT_ROW_WIDGET_SMALL3_AND_BIG4 , LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4,LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET, LAYOUT_2D_UP_AND_3D_DOWN}; enum { TRANSVERSAL, AXIAL = TRANSVERSAL, SAGITTAL, CORONAL, THREE_D }; protected: QHBoxLayout* QmitkStdMultiWidgetLayout; int m_Layout; int m_PlaneMode; mitk::RenderingManager* m_RenderingManager; mitk::RenderWindowFrame::Pointer m_RectangleRendering3; mitk::RenderWindowFrame::Pointer m_RectangleRendering2; mitk::RenderWindowFrame::Pointer m_RectangleRendering1; mitk::RenderWindowFrame::Pointer m_RectangleRendering4; mitk::ManufacturerLogo::Pointer m_LogoRendering1; mitk::ManufacturerLogo::Pointer m_LogoRendering2; mitk::ManufacturerLogo::Pointer m_LogoRendering3; mitk::ManufacturerLogo::Pointer m_LogoRendering4; mitk::GradientBackground::Pointer m_GradientBackground1; mitk::GradientBackground::Pointer m_GradientBackground2; mitk::GradientBackground::Pointer m_GradientBackground4; mitk::GradientBackground::Pointer m_GradientBackground3; bool m_GradientBackgroundFlag; mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher; mitk::CoordinateSupplier::Pointer m_LastLeftClickPositionSupplier; mitk::PositionTracker::Pointer m_PositionTracker; mitk::SliceNavigationController* m_TimeNavigationController; mitk::SlicesRotator::Pointer m_SlicesRotator; mitk::SlicesSwiveller::Pointer m_SlicesSwiveller; mitk::DataNode::Pointer m_PositionTrackerNode; mitk::DataStorage::Pointer m_DataStorage; mitk::DataNode::Pointer m_PlaneNode1; mitk::DataNode::Pointer m_PlaneNode2; mitk::DataNode::Pointer m_PlaneNode3; mitk::DataNode::Pointer m_Node; QSplitter *m_MainSplit; QSplitter *m_LayoutSplit; QSplitter *m_SubSplit1; QSplitter *m_SubSplit2; QWidget *mitkWidget1Container; QWidget *mitkWidget2Container; QWidget *mitkWidget3Container; QWidget *mitkWidget4Container; struct { vtkCornerAnnotation *cornerText; vtkTextProperty *textProp; vtkRenderer *ren; } m_CornerAnnotaions[3]; bool m_PendingCrosshairPositionEvent; bool m_CrosshairNavigationEnabled; }; #endif /*QMITKSTDMULTIWIDGET_H_*/