Medical Imaging Interaction Toolkit
2025.12.02
Medical Imaging Interaction Toolkit
mitkQuestion.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 mitkQuestion_h
14
#define mitkQuestion_h
15
16
#include <
mitkFileSystem.h
>
17
#include <
MitkFormsExports.h
>
18
19
#include <string>
20
#include <vector>
21
22
#include <nlohmann/json_fwd.hpp>
23
24
namespace
mitk::Forms
25
{
31
class
MITKFORMS_EXPORT
Question
32
{
33
public
:
34
Question
();
35
virtual
~Question
();
36
39
std::string
GetQuestionText
()
const
;
40
43
void
SetQuestionText
(
const
std::string& question);
44
47
bool
IsRequired
()
const
;
48
53
void
SetRequired
(
bool
required =
true
);
54
63
virtual
std::string
GetRequiredText
()
const
;
64
72
virtual
bool
HasFileResponses
()
const
;
73
83
virtual
std::vector<fs::path>
SubmitFileResponses
(
const
fs::path& basePath)
const
;
84
117
virtual
std::string
GetType
()
const
= 0;
118
133
virtual
Question
*
CreateAnother
()
const
= 0;
134
150
virtual
std::vector<std::string>
GetResponsesAsStrings
()
const
= 0;
151
154
virtual
void
ClearResponses
() = 0;
155
161
virtual
bool
IsComplete
()
const
= 0;
162
181
virtual
void
FromJSON
(
const
nlohmann::ordered_json& j) = 0;
182
201
virtual
void
ToJSON
(nlohmann::ordered_json& j)
const
= 0;
202
205
private
:
206
std::string m_QuestionText;
207
bool
m_IsRequired;
208
};
209
232
MITKFORMS_EXPORT
void
from_json
(
const
nlohmann::ordered_json& j,
Question
& q);
233
256
MITKFORMS_EXPORT
void
to_json
(nlohmann::ordered_json& j,
const
Question
& q);
257
}
258
259
#endif
MitkFormsExports.h
MITKFORMS_EXPORT
#define MITKFORMS_EXPORT
Definition:
MitkFormsExports.h:15
mitk::Forms::Question
Abstract base class for all types of questions used in a Form.
Definition:
mitkQuestion.h:32
mitk::Forms::Question::ClearResponses
virtual void ClearResponses()=0
Clear the/all response(s).
mitk::Forms::Question::HasFileResponses
virtual bool HasFileResponses() const
Query whether the responses given to this question are file paths.
mitk::Forms::Question::CreateAnother
virtual Question * CreateAnother() const =0
Create a new instance of the derived question class type.
mitk::Forms::Question::~Question
virtual ~Question()
mitk::Forms::Question::FromJSON
virtual void FromJSON(const nlohmann::ordered_json &j)=0
Deserialize from JSON.
mitk::Forms::Question::GetRequiredText
virtual std::string GetRequiredText() const
Get the text that should be displayed to clearly mark a question as required.
mitk::Forms::Question::IsRequired
bool IsRequired() const
Check whether a response to this question is required to complete a form.
mitk::Forms::Question::Question
Question()
mitk::Forms::Question::IsComplete
virtual bool IsComplete() const =0
Check if a question is considered to be answered completely.
mitk::Forms::Question::GetResponsesAsStrings
virtual std::vector< std::string > GetResponsesAsStrings() const =0
Return the question's response(s) as strings.
mitk::Forms::Question::ToJSON
virtual void ToJSON(nlohmann::ordered_json &j) const =0
Serialize to JSON.
mitk::Forms::Question::SetQuestionText
void SetQuestionText(const std::string &question)
Set the literal question.
mitk::Forms::Question::GetType
virtual std::string GetType() const =0
Return the type of a question as string, e.g. "Multiple choice" or "Drop-down".
mitk::Forms::Question::SetRequired
void SetRequired(bool required=true)
Set whether a resonse to this question is required to complete a form.
mitk::Forms::Question::GetQuestionText
std::string GetQuestionText() const
Get the literal question.
mitk::Forms::Question::SubmitFileResponses
virtual std::vector< fs::path > SubmitFileResponses(const fs::path &basePath) const
Attach response files to submission.
mitkFileSystem.h
mitk::Forms
Definition:
mitkCheckboxesQuestion.h:19
mitk::Forms::to_json
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
mitk::Forms::from_json
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
src
MITK
Modules
Forms
include
mitkQuestion.h
Generated on Mon Feb 23 2026 23:28:11 for Medical Imaging Interaction Toolkit by
1.9.1