Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkLinearScaleQuestion.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 mitkLinearScaleQuestion_h
14 #define mitkLinearScaleQuestion_h
15 
16 #include <mitkQuestion.h>
17 #include <optional>
18 #include <utility>
19 
20 namespace mitk::Forms
21 {
29  {
30  public:
32  ~LinearScaleQuestion() override;
33 
34  std::string GetType() const override;
35  Question* CreateAnother() const override;
36 
37  void FromJSON(const nlohmann::ordered_json& j) override;
38  void ToJSON(nlohmann::ordered_json& j) const override;
39 
40  std::vector<std::string> GetResponsesAsStrings() const override;
41  void ClearResponses() override;
42 
43  bool IsComplete() const override;
44 
45  std::optional<int> GetResponse() const;
46  void SetResponse(int response);
47 
48  std::pair<int, int> GetRange() const;
49 
57  void SetRange(const std::pair<int, int>& range);
58 
59  std::pair<std::string, std::string> GetRangeLabels() const;
60  void SetRangeLabels(const std::pair<std::string, std::string>& labels);
61 
62  private:
63  std::optional<int> m_Response;
64  std::pair<int, int> m_Range;
65  std::pair<std::string, std::string> m_Labels;
66  };
67 
68  MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json& j, LinearScaleQuestion& q);
69  MITKFORMS_EXPORT void to_json(nlohmann::ordered_json& j, const LinearScaleQuestion& q);
70 }
71 
72 #endif
mitkQuestion.h
mitk::FromJSON
MITKCORE_EXPORT void FromJSON(const nlohmann::json &j, AffineTransform3D::Pointer transform)
Read transform from JSON array (16 elements, resp. 4x4 matrix).
mitk::Forms::to_json
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
mitk::Forms
Definition: mitkCheckboxesQuestion.h:18
mitk::Forms::LinearScaleQuestion
A Question whose possible responses are represented by a discrete linear scale.
Definition: mitkLinearScaleQuestion.h:28
mitk::Forms::from_json
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
mitk::ToJSON
MITKCORE_EXPORT void ToJSON(nlohmann::json &j, AffineTransform3D::ConstPointer transform)
Write transform (4x4 matrix) as JSON array with 16 elements.
mitk::Forms::Question
Abstract base class for all types of questions used in a Form.
Definition: mitkQuestion.h:31
MITKFORMS_EXPORT
#define MITKFORMS_EXPORT
Definition: MitkFormsExports.h:15