prompter
prompter
¶
Interactive parameter prompting for missing metadata.
This module provides interactive prompting functionality for acquiring missing acquisition parameters from the user.
ParameterPrompter
¶
Interactive prompting for missing acquisition parameters.
This class provides a consistent interface for prompting users to provide missing parameters, with type validation and default value suggestions.
Examples:
>>> from osipy.common.types import Modality
>>> prompter = ParameterPrompter(Modality.ASL, interactive=True)
>>> value = prompter.prompt_for_value("post_labeling_delay")
Missing post_labeling_delay (Post-labeling delay in milliseconds)
Default: 1800.0
Enter value [1800.0]:
Initialize the prompter.
| PARAMETER | DESCRIPTION |
|---|---|
modality
|
Perfusion imaging modality (for default values).
TYPE:
|
interactive
|
Whether to prompt interactively. If False, returns defaults.
TYPE:
|
use_defaults
|
Whether to use default values when available.
TYPE:
|
prompt_for_value
¶
Prompt user for a missing parameter value.
| PARAMETER | DESCRIPTION |
|---|---|
param_name
|
Name of the parameter.
TYPE:
|
expected_type
|
Expected type of the value.
TYPE:
|
default
|
Default value to suggest. If None, uses modality default.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
User-provided value, default value, or None. |
prompt_for_missing
¶
Prompt for all missing parameters.
| PARAMETER | DESCRIPTION |
|---|---|
current_params
|
Current parameter values.
TYPE:
|
missing_params
|
List of missing parameter names.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Updated parameters with user-provided values. |