diff --git a/Modules/SemanticRelationsUI/include/QmitkControlPointDialog.h b/Modules/SemanticRelationsUI/include/QmitkControlPointDialog.h index f8c23395da..10ff4208b5 100644 --- a/Modules/SemanticRelationsUI/include/QmitkControlPointDialog.h +++ b/Modules/SemanticRelationsUI/include/QmitkControlPointDialog.h @@ -1,46 +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 QMITKCONTROLPOINTDIALOG_H #define QMITKCONTROLPOINTDIALOG_H #include // semantic relations module #include "mitkSemanticTypes.h" #include #include class MITKSEMANTICRELATIONSUI_EXPORT QmitkControlPointDialog : public QDialog { Q_OBJECT public: QmitkControlPointDialog(QWidget *parent = nullptr); - virtual ~QmitkControlPointDialog(); - void SetCurrentDate(mitk::SemanticTypes::ControlPoint currentControlPoint); QDate GetCurrentDate() const; private: QDateEdit* m_DateEdit; }; #endif // QMITKCONTROLPOINTDIALOG_H diff --git a/Modules/SemanticRelationsUI/include/QmitkLesionTextDialog.h b/Modules/SemanticRelationsUI/include/QmitkLesionTextDialog.h index b50806adf9..b6a14a4429 100644 --- a/Modules/SemanticRelationsUI/include/QmitkLesionTextDialog.h +++ b/Modules/SemanticRelationsUI/include/QmitkLesionTextDialog.h @@ -1,49 +1,47 @@ /*=================================================================== 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 QMITKLESIONTEXTDIALOG_H #define QMITKLESIONTEXTDIALOG_H #include // semantic relations module #include "mitkSemanticTypes.h" #include #include class MITKSEMANTICRELATIONSUI_EXPORT QmitkLesionTextDialog : public QDialog { Q_OBJECT public: QmitkLesionTextDialog(QWidget *parent = nullptr); - virtual ~QmitkLesionTextDialog(); - void SetLineEditText(const std::string& lineEditText); QString GetLineEditText() const; QLineEdit* GetLineEdit() const; private: QLineEdit* m_LineEdit; }; #endif // QMITKLESIONTEXTDIALOG_H diff --git a/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h b/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h index 2cd05eec35..4c9c1afe8f 100644 --- a/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h +++ b/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h @@ -1,123 +1,122 @@ /*=================================================================== 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 QMITKLESIONTREEITEM_H #define QMITKLESIONTREEITEM_H // mitk semantic relations UI #include "mitkLesionData.h" // mitk semantic relations #include // qt #include // c++ #include #include /* * @brief */ class QmitkLesionTreeItem : public std::enable_shared_from_this { public: using ChildPointer = std::shared_ptr; using ChildConstPointer = std::shared_ptr; using ParentPointer = std::weak_ptr; QmitkLesionTreeItem(mitk::LesionData lesionData = mitk::LesionData()); - ~QmitkLesionTreeItem(); /** * @brief Return the child of this item at a specific position. * * @param row Determines the position of a child item to return. * * @return The child of this item at a specific position. */ ChildPointer GetChildInRow(int row) const { return m_Children.at(row); }; /** * @brief Return the parent item. * * @return The parent item as std::weak_ptr. */ ParentPointer GetParent() const { return m_ParentItem; }; /** * @brief Set the parent item of this item. * * @param parent The new parent item of this item. */ void SetParent(ParentPointer parent); /** * @brief Return the item data, which contains ... * * see mitk::LesionItemData */ mitk::LesionData& GetData() { return m_ItemData; }; /** * @brief Get the row of this item relative to its parent item using 'GetRowOfChild'. * * @return The row of this item relative to its parent item. */ int GetRow() const; /** * @brief Get the row of the given child item relative to this item. * * @param child The child item whose row is to be determined. * * @return The row of the child item. */ int GetRowOfChild(ChildConstPointer child) const; /** * @brief Return the number of child items. * * @return Number of child items. */ size_t ChildCount() const { return m_Children.size(); }; /** * @brief Add a new child to the list of children of this item if it is not already a child item. * * @param child The child item to add to this item. */ void AddChild(ChildPointer child); /** * @brief Remove a child from the list of children of this item. * * @param child The child item to remove from this item. */ void RemoveChild(ChildPointer child); /** * @brief Set the item data of this item. * * @param value LesionData that provides information about this item. */ void SetData(const mitk::LesionData& lesionData); private: ParentPointer m_ParentItem; std::vector m_Children; mitk::LesionData m_ItemData; }; Q_DECLARE_METATYPE(QmitkLesionTreeItem) Q_DECLARE_METATYPE(QmitkLesionTreeItem*) #endif // QMITKLESIONTREEITEM_H diff --git a/Modules/SemanticRelationsUI/src/QmitkControlPointDialog.cpp b/Modules/SemanticRelationsUI/src/QmitkControlPointDialog.cpp index 348aade318..0e4a199258 100644 --- a/Modules/SemanticRelationsUI/src/QmitkControlPointDialog.cpp +++ b/Modules/SemanticRelationsUI/src/QmitkControlPointDialog.cpp @@ -1,69 +1,65 @@ /*=================================================================== 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. ===================================================================*/ #include "QmitkControlPointDialog.h" #include #include #include #include #include QmitkControlPointDialog::QmitkControlPointDialog(QWidget* parent) : QDialog(parent) { QBoxLayout* verticalLayout = new QVBoxLayout(this); verticalLayout->setMargin(5); verticalLayout->setSpacing(5); QLabel* dateLabel = new QLabel(tr("Set date"), this); verticalLayout->addWidget(dateLabel); m_DateEdit = new QDateEdit(this); m_DateEdit->setDisplayFormat("yyyy-MM-dd"); m_DateEdit->setFocus(); verticalLayout->addWidget(m_DateEdit); QPushButton* acceptButton = new QPushButton(tr("Ok"), this); QPushButton* cancelButton = new QPushButton(tr("Cancel"), this); acceptButton->setDefault(true); connect(acceptButton, &QPushButton::clicked, this, &QmitkControlPointDialog::accept); connect(cancelButton, &QPushButton::clicked, this, &QmitkControlPointDialog::reject); QBoxLayout* horizontalLayout = new QHBoxLayout(); horizontalLayout->setSpacing(5); horizontalLayout->addStretch(); horizontalLayout->addWidget(acceptButton); horizontalLayout->addWidget(cancelButton); verticalLayout->addLayout(horizontalLayout); setMinimumSize(250, 100); } -QmitkControlPointDialog::~QmitkControlPointDialog() -{ -} - void QmitkControlPointDialog::SetCurrentDate(mitk::SemanticTypes::ControlPoint currentControlPoint) { m_DateEdit->setDate(QDate(currentControlPoint.date.year(), currentControlPoint.date.month(), currentControlPoint.date.day())); } QDate QmitkControlPointDialog::GetCurrentDate() const { return m_DateEdit->date(); } diff --git a/Modules/SemanticRelationsUI/src/QmitkLesionTextDialog.cpp b/Modules/SemanticRelationsUI/src/QmitkLesionTextDialog.cpp index 3ca3416a27..220b06898d 100644 --- a/Modules/SemanticRelationsUI/src/QmitkLesionTextDialog.cpp +++ b/Modules/SemanticRelationsUI/src/QmitkLesionTextDialog.cpp @@ -1,72 +1,67 @@ /*=================================================================== 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. ===================================================================*/ #include "QmitkLesionTextDialog.h" #include #include #include QmitkLesionTextDialog::QmitkLesionTextDialog(QWidget* parent) : QDialog(parent) { QBoxLayout* verticalLayout = new QVBoxLayout(this); verticalLayout->setMargin(5); verticalLayout->setSpacing(5); QLabel* dialogLabel = new QLabel(tr("Set lesion information"), this); verticalLayout->addWidget(dialogLabel); m_LineEdit = new QLineEdit(this); m_LineEdit->setFocus(); verticalLayout->addWidget(m_LineEdit); QPushButton* acceptButton = new QPushButton(tr("Ok"), this); QPushButton* cancelButton = new QPushButton(tr("Cancel"), this); acceptButton->setDefault(true); connect(acceptButton, &QPushButton::clicked, this, &QmitkLesionTextDialog::accept); connect(cancelButton, &QPushButton::clicked, this, &QmitkLesionTextDialog::reject); QBoxLayout* horizontalLayout = new QHBoxLayout(); horizontalLayout->setSpacing(5); horizontalLayout->addStretch(); horizontalLayout->addWidget(acceptButton); horizontalLayout->addWidget(cancelButton); verticalLayout->addLayout(horizontalLayout); setMinimumSize(250, 100); } -QmitkLesionTextDialog::~QmitkLesionTextDialog() -{ - // nothing here -} - void QmitkLesionTextDialog::SetLineEditText(const std::string& lineEditText) { m_LineEdit->setText(QString::fromStdString(lineEditText)); } QString QmitkLesionTextDialog::GetLineEditText() const { return m_LineEdit->text(); } QLineEdit* QmitkLesionTextDialog::GetLineEdit() const { return m_LineEdit; } diff --git a/Modules/SemanticRelationsUI/src/QmitkLesionTreeItem.cpp b/Modules/SemanticRelationsUI/src/QmitkLesionTreeItem.cpp index a698270871..291a7d31f9 100644 --- a/Modules/SemanticRelationsUI/src/QmitkLesionTreeItem.cpp +++ b/Modules/SemanticRelationsUI/src/QmitkLesionTreeItem.cpp @@ -1,86 +1,81 @@ /*=================================================================== 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. ===================================================================*/ // semantic relations UI module #include "QmitkLesionTreeItem.h" // qt #include QmitkLesionTreeItem::QmitkLesionTreeItem(mitk::LesionData lesionData/* = mitk::LesionTreeItemData()*/) { m_ItemData = lesionData; } -QmitkLesionTreeItem::~QmitkLesionTreeItem() -{ - // nothing here -} - void QmitkLesionTreeItem::SetParent(ParentPointer parent) { m_ParentItem = parent; } int QmitkLesionTreeItem::GetRow() const { if (m_ParentItem.expired()) { return 0; } auto parentItem = m_ParentItem.lock(); return parentItem->GetRowOfChild(this->shared_from_this()); } int QmitkLesionTreeItem::GetRowOfChild(ChildConstPointer child) const { auto it = std::find(m_Children.begin(), m_Children.end(), child); if (it == m_Children.end()) { return -1; } else { return std::distance(m_Children.begin(), it); } } void QmitkLesionTreeItem::AddChild(ChildPointer child) { auto it = std::find(m_Children.begin(), m_Children.end(), child); if (it == m_Children.end()) { // child does not already exist; add to vector of children m_Children.push_back(child); // add parent item child->SetParent(this->shared_from_this()); } } void QmitkLesionTreeItem::RemoveChild(ChildPointer child) { auto it = std::find(m_Children.begin(), m_Children.end(), child); if (it != m_Children.end()) { m_Children.erase(it); } } void QmitkLesionTreeItem::SetData(const mitk::LesionData& lesionData) { m_ItemData = lesionData; }