Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkStatisticsModelToStringConverter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef QmitkStatisticsModelToStringConverter_h
13 #define QmitkStatisticsModelToStringConverter_h
14 
17 
32 {
33 public:
36 
42 
47  void SetRootIndex(QModelIndex rootIndex);
48 
54  QString GetString() const;
55 
60  void SetRowDelimiter(QChar rowDelimiter);
61 
66  void SetColumnDelimiter(QChar columnDelimiter);
67 
72  void SetIncludeHeaderData(bool includeHeaderData);
73 
74 private:
75 
76  QString Iterate(const QModelIndex &index,
77  const QmitkImageStatisticsTreeModel *model,
78  QString label = "") const;
79 
80  QmitkImageStatisticsTreeModel *m_statisticsModel = nullptr;
81  QModelIndex m_rootIndex;
82 
83  QChar m_rowDelimiter = '\n';
84  QChar m_columnDelimiter = ',';
85 
86  bool m_includeHeaderData = false;
87 
88 };
89 
90 #endif
#define MITKIMAGESTATISTICSUI_EXPORT
Tree model that represents mitk::ImageStatisticsContainer data in the Qt model/view framework.
Converts the content of a QmitkImageStatisticsTreeModel to a delimited string.
QString GetString() const
Converts the model content to a formatted string.
void SetIncludeHeaderData(bool includeHeaderData)
Sets whether column header data should be included in the output.
void SetRootIndex(QModelIndex rootIndex)
Sets the root index from which to start the iteration.
void SetColumnDelimiter(QChar columnDelimiter)
Sets the delimiter used to separate columns.
QmitkStatisticsModelToStringConverter()
Default constructor. Initializes delimiters to newline and comma.
void SetRowDelimiter(QChar rowDelimiter)
Sets the delimiter used to separate rows.
void SetModel(QmitkImageStatisticsTreeModel *model)
Sets the statistics tree model to convert.