Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Forms::ScreenshotQuestion Class Reference

A Question whose responses are screenshot image files. More...

#include <mitkScreenshotQuestion.h>

Inheritance diagram for mitk::Forms::ScreenshotQuestion:
Collaboration diagram for mitk::Forms::ScreenshotQuestion:

Public Member Functions

 ~ScreenshotQuestion () override
 Virtual destructor. More...
 
std::string GetType () const override
 Return the type string "Screenshot". More...
 
Question * CreateAnother () const override
 Create a new default-constructed ScreenshotQuestion instance. More...
 
void FromJSON (const nlohmann::ordered_json &j) override
 Deserialize this ScreenshotQuestion from JSON. More...
 
void ToJSON (nlohmann::ordered_json &j) const override
 Serialize this ScreenshotQuestion to JSON. More...
 
std::vector< std::string > GetResponsesAsStrings () const override
 Return the screenshot file paths as strings. More...
 
void ClearResponses () override
 Clear all screenshot responses. More...
 
bool IsComplete () const override
 Check whether at least one screenshot has been taken. More...
 
bool HasFileResponses () const override
 Always returns true since responses are file paths. More...
 
std::vector< fs::path > SubmitFileResponses (const fs::path &basePath) const override
 Copy screenshot files to a "screenshots" subdirectory and return relative paths. More...
 
void AddScreenshot (const fs::path &path)
 Add a screenshot file path as a response. More...
 
void RemoveScreenshot (const fs::path &path)
 Remove a screenshot response and delete the file from disk. 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...
 

Detailed Description

A Question whose responses are screenshot image files.

Users can take screenshots of render windows as responses. The screenshots are stored as temporary PNG files. During submission, the files are copied to a "screenshots" subdirectory relative to the CSV output path.

See also
Question

Definition at line 31 of file mitkScreenshotQuestion.h.

Constructor & Destructor Documentation

◆ ~ScreenshotQuestion()

mitk::Forms::ScreenshotQuestion::~ScreenshotQuestion ( )
override

Virtual destructor.

Member Function Documentation

◆ AddScreenshot()

void mitk::Forms::ScreenshotQuestion::AddScreenshot ( const fs::path &  path)

Add a screenshot file path as a response.

The screenshot is only added if the file at the given path exists.

Parameters
[in]pathThe file path of the screenshot image.

◆ ClearResponses()

void mitk::Forms::ScreenshotQuestion::ClearResponses ( )
overridevirtual

Clear all screenshot responses.

Implements mitk::Forms::Question.

◆ CreateAnother()

Question* mitk::Forms::ScreenshotQuestion::CreateAnother ( ) const
overridevirtual

Create a new default-constructed ScreenshotQuestion instance.

Returns
A pointer to a new ScreenshotQuestion. The caller takes ownership.

Implements mitk::Forms::Question.

◆ FromJSON()

void mitk::Forms::ScreenshotQuestion::FromJSON ( const nlohmann::ordered_json &  j)
overridevirtual

Deserialize this ScreenshotQuestion from JSON.

Parameters
[in]jThe JSON object to deserialize from.

Implements mitk::Forms::Question.

◆ GetResponsesAsStrings()

std::vector<std::string> mitk::Forms::ScreenshotQuestion::GetResponsesAsStrings ( ) const
overridevirtual

Return the screenshot file paths as strings.

Returns
A vector of file path strings for each screenshot.

Implements mitk::Forms::Question.

◆ GetType()

std::string mitk::Forms::ScreenshotQuestion::GetType ( ) const
overridevirtual

Return the type string "Screenshot".

Returns
The string "Screenshot".

Implements mitk::Forms::Question.

◆ HasFileResponses()

bool mitk::Forms::ScreenshotQuestion::HasFileResponses ( ) const
overridevirtual

Always returns true since responses are file paths.

Returns
true.

Reimplemented from mitk::Forms::Question.

◆ IsComplete()

bool mitk::Forms::ScreenshotQuestion::IsComplete ( ) const
overridevirtual

Check whether at least one screenshot has been taken.

Returns
true if at least one screenshot path is stored, false otherwise.

Implements mitk::Forms::Question.

◆ RemoveScreenshot()

void mitk::Forms::ScreenshotQuestion::RemoveScreenshot ( const fs::path &  path)

Remove a screenshot response and delete the file from disk.

If the path was among the stored responses and the file exists on disk, the file is deleted. Filesystem errors during deletion are silently ignored.

Parameters
[in]pathThe file path of the screenshot to remove.

◆ SubmitFileResponses()

std::vector<fs::path> mitk::Forms::ScreenshotQuestion::SubmitFileResponses ( const fs::path &  basePath) const
overridevirtual

Copy screenshot files to a "screenshots" subdirectory and return relative paths.

Creates a "screenshots" subdirectory under basePath if it does not exist, copies the screenshot files there, and returns paths relative to basePath.

Parameters
[in]basePathThe base directory for the submission output.
Returns
A vector of relative paths to the copied screenshot files, or an empty vector if no screenshots exist.

Reimplemented from mitk::Forms::Question.

◆ ToJSON()

void mitk::Forms::ScreenshotQuestion::ToJSON ( nlohmann::ordered_json &  j) const
overridevirtual

Serialize this ScreenshotQuestion to JSON.

Parameters
[out]jThe JSON object to serialize into.

Implements mitk::Forms::Question.


The documentation for this class was generated from the following file: