|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
A Question whose possible responses are represented by a discrete linear scale. More...
#include <mitkLinearScaleQuestion.h>


Public Member Functions | |
| LinearScaleQuestion () | |
| Constructor. More... | |
| ~LinearScaleQuestion () override | |
| Virtual destructor. More... | |
| std::string | GetType () const override |
| Return the type string "Linear scale". More... | |
| Question * | CreateAnother () const override |
| Create a new default-constructed LinearScaleQuestion instance. More... | |
| void | FromJSON (const nlohmann::ordered_json &j) override |
| Deserialize this LinearScaleQuestion from JSON. More... | |
| void | ToJSON (nlohmann::ordered_json &j) const override |
| Serialize this LinearScaleQuestion to JSON. More... | |
| std::vector< std::string > | GetResponsesAsStrings () const override |
| Return the numeric response as a single-element vector of strings. More... | |
| void | ClearResponses () override |
| Clear the response. More... | |
| bool | IsComplete () const override |
| Check whether a response has been given. More... | |
| std::optional< int > | GetResponse () const |
| Get the current numeric response. More... | |
| void | SetResponse (int response) |
| Set the numeric response. More... | |
| std::pair< int, int > | GetRange () const |
| Get the allowed range. More... | |
| void | SetRange (const std::pair< int, int > &range) |
| Set the allowed range of numbers for a valid response. More... | |
| std::pair< std::string, std::string > | GetRangeLabels () const |
| Get the labels for the low and high ends of the scale. More... | |
| void | SetRangeLabels (const std::pair< std::string, std::string > &labels) |
| Set the labels for the low and high ends of the scale. More... | |
Public Member Functions inherited from mitk::Forms::Question | |
| Question () | |
| Default constructor. More... | |
| virtual | ~Question () |
| Virtual destructor. More... | |
| std::string | GetQuestionText () const |
| Get the literal question text. More... | |
| void | SetQuestionText (const std::string &question) |
| Set the literal question text. More... | |
| bool | IsRequired () const |
| Check whether a response to this question is required to complete a form. More... | |
| void | SetRequired (bool required=true) |
| Set whether a response to this question is required to complete a form. More... | |
| virtual std::string | GetRequiredText () const |
| Get the text that should be displayed to clearly mark a question as required. More... | |
| virtual bool | HasFileResponses () const |
| Query whether the responses given to this question are file paths. More... | |
| virtual std::vector< fs::path > | SubmitFileResponses (const fs::path &basePath) const |
| Attach response files to submission. More... | |
A Question whose possible responses are represented by a discrete linear scale.
The question can have a single response, which is one of the numbers within the allowed range. The range must start with 0 or 1 and end with any number between 2 and 10 (1 to 5 by default). Optional labels can be assigned to the low and high ends of the scale.
Definition at line 30 of file mitkLinearScaleQuestion.h.
| mitk::Forms::LinearScaleQuestion::LinearScaleQuestion | ( | ) |
Constructor.
Initializes the range to [1, 5] with no response and empty labels.
|
override |
Virtual destructor.
|
overridevirtual |
Clear the response.
Implements mitk::Forms::Question.
|
overridevirtual |
Create a new default-constructed LinearScaleQuestion instance.
Implements mitk::Forms::Question.
|
overridevirtual |
Deserialize this LinearScaleQuestion from JSON.
| [in] | j | The JSON object to deserialize from. |
Implements mitk::Forms::Question.
| std::pair<int, int> mitk::Forms::LinearScaleQuestion::GetRange | ( | ) | const |
Get the allowed range.
first is the lower bound and second is the upper bound. | std::pair<std::string, std::string> mitk::Forms::LinearScaleQuestion::GetRangeLabels | ( | ) | const |
Get the labels for the low and high ends of the scale.
first is the low-end label and second is the high-end label. | std::optional<int> mitk::Forms::LinearScaleQuestion::GetResponse | ( | ) | const |
Get the current numeric response.
std::nullopt if no response has been given.
|
overridevirtual |
Return the numeric response as a single-element vector of strings.
Implements mitk::Forms::Question.
|
overridevirtual |
Return the type string "Linear scale".
Implements mitk::Forms::Question.
|
overridevirtual |
Check whether a response has been given.
true if a response value is set, false otherwise. Implements mitk::Forms::Question.
| void mitk::Forms::LinearScaleQuestion::SetRange | ( | const std::pair< int, int > & | range | ) |
Set the allowed range of numbers for a valid response.
A valid range must start with 0 or 1 and end with any number between 2 and 10 (1 to 5 by default).
| [in] | range | A pair where first is the lower bound (0 or 1) and second is the upper bound (2 to 10). |
| mitk::Exception | If the range is invalid. |
| void mitk::Forms::LinearScaleQuestion::SetRangeLabels | ( | const std::pair< std::string, std::string > & | labels | ) |
Set the labels for the low and high ends of the scale.
| [in] | labels | A pair where first is the low-end label and second is the high-end label. |
| void mitk::Forms::LinearScaleQuestion::SetResponse | ( | int | response | ) |
Set the numeric response.
| [in] | response | The selected number on the scale. |
|
overridevirtual |
Serialize this LinearScaleQuestion to JSON.
| [out] | j | The JSON object to serialize into. |
Implements mitk::Forms::Question.