Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkCLResultWriter.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 
13 #ifndef mitkCLResultWriter_h
14 #define mitkCLResultWriter_h
15 
16 #include <MitkCLUtilitiesExports.h>
17 
18 #include <sstream>
19 #include <fstream>
20 #include <vector>
21 
23 
24 namespace mitk
25 {
26  namespace cl
27  {
36  {
37  public:
43  FeatureResultWriter(std::string filePath, int mode);
44 
47 
52  void SetDecimalPoint(char decimal);
53 
58  void AddSubjectInformation(std::string value);
59 
64  void AddColumn(std::string value);
65 
70  void AddColumn(double value);
71 
76  void NewRow(std::string endName);
77 
86  void AddResult(std::string desc, int slice, mitk::AbstractGlobalImageFeature::FeatureListType stats, bool withHeader, bool withDescription);
87 
96  void AddHeader(std::string desc, int slice, mitk::AbstractGlobalImageFeature::FeatureListType stats, bool withHeader, bool withDescription);
97 
98  private:
99  int m_Mode;
100  std::size_t m_CurrentRow;
101  int m_CurrentElement;
102  std::string m_Separator;
103  std::ofstream m_Output;
104  std::vector<std::string> m_List;
105  std::string m_SubjectInformation;
106  bool m_UsedSubjectInformation;
107  bool m_UseSpecialDecimalPoint;
108  char m_DecimalPoint;
109  };
110  }
111 }
112 
113 #endif
#define MITKCLUTILITIES_EXPORT
std::vector< std::pair< FeatureID, double > > FeatureListType
Writes classification feature results to a CSV-style output file.
void NewRow(std::string endName)
Finalize the current row and start a new one.
void AddColumn(std::string value)
Add a string column value to the current row.
void SetDecimalPoint(char decimal)
Set a custom decimal point character for numeric output.
FeatureResultWriter(std::string filePath, int mode)
Construct a result writer for the given file path.
void AddResult(std::string desc, int slice, mitk::AbstractGlobalImageFeature::FeatureListType stats, bool withHeader, bool withDescription)
Add a row of feature results to the output.
void AddSubjectInformation(std::string value)
Add subject-identifying information to the current row.
void AddColumn(double value)
Add a numeric column value to the current row.
void AddHeader(std::string desc, int slice, mitk::AbstractGlobalImageFeature::FeatureListType stats, bool withHeader, bool withDescription)
Add a header row describing the feature columns.
~FeatureResultWriter()
Destructor. Flushes and closes the output file.
Find image slices visible on a given plane.