27 m_StatisticsCalculator = std::make_unique<QmitkStatisticsCalculator>();
35 if (!hasIndex(row, column, itemIndex))
40 auto childItem = GetItemByIndex(itemIndex)->
GetChildInRow(row);
41 if (
nullptr == childItem)
46 return createIndex(row, column, childItem.get());
51 if (!itemIndex.isValid())
56 auto parentItemWeakPtr = GetItemByIndex(itemIndex)->
GetParent();
57 if (parentItemWeakPtr.expired())
62 auto parentItem = parentItemWeakPtr.lock();
63 if (parentItem == m_RootItem)
68 return createIndex(parentItem->GetRow(), 0, parentItem.get());
73 return GetItemByIndex(itemIndex)->
ChildCount();
78 if (0 == m_RootItem->ChildCount())
84 return m_ControlPoints.size() + 1;
94 if (index.column() < 0 || index.column() >
static_cast<int>(m_ControlPoints.size()))
100 if (Qt::DisplayRole == role)
107 auto parentItem = currentItem->
GetParent().lock();
109 if (m_RootItem == parentItem)
112 if (0 == index.column())
115 if (itemString.empty())
119 return QString::fromStdString(itemString);
126 if (0 == index.column())
128 if (index.row() <
static_cast<int>(m_InformationTypes.size()))
130 return QString::fromStdString(m_InformationTypes.at(index.row()));
138 if ((index.column() - 1) * index.row() <
static_cast<int>(lesionVolume.size()))
140 return QVariant(lesionVolume.at(index.row()*m_ControlPoints.size() + (index.column() - 1)));
152 if (0 == m_RootItem->ChildCount())
158 if (Qt::Horizontal == orientation && Qt::DisplayRole == role)
162 return QVariant(
"Lesion");
165 if (static_cast<int>(m_ControlPoints.size()) >= section)
168 return QVariant(QString::fromStdString(currentControlPoint.
ToString()));
181 m_StatisticsCalculator->SetDataStorage(dataStorage);
188 emit beginResetModel();
190 emit endResetModel();
195 emit beginResetModel();
197 emit endResetModel();
202 emit beginResetModel();
204 emit endResetModel();
214 std::sort(m_ControlPoints.begin(), m_ControlPoints.end());
222 void QmitkStatisticsTreeModel::SetLesionData()
225 for (
auto& lesion : m_CurrentLesions)
242 m_StatisticsCalculator->ComputeLesionVolume(lesionData,
m_CaseID);
245 std::shared_ptr<QmitkLesionTreeItem> newLesionTreeItem = std::make_shared<QmitkLesionTreeItem>(lesionData);
246 m_RootItem->AddChild(newLesionTreeItem);
248 for (
size_t i = 0; i < m_InformationTypes.size(); ++i)
250 std::shared_ptr<QmitkLesionTreeItem> volumeItem = std::make_shared<QmitkLesionTreeItem>(lesionData);
251 newLesionTreeItem->AddChild(volumeItem);
266 return m_RootItem.get();
int columnCount(const QModelIndex &itemIndex=QModelIndex()) const override
QModelIndex parent(const QModelIndex &itemIndex) const override
itk::SmartPointer< T > Lock() const
void NodeChanged(const mitk::DataNode *) override
void SetData() override
Overridden from 'QmitkAbstractSemanticRelationsStorageModel': This function retrieves all control poi...
std::string GetLesionName() const
mitk::LesionData & GetData()
Return the item data, which contains ...
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
DataCollection - Class to facilitate loading/accessing structured data.
QmitkStatisticsTreeModel(QObject *parent=nullptr)
Initialize the root item of the model. The root item does not have a parent item. ...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationTypeVector GetAllInformationTypesOfCase(const SemanticTypes::CaseID &caseID)
void DataStorageChanged() override
Create a new 'SemanticRelationsDataStorageAccess' instance with the new data storage and update the m...
std::unique_ptr< mitk::SemanticRelationsDataStorageAccess > m_SemanticRelationsDataStorageAccess
ChildPointer GetChildInRow(int row) const
Return the child of this item at a specific position.
int rowCount(const QModelIndex &itemIndex=QModelIndex()) const override
ParentPointer GetParent() const
Return the parent item.
bool IsExpired() const noexcept
This class holds the data of each lesion in the lesion tree view. The data is the lesion itself with ...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfCase(const SemanticTypes::CaseID &caseID)
const std::vector< double > & GetLesionVolume() const
SemanticTypes::ID GetLesionUID() const
std::string ToString() const
QModelIndex index(int row, int column, const QModelIndex &itemIndex=QModelIndex()) const override
void NodeAdded(const mitk::DataNode *) override
vcl_size_t ChildCount() const
Return the number of child items.
mitk::SemanticTypes::CaseID m_CaseID
void NodeRemoved(const mitk::DataNode *) override
Class for nodes of the DataTree.
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfCase(const SemanticTypes::CaseID &caseID)