Tool Maker
- class qmenta.sdk.tool_maker.tool_maker.FilterFile(modality: Modality | List[Modality] = Modality.none, tags: List[Tag] | None = None, regex: str = '.*')
By specifying file filters, tools can provide usage information to the user regarding the expected type of file(s) that it needs to start the processing. This can include, for instance, the modality of the image or some required tags. File filters are also useful when we want the user to select different types of files within one input container.
- Parameters:
modality (Modality) – Modality of the sequence required by the tool. Check the qmenta.sdk.tool_maker.modalities.Modality list to check the possible values.
tags (list of Tag) – Tags of the sequence required by the tool. Example: Tag(“mask”), Tag(“labels”). It is equivalent to string.
regex (str) – Regular expression to identify by file name.
- class qmenta.sdk.tool_maker.tool_maker.InputFile(file_filter_condition_name: str, filter_file: ~qmenta.sdk.tool_maker.tool_maker.FilterFile | ~typing.List[~qmenta.sdk.tool_maker.tool_maker.FilterFile] = <qmenta.sdk.tool_maker.tool_maker.FilterFile object>, mandatory: int = 1, min_files: int = 1, max_files: int | str = '*')
Defines one or more input files required by the tool to run. Here is specified which conditions the file/s should adhere to in order to be selected to be processed. The filter defines the modality, tag and/or file name regular expression the desired file should have.
- Parameters:
file_filter_condition_name (str) – Is the ID that will be used to define the file filter condition and also used to get the file in the tool from the self.inputs.{container_id}.{file_filter_condition_name} dictionary
filter_file – Definition of the input requirement.
mandatory – Declares that the file must exist in the inputs when is set to 1. Optional when is set to 0.
min_files – Specify the minimum number of files that are accepted using this filter.
max_files – Specify the maximum number of files that are accepted using this filter.
- class qmenta.sdk.tool_maker.tool_maker.Tool(context: AnalysisContext | None = None, testing_tool=False)
Class which defines the tool and its components.
- Parameters:
context (AnalysisContext) – A QMENTA context instance
testing_tool (bool) – Flag activated when the tool is being run locally for testing.
- add_input_container(container_id: str, file_list: List[InputFile] | List[List[InputFile]], title: str = '', info: str = '', anchor: int = 1, batch: int = 1, mandatory: int = 1, tool_codes_set_as_input=None)
By default, the settings configuration of a tool includes a generic input container specification that allows any kind of data to be selected as the input for a tool. In this context, an input container is just a group of files in a specific structure. The most typical examples of input containers are a patient’s data for a single session or the result of an analysis.
For more information please visit: https://docs-dev.qmenta.com/sdk/guides_docs/settings.html#handling-the-input-files
- Parameters:
container_id (str) – A unique identifier for a session or input container.
file_list (list) – a list of objects InputFile
title (str) – Title displayed in the platform for the input.
info (str) – Information text displayed in the platform for the input.
anchor (int) –
batch (int) – allows the tool can to be launched in parallel for multiple sessions or analysis results. That is, perform a batch execution.
mandatory (int, 0 or 1) – indicates whether the user must provide data for this input container.
tool_codes_set_as_input (list or None) – List[String] a list of tools identifiers to use their results as input data (e.g. qmenta_acpc_alignment).
- add_input_single_choice(id_: str, options: List[Tuple[object, str]], default: object, title: str = '')
Dropdown menu https://docs.qmenta.com/sdk/guides_docs/settings.html#single-choice-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
options (list) – The format must be the following: [(“a”, “Option A”), (“b”, “Option B”), (“c”, “Option C”)] Each element is a two-element tuple where the first element is the value id and the second is the value representation. The first element is the value returned to the tool and the second is the one displayed in the platform
default (str) – Must be a value id from the options defined. Is going to be the one selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
- add_input_multiple_choice(id_: str, options: List[Tuple[object, str]], default: List[str], title: str = '')
https://docs.qmenta.com/sdk/guides_docs/settings.html#multiple-choice-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
options (list) – The format must be the following: [(“a”, “Option A”), (“b”, “Option B”), (“c”, “Option C”)] Each element is a two-element tuple where the first element is the value id and the second is the value representation. The first element is the value returned to the tool and the second is the one displayed in the platform
default (list) – Must be a list of the value ids defined in the options. Is going to be the ones selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
- add_input_checkbox(id_: str, default: int, title: str = '')
https://docs.qmenta.com/sdk/guides_docs/settings.html#checkbox-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
default (0 or 1) – Is going to be the value selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
- add_input_string(id_: str, default: str, title: str = '')
https://docs.qmenta.com/sdk/guides_docs/settings.html#string-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
default (str) – Is going to be the value selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
- add_input_decimal(id_: str, default: Number, title: str = '', minimum=-1000000000.0, maximum=1000000000.0)
https://docs.qmenta.com/sdk/guides_docs/settings.html#decimal-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
default (float) – Is going to be the value selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
minimum (float) – Smallest value that can be stored in this parameter
maximum (float) – Highest value that can be stored in this parameter
- add_input_integer(id_: str, default: Number, title: str = '', minimum=0, maximum=1000000000.0)
https://docs.qmenta.com/sdk/guides_docs/settings.html#integer-parameter
- Parameters:
id (str) – Identifier of the parameter, should be unique in the settings for the tool
default (int) – Is going to be the value selected by default when opening the tool in the platform.
title (str) – text shown besides the parameter to shortly describe the parameter function
minimum (float) – Smallest value that can be stored in this parameter
maximum (float) – Highest value that can be stored in this parameter
- add_line()
Learn more: https://docs-dev.qmenta.com/sdk/guides_docs/settings.html#line
Adds a horizontal line to divide settings’ sections.
- add_heading(content: str)
Learn more: https://docs-dev.qmenta.com/sdk/guides_docs/settings.html#heading-text
- Parameters:
content (str) – Message to be shown in the header as a text in the platform
- add_info(content: str)
Learn more: https://docs-dev.qmenta.com/sdk/guides_docs/settings.html#info-text
- Parameters:
content (str) – Message to be shown as an information box in the platform
- add_indent(content: str)
Learn more: https://docs-dev.qmenta.com/sdk/guides_docs/settings.html#indented-text
- Parameters:
content (str) – Message to be shown in the as an indented text in the platform