14 #ifndef QmitkImageStatisticsTreeModel_h
15 #define QmitkImageStatisticsTreeModel_h
65 void SetImageNodes(
const std::vector<mitk::DataNode::ConstPointer>& nodes);
75 void SetMaskNodes(
const std::vector<mitk::DataNode::ConstPointer>& nodes);
117 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
129 QVariant
data(
const QModelIndex &index,
int role)
const override;
142 QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const override;
149 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
156 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
165 QModelIndex
index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
172 QModelIndex
parent(
const QModelIndex &child)
const override;
208 void UpdateByDataStorage();
210 using StatisticsContainerVector = std::vector<mitk::ImageStatisticsContainer::ConstPointer>;
216 void BuildHierarchicalModel();
218 StatisticsContainerVector m_Statistics;
221 std::vector<mitk::DataNode::ConstPointer> m_ImageNodes;
227 std::vector<std::pair<mitk::DataNode::ConstPointer, unsigned int> > m_TimeStepResolvedImageNodes;
229 std::vector<mitk::DataNode::ConstPointer> m_MaskNodes;
231 std::vector<std::pair<mitk::DataNode::ConstPointer, unsigned int>> m_TimeStepResolvedMaskNodes;
232 std::vector<std::string> m_StatisticNames;
235 std::unique_ptr<QmitkImageStatisticsTreeItem> m_RootItem;
236 QVariant m_HeaderFirstColumn;
237 itk::TimeStamp m_BuildTime;
239 bool m_IgnoreZeroValueVoxel =
false;
240 unsigned int m_HistogramNBins = 100;
#define MITKIMAGESTATISTICSUI_EXPORT
Abstract base class extending QAbstractItemModel for DataStorage-backed models.
An item that represents an entry (usually an ImageStatisticsObject) for the QmitkImageStatisticsTreeM...
Tree model that represents mitk::ImageStatisticsContainer data in the Qt model/view framework.
~QmitkImageStatisticsTreeModel() override
Destructor. Disconnects from the data storage.
void Clear()
Clears all image nodes, mask nodes, statistics, and resets the model.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given model index.
void dataAvailable()
Emitted when new statistics data becomes available in the model.
QVariant data(const QModelIndex &index, int role) const override
Returns the data for the given index and role.
void NodeRemoved(const mitk::DataNode *node) override
void NodeAdded(const mitk::DataNode *node) override
void SetIgnoreZeroValueVoxel(bool _arg)
Sets whether zero-valued voxels should be ignored when selecting statistics.
QModelIndex parent(const QModelIndex &child) const override
Returns the parent model index of the given child.
unsigned int GetHistogramNBins() const
Returns the current number of histogram bins.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns (statistic names count + 1).
QmitkImageStatisticsTreeModel(QObject *parent=nullptr)
Constructs the tree model.
void SetMaskNodes(const std::vector< mitk::DataNode::ConstPointer > &nodes)
Sets the mask nodes whose statistics should be displayed.
bool GetIgnoreZeroValueVoxel() const
Returns whether zero-valued voxels are currently being ignored.
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Returns the header data for the given section and orientation.
void NodeChanged(const mitk::DataNode *node) override
void NodePredicateChanged() override
void SetImageNodes(const std::vector< mitk::DataNode::ConstPointer > &nodes)
Sets the image nodes whose statistics should be displayed.
void DataStorageChanged() override
void SetHistogramNBins(unsigned int nbins)
Sets the number of histogram bins used to select matching statistics.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of child rows under the given parent.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the model index for the specified row, column, and parent.
void modelChanged()
Emitted when the model rebuild is finished (usually shortly after dataAvailable()).
Central node class of the MITK data tree, associating a data object with properties and mappers.