Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkScreenshotQuestion.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 mitkScreenshotQuestion_h
14 #define mitkScreenshotQuestion_h
15 
16 #include <mitkQuestion.h>
17 #include <mitkFileSystem.h>
18 
19 #include <set>
20 
21 namespace mitk::Forms
22 {
32  {
33  public:
36  ~ScreenshotQuestion() override;
37 
42  std::string GetType() const override;
43 
48  Question* CreateAnother() const override;
49 
54  void FromJSON(const nlohmann::ordered_json& j) override;
55 
60  void ToJSON(nlohmann::ordered_json& j) const override;
61 
66  std::vector<std::string> GetResponsesAsStrings() const override;
67 
70  void ClearResponses() override;
71 
76  bool IsComplete() const override;
77 
82  bool HasFileResponses() const override;
83 
93  std::vector<fs::path> SubmitFileResponses(const fs::path& basePath) const override;
94 
101  void AddScreenshot(const fs::path& path);
102 
110  void RemoveScreenshot(const fs::path& path);
111 
112  private:
113  std::set<fs::path> m_Responses;
114  };
115 
123  MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json& j, ScreenshotQuestion& q);
124 
132  MITKFORMS_EXPORT void to_json(nlohmann::ordered_json& j, const ScreenshotQuestion& q);
133 }
134 
135 #endif
#define MITKFORMS_EXPORT
Abstract base class for all types of questions used in a Form.
Definition: mitkQuestion.h:38
A Question whose responses are screenshot image files.
void ToJSON(nlohmann::ordered_json &j) const override
Serialize this ScreenshotQuestion to JSON.
Question * CreateAnother() const override
Create a new default-constructed ScreenshotQuestion instance.
void ClearResponses() override
Clear all screenshot responses.
void RemoveScreenshot(const fs::path &path)
Remove a screenshot response and delete the file from disk.
bool IsComplete() const override
Check whether at least one screenshot has been taken.
std::vector< fs::path > SubmitFileResponses(const fs::path &basePath) const override
Copy screenshot files to a "screenshots" subdirectory and return relative paths.
~ScreenshotQuestion() override
Virtual destructor.
void FromJSON(const nlohmann::ordered_json &j) override
Deserialize this ScreenshotQuestion from JSON.
std::string GetType() const override
Return the type string "Screenshot".
std::vector< std::string > GetResponsesAsStrings() const override
Return the screenshot file paths as strings.
bool HasFileResponses() const override
Always returns true since responses are file paths.
void AddScreenshot(const fs::path &path)
Add a screenshot file path as a response.
Portability header that provides a unified namespace alias for the C++ filesystem library.
MITKFORMS_EXPORT void to_json(nlohmann::ordered_json &j, const CheckboxesQuestion &q)
Serialize a CheckboxesQuestion to JSON.
MITKFORMS_EXPORT void from_json(const nlohmann::ordered_json &j, CheckboxesQuestion &q)
Deserialize a CheckboxesQuestion from JSON.