Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkCheckboxesQuestion.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 mitkCheckboxesQuestion_h
14 #define mitkCheckboxesQuestion_h
15 
17 
18 namespace mitk::Forms
19 {
28  {
29  public:
30  ~CheckboxesQuestion() override;
31 
32  std::string GetType() const override;
33  Question* CreateAnother() const override;
34 
35  void FromJSON(const nlohmann::ordered_json& j) override;
36  void ToJSON(nlohmann::ordered_json& j) const override;
37 
40 
43  };
44 
45  MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json& j, CheckboxesQuestion& q);
46  MITKFORMS_EXPORT void to_json(nlohmann::ordered_json& j, const CheckboxesQuestion& q);
47 }
48 
49 #endif
#define MITKFORMS_EXPORT
A Question whose possible responses are represented by checkboxes.
std::string GetType() const override
Return the type of a question as string, e.g. "Multiple choice" or "Drop-down".
void FromJSON(const nlohmann::ordered_json &j) override
Deserialize from JSON.
Question * CreateAnother() const override
Create a new instance of the derived question class type.
void ToJSON(nlohmann::ordered_json &j) const override
Serialize to JSON.
void AddResponse(size_t i)
Add one of the possible answer options to the responses.
void RemoveResponse(size_t i)
Remove one of the already given responses.
Base class for questions with options that may also have a free text option.
void RemoveOtherResponse()
Remove the "Other" response from the list of already given responses.
void AddOtherResponse(const std::string &response)
Add the free text given as "Other" option to the list of responses.
Abstract base class for all types of questions used in a Form.
Definition: mitkQuestion.h:32
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)