populse_mia.user_interface.pipeline_manager.pipeline_manager_tab¶
Module to define pipeline manager tab appearance, settings and methods.
- Contains:
- Class:
PipelineManagerTab
RunProgress
RunWorker
StatusWidget
- Function:
protected_logging
Functions
Context manager that preserves logging configuration across soma-workflow interference. |
Classes
|
Widget that handles the Pipeline Manager tab. |
|
A Qt widget for displaying and managing pipeline execution progress. |
|
Worker thread for executing a pipeline in the background. |
|
A widget that displays the current or last pipeline execution status |
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.Path(*args, **kwargs)[source]¶
Bases:
PurePathPurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
- stat(*, follow_symlinks=True)[source]¶
Return the result of the stat() system call on this path, like os.stat() does.
- lstat()[source]¶
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
- exists(*, follow_symlinks=True)[source]¶
Whether this path exists.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
- is_file()[source]¶
Whether this path is a regular file (also True for symlinks pointing to regular files).
- samefile(other_path)[source]¶
Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
- open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)[source]¶
Open the file pointed to by this path and return a file object, as the built-in open() function does.
- read_text(encoding=None, errors=None)[source]¶
Open the file in text mode, read it, and close the file.
- write_text(data, encoding=None, errors=None, newline=None)[source]¶
Open the file in text mode, write to it, and close the file.
- iterdir()[source]¶
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries ‘.’ and ‘..’ are not included.
- glob(pattern, *, case_sensitive=None)[source]¶
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- rglob(pattern, *, case_sensitive=None)[source]¶
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
- walk(top_down=True, on_error=None, follow_symlinks=False)[source]¶
Walk the directory tree from this directory, similar to os.walk().
- classmethod home()[source]¶
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
- absolute()[source]¶
Return an absolute version of this path by prepending the current working directory. No normalization or symlink resolution is performed.
Use resolve() to get the canonical path to a file.
- resolve(strict=False)[source]¶
Make the path absolute, resolving all symlinks on the way and also normalizing it.
- touch(mode=438, exist_ok=True)[source]¶
Create this file with the given access mode, if it doesn’t exist.
- lchmod(mode)[source]¶
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
- unlink(missing_ok=False)[source]¶
Remove this file or link. If the path is a directory, use rmdir() instead.
- rename(target)[source]¶
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- replace(target)[source]¶
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- symlink_to(target, target_is_directory=False)[source]¶
Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.List(trait=None, value=None, minlen=0, maxlen=9223372036854775807, items=True, **metadata)[source]¶
Bases:
TraitTypeA trait type for a list of values of the specified type.
The length of the list assigned to the trait must be such that:
minlen <= len(list) <= maxlen
Note that this trait type creates copies of values on assignment, rather than assigning the exact instance. For example, consider:
>>> class A(HasTraits): ... x = List() ... >>> b = [1, 2, 3] >>> a = A(x=b) >>> a.x [1, 2, 3] >>> b.append(4) >>> a.x [1, 2, 3]
- Parameters:
trait (a trait or value that can be converted using trait_from()) – The type of item that the list contains. If not specified, the list can contain items of any type.
value (list) – Default value for the list.
minlen (integer) – The minimum length of a list that can be assigned to the trait.
maxlen (integer) – The maximum length of a list that can be assigned to the trait.
items (bool) – Whether there is a corresponding <name>_items trait.
**metadata – Trait metadata for the trait.
- item_trait¶
The type of item that the list contains.
- Type:
trait
- minlen¶
The minimum length of a list that can be assigned to the trait.
- Type:
integer
- maxlen¶
The maximum length of a list that can be assigned to the trait.
- Type:
integer
- info_trait = None¶
- default_value_type = 5¶
- _items_event = <traits.ctrait.CTrait object>¶
- __init__(trait=None, value=None, minlen=0, maxlen=9223372036854775807, items=True, **metadata)[source]¶
TraitType initializer
This is the only method normally called directly by client code. It defines the trait. The default implementation accepts an optional, unvalidated default value, and caller-supplied trait metadata.
Override this method whenever a different method signature or a validated default value is needed.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.TraitListObject(*args, **kwargs)[source]¶
Bases:
TraitListA specialization of TraitList with a default validator and notifier which provide bug-for-bug compatibility with the TraitListObject from Traits versions before 6.0.
- Parameters:
trait (CTrait) – The trait that the list has been assigned to.
object (HasTraits) – The object the list belongs to.
name (str) – The name of the trait on the object.
value (iterable) – The initial value of the list.
- trait¶
The trait that the list has been assigned to.
- Type:
CTrait
- object¶
The object the list belongs to.
- Type:
HasTraits
- value¶
The initial value of the list.
- Type:
iterable
- notifier(trait_list, index, removed, added)[source]¶
Converts and consolidates the parameters to a TraitListEvent and then fires the event.
- append(object)[source]¶
Append object to the end of the list.
- Parameters:
object (any) – The object to append.
- extend(iterable)[source]¶
Extend list by appending elements from the iterable.
- Parameters:
iterable (iterable) – The elements to append.
- insert(index, object)[source]¶
Insert object before index.
- Parameters:
index (integer) – The position at which to insert.
object (object) – The object to insert.
- pop(index=-1)[source]¶
Remove and return item at index (default last).
- Parameters:
index (int, optional) – Index at which to remove item. If not given, the last item of the list is removed.
- Returns:
item – The removed item.
- Return type:
- Raises:
IndexError – If list is empty or index is out of range.
- remove(value)[source]¶
Remove first occurrence of value.
Notes
The value is not validated or converted before removal.
- Parameters:
value (object) – Value to be removed.
- Raises:
ValueError – If the value is not present.
- _validate_length(new_length)[source]¶
Validate the new length for a proposed operation.
- Parameters:
new_length (int) – New length of the list.
- Raises:
TraitError – If the proposed new length would violate the length constraints of the list.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.NipypeProcess(*args, **kwargs)[source]¶
Bases:
FileCopyProcessBase class used to wrap nipype interfaces.
Note
Type ‘NipypeProcess.help()’ for a full description of this process parameters.
Type ‘<NipypeProcess>.get_input_spec()’ for a full description of this process input trait types.
Type ‘<NipypeProcess>.get_output_spec()’ for a full description of this process output trait types.
- __init__(nipype_instance=None, use_temp_output_dir=None, *args, **kwargs)[source]¶
Initialize the NipypeProcess class.
NipypeProcess instance gets automatically an additional user trait ‘output_directory’.
This class also fix some lacks of the nipype version ‘0.10.0’.
NipypeProcess is normally not instantiated directly, but through the CapsulEngine factory, using a nipype interface name:
ce = capsul_engine() npproc = ce.get_process_instance('nipype.interfaces.spm.Smooth')
However, it is now still possible to instantiate it directly, using a nipype interface class or instance:
npproc = NipypeProcess(nipype.interfaces.spm.Smooth)
NipypeProcess may be subclassed for specialized interfaces. In such a case, the subclass may provide:
(optionally) a class attribute _nipype_class_type to specify the
nipype interface class. If present the nipype interface class or instance will not be specified in the constructor call. * (optionally) a
__postinit__()method which will be called in addition to the constructor, but later once the instance is correctly setup. This __postinit__ method allows to customize the new class instance. * (optionally) a class attribute _nipype_trait_mapping: a dict specifying a translation table between nipype traits names and the names they will get in the Process instance. By default, inputs get the same name as in their nipype interface, and outputs are prefixed with an underscore (‘_’) to avoid names collisions when a trait exists both in inputs and outputs in nipype. A special trait name _spm_script_file is also used in SPM interfaces to write the matlab script. It can also be translated to a different name in this dict.Subclasses should preferably not define an __init__ method, because it may be called twice if no precaution is taken to avoid it (a __np_init_done__ instance attribute is set once init is done the first time).
Ex:
class Smooth(NipypeProcess): _nipype_class_type = spm.Smooth _nipype_trait_mapping = { 'smoothed_files': 'smoothed_files', '_spm_script_file': 'spm_script_file'} smooth = Smooth()
- Parameters:
nipype_instance (nipype interface (mandatory, except from internals)) – the nipype interface we want to wrap in capsul.
use_temp_output_dir (bool or None) – use a temp working directory during processing
- _nipype_interface¶
private attribute to store the nipye interface
- Type:
Interface
- requirements()[source]¶
Requirements needed to run the process. It is a dictionary which keys are config/settings modules and values are requests for them.
The default implementation returns an empty dict (no requirements), and should be overloaded by processes which actually have requirements.
Ex:
{'spm': 'version >= "12" and standalone == "True"')
- set_output_directory(out_dir)[source]¶
Set the process output directory.
- Parameters:
out_dir (str (mandatory)) – the output directory
- set_usedefault(parameter, value)[source]¶
Set the value of the usedefault attribute on a given parameter.
- _run_process()[source]¶
Method that do the processing when the instance is called.
- Returns:
runtime – object containing the running results
- Return type:
InterfaceResult
- _after_run_process(run_process_result)[source]¶
Method to clean-up temporary workspace after process execution.
- classmethod help(nipype_interface, returnhelp=False)[source]¶
Method to print the full wrapped nipype interface help.
- Parameters:
cls (process class (mandatory)) – a nipype process class
nipype_instance (nipype interface (mandatory)) – a nipype interface object that will be documented.
returnhelp (bool (optional, default False)) – if True return the help string message, otherwise display it on the console.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.Pipeline(autoexport_nodes_parameters=None, **kwargs)[source]¶
Bases:
ProcessPipeline containing Process nodes, and links between node parameters.
A Pipeline is normally subclassed, and its
pipeline_definition()method is overloaded to define its nodes and links.pipeline_definition()will be called by the pipeline constructor.from capsul.pipeline import Pipeline class MyPipeline(Pipeline): def pipeline_definition(self): self.add_process('proc1', 'my_toolbox.my_process1') self.add_process('proc2', 'my_toolbox.my_process2') self.add_switch('main_switch', ['in1', 'in2'], ['out1', 'out2']) self.add_link('proc1.out1->main_switch.in1_switch_out1') self.add_link('proc1.out2->main_switch.in1_switch_out2') self.add_link('proc2.out1->main_switch.in2_switch_out1') self.add_link('proc2.out1->main_switch.in2_switch_out2')
After execution of
pipeline_definition(), the inner nodes parameters which are not connected will be automatically exported to the parent pipeline, with names prefixed with their process name, unless they are listed in a special “do_not_export” list (passed toadd_process()or stored in the pipeline instance).>>> pipeline = MyPipeline() >>> print(pipeline.proc1_input) <undefined>
Nodes
A pipeline is made of nodes, and links between their parameters. Several types of nodes may be part of a pipeline:
process nodes (
pipeline_nodes.ProcessNode) are the leaf nodes which represent actual processing bricks.pipeline nodes (
pipeline_nodes.PipelineNode) are sub-pipelines which allow to reuse an existing pipeline within another oneswitch nodes (
pipeline_nodes.Switch) allows to select values between several possible inputs. The switch mechanism also allows to select between several alternative processes or processing branches.iterative process (:py:class:process_iteration.ProcessIteration`) represent parallel processing of the same pipeline on a set of parameters.
Note that you normally do not instantiate these nodes explicitly when building a pipeline. Rather programmers may call the
add_process(),add_switch(),add_iterative_process()methods.Nodes activation
Pipeline nodes may be enabled or disabled. Disabling a node will trigger a global pipeline nodes activation step, where all nodes which do not form a complete chain will be inactive. This way a branch may be disabled by disabling one of its nodes. This process is used by the switch system, which allows to select one processing branch between several, and disables the unselected ones.
Pipeline steps
Pipelines may define execution steps: they are user-oriented groups of nodes that are to be run together, or disabled together for runtime execution. They are intended to allow partial, or step-by-step execution. They do not work like the nodes enabling mechanism described above.
Steps may be defined within the
pipeline_definition()method. Seeadd_pipeline_step().Note also that pipeline steps only act at the highest level: if a sub-pipeline has disabled steps, they will not be taken into account in the higher level pipeline execution, because executing by steps a part of a sub-pipeline within the context of a higher one does generally not make sense.
Main methods
pipeline_definition()add_process()add_switch()add_custom_node()add_iterative_process()add_optional_output_switch()add_processes_selection()add_link()remove_link()export_parameter()autoexport_nodes_parameters()add_pipeline_step()define_pipeline_steps()define_groups_as_steps()remove_pipeline_step()enable_all_pipeline_steps()disabled_pipeline_steps_nodes()get_pipeline_step_nodes()find_empty_parameters()count_items()
- nodes¶
a dictionary containing the pipeline nodes and where the pipeline node name is ‘’
- Type:
dict {node_name: node}
Note
Type ‘Pipeline.help()’ for a full description of this process parameters.
Type ‘<Pipeline>.get_input_spec()’ for a full description of this process input trait types.
Type ‘<Pipeline>.get_output_spec()’ for a full description of this process output trait types.
- _doc_path = 'api/pipeline.html#pipeline'¶
- do_autoexport_nodes_parameters = True¶
- hide_nodes_activation = True¶
- __init__(autoexport_nodes_parameters=None, **kwargs)[source]¶
Initialize the Pipeline class
- Parameters:
autoexport_nodes_parameters (bool) – if True (default) nodes containing pipeline plugs are automatically exported.
- pipeline_definition()[source]¶
Define pipeline structure, nodes, sub-pipelines, switches, and links.
This method should be overloaded in subclasses, it does nothing in the base Pipeline class.
- autoexport_nodes_parameters(include_optional=False)[source]¶
Automatically export nodes plugs to the pipeline.
Some parameters can be explicitly preserved from exportation if they are listed in the pipeline “do_not_export” variable (list or set).
- Parameters:
include_optional (bool (optional)) – If True (the default), optional plugs are not exported Exception: optional output plugs of switches are exported (otherwise they are useless). It should probably be any single output plug of a node.
- add_trait(name, trait)[source]¶
Add a trait to the pipeline
- Parameters:
name (str (mandatory)) – the trait name
trait (trait instance (mandatory)) – the trait we want to add
- remove_trait(name)[source]¶
Remove a trait to the pipeline
- Parameters:
name (str (mandatory)) – the trait name
- reorder_traits(names)[source]¶
Reimplementation of
Controllermethodreorder_traits()so that we also reorder the pipeline node plugs.
- add_process(name, process, do_not_export=None, make_optional=None, inputs_to_copy=None, inputs_to_clean=None, skip_invalid=False, **kwargs)[source]¶
Add a new node in the pipeline
Note about invalid nodes:
A pipeline can typically offer alternatives (through a switch) to different algorithmic nodes, which may have different dependencies, or may be provided through external modules, thus can be missing. To handle this, Capsul can be telled that a process node can be invalid (or missing) without otherwise interfering the rest of the pipeline. This is done using the “skip_invalid” option. When used, the process to be added is tested, and if its instantiation fails, it will not be added in the pipeline, but will not trigger an error. Instead the missing node will be marked as “allowed invalid”, and links and exports built using this node will silently do nothing. thus the pipeline will work normally, without the invalid node.
Such nodes are generally gathered through a switch mechanism. However the switch inputs should be restricted to actually available nodes. The recommended method is to check that nodes have actually been added in the pipeline. Then links can be made normally as if the nodes were all present:
self.add_process('method1', 'module1.Module1', skip_invalid=True) self.add_process('method2', 'module2.Module2', skip_invalid=True) self.add_process('method3', 'module3.Module3', skip_invalid=True) input_params = [n for n in ['method1', 'method2', 'method3'] if n in self.nodes] self.add_switch('select_method', input_params, 'output') self.add_link('method1.input->select_method.method1_switch_output') self.add_link('method2.input->select_method.method2_switch_output') self.add_link('method3.input->select_method.method3_switch_output')
A last note about invalid nodes:
When saving a pipeline (through the
graphical editortypically), missing nodes will not be saved because they are not actually in the pipeline. So be careful to save only pipelines with full features.- Parameters:
name (str (mandatory)) – the node name (has to be unique).
process (Process (mandatory)) – the process we want to add. May be a string (‘module.process’), a process instance or a class.
do_not_export (list of str (optional)) – a list of plug names that we do not want to export.
make_optional (list of str (optional)) – a list of plug names that we do not want to export.
inputs_to_copy (list of str (optional)) – a list of item to copy.
inputs_to_clean (list of str (optional)) – a list of temporary items.
skip_invalid (bool) – if True, if the process is failing (cannot be instantiated), don’t throw an exception but instead don’t insert the node, and mark it as such in order to make add_link() to also silently do nothing. This option is useful for optional process nodes which may or may not be available depending on their dependencies, typically in a switch offering several alternative methods.
- add_iterative_process(name, process, iterative_plugs=None, do_not_export=None, make_optional=None, inputs_to_copy=None, inputs_to_clean=None, **kwargs)[source]¶
Add a new iterative node in the pipeline.
- Parameters:
name (str (mandatory)) – the node name (has to be unique).
process (Process or str (mandatory)) – the process we want to add.
iterative_plugs (list of str (optional)) – a list of plug names on which we want to iterate. If None, all plugs of the process will be iterated.
do_not_export (list of str (optional)) – a list of plug names that we do not want to export.
make_optional (list of str (optional)) – a list of plug names that we do not want to export.
inputs_to_copy (list of str (optional)) – a list of item to copy.
inputs_to_clean (list of str (optional)) – a list of temporary items.
- call_process_method(process_name, method, *args, **kwargs)[source]¶
Call a method of a process previously added with add_process or add_iterative_process.
- add_switch(name, inputs, outputs, export_switch=True, make_optional=(), output_types=None, switch_value=None, opt_nodes=None)[source]¶
Add a switch node in the pipeline
- Parameters:
name (str (mandatory)) – name for the switch node (has to be unique)
inputs (list of str (mandatory)) – names for switch inputs. Switch activation will select amongst them. Inputs names will actually be a combination of input and output, in the shape “input_switch_output”. This behaviour is needed when there are several outputs, and thus several input groups.
export_switch (bool (optional)) – if True, export the switch trigger to the parent pipeline with
nameas parameter namemake_optional (sequence (optional)) – list of optional outputs. These outputs will be made optional in the switch output. By default they are mandatory.
output_types (sequence of traits (optional)) – If given, this sequence should have the same size as outputs. It will specify each switch output parameter type (as a standard trait). Input parameters for each input block will also have this type.
switch_value (str (optional)) – Initial value of the switch parameter (one of the inputs names). Defaults to 1st input.
opt_nodes (bool or list) – tells that switch values are node names, and some of them may be optional and missing. In such a case, missing nodes are not added as inputs. If a list is passed, then it is a list of node names which length should match the number of inputs, and which order tells nodes related to inputs (in case inputs names are not directly node names).
Examples
>>> pipeline.add_switch('group_switch', ['in1', 'in2'], ['out1', 'out2'])
will create a switch with 4 inputs and 2 outputs: inputs: “in1_switch_out1”, “in2_switch_out1”, “in1_switch_out2”, “in2_switch_out2” outputs: “out1”, “out2”
- add_optional_output_switch(name, input, output=None)[source]¶
Add an optional output switch node in the pipeline
An optional switch activates or disables its input/output link according to the output value. If the output value is not None or Undefined, the link is active, otherwise it is inactive.
This kind of switch is meant to make a pipeline output optional, but still available for temporary files values inside the pipeline.
Ex:
A.output -> B.input
B.input is mandatory, but we want to make A.output available and optional in the pipeline outputs. If we directlty export A.output, then if the pipeline does not set a value, B.input will be empty and the pipeline run will fail.
Instead we can add an OptionalOutputSwitch between A.output and pipeline.output. If pipeline.output is set a valid value, then A.output and B.input will have the same valid value. If pipeline.output is left Undefined, then A.output and B.input will get a temporary value during the run.
Add an optional output switch node in the pipeline
- Parameters:
name (str (mandatory)) – name for the switch node (has to be unique)
input (str (mandatory)) – name for switch input. Switch activation will select between it and a hidden input, “_none”. Inputs names will actually be a combination of input and output, in the shape “input_switch_output”.
output (str (optional)) – name for output. Default is the switch name
Examples
>>> pipeline.add_optional_output_switch('out1', 'in1') >>> pipeline.add_link('node1.output->out1.in1_switch_out1')
See also
capsul.pipeline.pipeline_nodes.OptionalOutputSwitch
- add_custom_node(name, node_type, parameters=None, make_optional=(), do_not_export=None, **kwargs)[source]¶
Inserts a custom node (Node subclass instance which is not a Process) in the pipeline.
- Parameters:
node_type (str or Node subclass or Node instance) – node type to be built. Either a class (Node subclass) or a Node instance (the node will be re-instantiated), or a string describing a module and class.
parameters (dict or Controller or None) – configuration dict or Controller defining parameters needed to build the node. The controller should be obtained using the node class’s configure_node() static method, then filled with the desired values. If not given the node is supposed to be built with no parameters, which will not work for every node type.
make_optional (list or tuple) – parameters names to be made optional
do_not_export (list of str (optional)) – a list of plug names that we do not want to export.
kwargs (default values of node parameters)
- parse_link(link, check=True)[source]¶
Parse a link coming from export_parameter method.
- Parameters:
- Returns:
output – tuple containing the link description and instances
- Return type:
Examples
>>> Pipeline.parse_link("node1.plug1->node2.plug2") "node1", "plug1", <instance node1>, <instance plug1>, "node2", "plug2", <instance node2>, <instance plug2>
For a pipeline node:
>>> Pipeline.parse_link("plug1->node2.plug2") "", "plug1", <instance pipeline>, <instance plug1>, "node2", "plug2", <instance node2>, <instance plug2>
- add_link(link, weak_link=False, allow_export=False, value=None)[source]¶
Add a link between pipeline nodes.
If the destination node is a switch, force the source plug to be not optional.
- Parameters:
link (str or list/tuple) – link description. Its shape should be: “node.output->other_node.input”. If no node is specified, the pipeline itself is assumed. Alternatively the link can be (source_node, source_plug_name, dest_node, dest_plug_name)
weak_link (bool) – this property is used when nodes are optional, the plug information may not be generated.
allow_export (bool) – if True, if the link links from/to the pipeline node with a plug name which doesn’t exist, the plug will be created, and the function will act exactly like export_parameter. This may be a more convenient way of exporting/connecting pipeline plugs to several nodes without having to export the first one, then link the others.
value (any) – if given, set this value instead of the source plug value
- remove_link(link)[source]¶
Remove a link between pipeline nodes
- Parameters:
link (str or list/tuple) – link description. Its shape should be: “node.output->other_node.input”. If no node is specified, the pipeline itself is assumed. Alternatively the link can be (source_node, source_plug_name, dest_node, dest_plug_name)
- export_parameter(node_name, plug_name, pipeline_parameter=None, weak_link=False, is_enabled=None, is_optional=None, allow_existing_plug=None)[source]¶
Export a node plug at the pipeline level.
- Parameters:
node_name (str (mandatory)) – the name of node containing the plug we want to export
plug_name (str (mandatory)) – the node plug name we want to export
pipeline_parameter (str (optional)) – the name to access this parameter at the pipeline level. Default None, the plug name is used
weak_link (bool (optional)) – this property is used when nodes are weak, FIXME: what does it exactly mean ? the plug information may not be generated.
is_enabled (bool (optional)) – a property to specify that it is not a user-parameter automatic generation)
is_optional (bool (optional)) – sets the exported parameter to be optional
allow_existing_plug (bool (optional)) – the same pipeline plug may be connected to several process plugs
- propagate_metadata(node, param, metadata)[source]¶
Set metadata on a node parameter, and propagate these values to the connected plugs.
Typically needed to propagate the “forbid_completion” metadata to avoid manuyally set values to be overridden by completion.
node may be a Node instance or a node name
- all_nodes()[source]¶
Iterate over all pipeline nodes including sub-pipeline nodes.
- Returns:
nodes – Iterates over all nodes
- Return type:
Generator of Node
- _check_local_node_activation(node)[source]¶
Try to activate a node and its plugs according to its state and the state of its direct neighbouring nodes.
- _check_local_node_deactivation(node)[source]¶
Check plugs that have to be deactivated according to node activation state and to the state of its direct neighbouring nodes.
- update_nodes_and_plugs_activation()[source]¶
Reset all nodes and plugs activations according to the current state of the pipeline (i.e. switch selection, nodes disabled, etc.). Activations are set according to the following rules.
- workflow_graph(remove_disabled_steps=True, remove_disabled_nodes=True)[source]¶
Generate a workflow graph
- Returns:
graph (topological_sort.Graph) – graph representation of the workflow from the current state of the pipeline
remove_disabled_steps (bool (optional)) – When set, disabled steps (and their children) will not be included in the workflow graph. Default: True
remove_disabled_nodes (bool (optional)) – When set, disabled nodes will not be included in the workflow graph. Default: True
- workflow_ordered_nodes(remove_disabled_steps=True)[source]¶
Generate a workflow: list of process node to execute
- Returns:
workflow_list (list of Process) – an ordered list of Processes to execute
remove_disabled_steps (bool (optional)) – When set, disabled steps (and their children) will not be included in the workflow graph. Default: True
- _check_temporary_files_for_node(node, temp_files)[source]¶
Check temporary outputs and allocate files for them.
Temporary files or directories will be appended to the temp_files list, and the node parameters will be set to temp file names.
This internal function is called by the sequential execution, _run_process() (also used through __call__()). The pipeline state will be restored at the end of execution using _free_temporary_files().
- _free_temporary_files(temp_files)[source]¶
Delete and reset temp files after the pipeline execution.
This internal function is called at the end of _run_process() (sequential execution)
- _run_process()[source]¶
Pipeline execution is managed by StudyConfig class. This method must not be called.
- find_empty_parameters()[source]¶
Find internal File/Directory parameters not exported to the main input/output parameters of the pipeline with empty values. This is meant to track parameters which should be associated with temporary files internally.
- Returns:
Each element is a list with 3 values: node, parameter_name, optional
- Return type:
- count_items()[source]¶
Count pipeline items to get its size.
- Returns:
items – (nodes_count, processes_count, plugs_count, params_count, links_count, enabled_nodes_count, enabled_procs_count, enabled_links_count)
- Return type:
- pipeline_state()[source]¶
Return an object composed of basic Python objects that contains the whole structure and state of the pipeline. This object can be given to compare_to_state method in order to get the differences with a previously stored state. This is typically used in tests scripts.
- Returns:
pipeline_state – todo
- Return type:
dictionary
- compare_to_state(pipeline_state)[source]¶
Returns the differences between this pipeline and a previously recorded state.
- Returns:
differences – each element is a human readable string explaining one difference (e.g. ‘node “my_process” is missing’)
- Return type:
- install_links_debug_handler(log_file=None, handler=None, prefix='')[source]¶
Set callbacks when traits value change, and follow plugs links to debug links propagation and problems in it.
- Parameters:
log_file (str (optional)) – file-like object to write links propagation in. If none is specified, a temporary file will be created for it.
handler (function (optional)) – Callback to be processed for debugging. If none is specified, the default pipeline debugging function will be used. This default handler prints traits changes and links to be processed in the log_file. The handler function will receive a prefix string, a node, and traits parameters, namely the object (process) owning the changed value, the trait name and value in this object.
prefix (str (optional)) – prefix to be prepended to traits names, typically the parent pipeline full name
- Returns:
log_file
- Return type:
the file object where events will be written in
- uninstall_links_debug_handler()[source]¶
Remove links debugging callbacks set by install_links_debug_handler
- define_pipeline_steps(steps)[source]¶
Define steps in the pipeline. Steps are pipeline portions that form groups, and which can be enabled or disabled on a runtime basis (when building workflows).
Once steps are defined, their activation may be accessed through the “step” trait, which has one boolean property for each step:
Ex:
steps = OrderedDict() steps['preprocessings'] = [ 'normalization', 'bias_correction', 'histo_analysis'] steps['brain_extraction'] = [ 'brain_segmentation', 'hemispheres_split'] pipeline.define_pipeline_steps(steps)
>>> print(pipeline.pipeline_steps.preprocessings) True
>>> pipeline.pipeline_steps.brain_extraction = False
See also add_pipeline_step()
- Parameters:
steps (dict or preferably OrderedDict or SortedDictionary (mandatory)) – The steps dict keys are steps names, the values are lists of nodes names forming the step.
- add_pipeline_step(step_name, nodes, enabled=True)[source]¶
Add a step definition to the pipeline (see also define_steps).
Steps are groups of pipeline nodes, which may be disabled at runtime. They are normally defined in a logical order regarding the workflow streams. They are different from pipelines in that steps are purely virtual groups, they do not have parameters.
Disabling a step acts differently as the pipeline node activation: other nodes are not inactivated according to their dependencies. Instead, those steps are not run.
- disabled_pipeline_steps_nodes()[source]¶
List nodes disabled for runtime execution
- Returns:
disabled_nodes – list of pipeline nodes (Node instances) which will not run in a workflow created from this pipeline state.
- Return type:
- enable_all_pipeline_steps()[source]¶
Set all defined steps (using add_step() or define_steps()) to be enabled. Useful to reset the pipeline state after it has been changed.
- add_processes_selection(selection_parameter, selection_groups, value=None)[source]¶
Add a processes selection switch definition to the pipeline.
Selectors are a “different” kind of switch: one pipeline node set in a group is enabled, the others are disabled.
The selector has 2 levels:
selection_parameter selects a group.
A group contains a set of nodes which will be activated together. Groups are mutually exclusive.
- Parameters:
selection_parameter (string (mandatory)) – name of the selector parameter: the parameter is added in the pipeline, and its value is the name of the selected group.
selection_groups (dict or OrderedDict) – nodes groups contained in the selector : {group_name: [Node names]}
value (str (optional)) – initial state of the selector (default: 1st group)
- get_processes_selections()[source]¶
Get process_selection groups names (corresponding to selection parameters on the pipeline)
- get_processes_selection_groups(selection_parameter)[source]¶
Get groups names involved in a processes selection switch
- get_processes_selection_nodes(selection_parameter, group)[source]¶
Get nodes names involved in a processes selection switch with value group
- set_study_config(study_config)[source]¶
Set a StudyConfig for the process. Note that it can only be done once: once a non-null StudyConfig has been assigned to the process, it should not change.
- define_groups_as_steps(exclusive=True)[source]¶
Define parameters groups according to which steps they are connected to.
- Parameters:
exclusive (bool (optional)) – if True, a parameter is assigned to a single group, the first step it is connected to. If False, a parameter is assigned all steps groups it is connected to.
- check_requirements(environment='global', message_list=None)[source]¶
Reimplementation for pipelines of
capsul.process.process.Process.check_requirementsA pipeline will return a list of unique configuration values.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.PipelineNode(pipeline, name, process, **kwargs)[source]¶
Bases:
ProcessNodeA special node to store the pipeline user-parameters
- get_connections_through(plug_name, single=False)[source]¶
If the node has internal links (inside a pipeline, or in a switch or other custom connection node), return the “other side” of the internal connection to the selected plug. The returned plug may be in an internal node (in a pipeline), or in an external node connected to the node. When the node is “opaque” (no internal connections), it returns the input plug. When the node is inactive / disabled, it returns [].
- Parameters:
- Returns:
[(node, plug_name, plug), …] Returns [(self, plug_name, plug)] when the plug has no internal connection.
- Return type:
connected_plug; list of tuples
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.Process(**kwargs)[source]¶
Bases:
ControllerA process is an atomic component that contains a processing.
A process is typically an object with typed parameters, and an execution function. Parameters are described using Enthought traits through Soma-Base Controller base class.
In addition to describing its parameters, a Process must implement its execution function, either through a python method, by overloading
_run_process(), or through a commandline execution, by overloadingget_commandline(). The second way allows to run on a remote processing machine which has not necessary capsul, nor python, installed.Parameters are declared or queried using the traits API, and their values are in the process instance variables:
from __future__ import print_function from capsul.api import Process import traits.api as traits class MyProcess(Process): # a class trait param1 = traits.Str('def_param1') def __init__(self): super(MyProcess, self).__init__() # declare an input param self.add_trait('param2', traits.Int()) # declare an output param self.add_trait('out_param', traits.File(output=True)) def _run_process(self): with open(self.out_param, 'w') as f: print('param1:', self.param1, file=f) print('param2:', self.param2, file=f) # run it with parameters MyProcess()(param2=12, out_param='/tmp/log.txt')
Note about the File and Directory traits
The
Filetrait type represents a file parameter. A file is actually two things: a filename (string), and the file itself (on the filesystem). For an input it is OK not to distinguish them, but for an output, there are two different cases:the file (on the filesystem) is an output, but the filename (string) is given as an input: this is the classical “commandline” behavior, when we tell the program where it should write its output file.
the file is an output, and the filename is also an output: this is rather a “function return value” behavior: the process determines internally where it should write the file, and tells as an output where it did.
To distinguish these two cases, in Capsul we normally add in the
FileorDirectorytrait a propertyinput_filenamewhich is True when the filename is an input, and False when the filename is an output:self.add_trait('out_file', traits.File(output=True, input_filename=False))
However, as most of our processes are based on the “commandline behavior” (the filename is an input) and we often forget to specify the
input_filenameparameter, the default is the “filename is an input” behavior, when not specified.Attributes
- log_file¶
if None, the log will be generated in the current directory otherwise it will be written in log_file path.
- Type:
str (default None)
Note
Type ‘Process.help()’ for a full description of this process parameters.
Type ‘<Process>.get_input_spec()’ for a full description of this process input trait types.
Type ‘<Process>.get_output_spec()’ for a full description of this process output trait types.
- add_trait(name, trait)[source]¶
Ensure that trait.output and trait.optional are set to a boolean value before calling parent class add_trait.
- _run_process()[source]¶
Runs the processings when the instance is called.
Either this _run_process() or
get_commandline()must be defined in derived classes.Note that _run_process() is called as a python function, on a Process instance. When using remote processing (cluster for instance), this means that the commandline which will run needs to be able to re- instantiate the same process: the process thus has to be stored in a file or python module which can be accessed from the remote machine, and python / capsul correctly installed and available on it.
get_commandline()at the contrary, can implement commandlines which are completely independent from Capsul, and from python.Note
If both methods are not defined in the derived class a NotImplementedError error is raised.
On the other side, if both methods are overloaded, the process behavior in local sequential computing mode and in Soma-Workflow modes may be different.
- _before_run_process()[source]¶
This method is called by StudyConfig.run() before calling _run_process(). By default, it does nothing but can be overridden in derived classes.
- _after_run_process(run_process_result)[source]¶
This method is called by StudyConfig.run() after calling _run_process(). It is expected to return the final result of the process. By default, it does nothing but can be overridden in derived classes.
- _get_log(exec_info)[source]¶
Method that generate the logging structure from the execution information and class attributes.
- save_log(returncode)[source]¶
Method to save process execution information in json format.
If the class attribute log_file is not set, a log.json output file is generated in the process call current working directory.
- Parameters:
returncode (ProcessResult) – the process result return code.
- classmethod help(returnhelp=False)[source]¶
Method to print the full help.
- Parameters:
cls (process class (mandatory)) – a process class
returnhelp (bool (optional, default False)) – if True return the help string message, otherwise display it on the console.
- get_commandline()[source]¶
Method to generate a commandline representation of the process.
If not implemented, it will generate a commandline running python, instantiating the current process, and calling its
_run_process()method.- Returns:
commandline – Arguments are in separate elements of the list.
- Return type:
list of strings
- params_to_command()[source]¶
Generates a commandline representation of the process.
If not implemented, it will generate a commandline running python, instantiating the current process, and calling its
_run_process()method.This method is new in Capsul v3 and is a replacement for
get_commandline().It can be overwritten by custom Process subclasses. Actually each process should overwrite either
params_to_command()or_run_process().The returned commandline is a list, which first element is a “method”, and others are the actual commandline with arguments. There are several methods, the process is free to use either of the supported ones, depending on how the execution is implemented.
Methods:
- capsul_job: Capsul process run in python
The command will run the
_run_process()execution method of the process, after loading input parameters from a JSON dictionary file. The only second element in the commandline list is the process identifier (module/class as inget_process_instance()). The location of the JSON file will be passed to the job execution through an environment variable SOMAWF_INPUT_PARAMS:return ['capsul_job', 'morphologist.capsul.morphologist']
- format_string: free commandline with replacements for parameters
Command arguments can be, or contain, format strings in the shape ‘%(param)s’, where param is a parameter of the process. This way we can map values correctly, and call a foreign command:
return ['format_string', 'ls', '%(input_dir)s']
- json_job: free commandline with JSON file for input parameters
A bit like capsul_job but without the automatic wrapper:
return ['json_job', 'python', '-m', 'my_module']
- Returns:
commandline – Arguments are in separate elements of the list.
- Return type:
list of strings
- make_commandline_argument(*args)[source]¶
This helper function may be used to build non-trivial commandline arguments in get_commandline implementations. Basically it concatenates arguments, but it also takes care of keeping track of temporary file objects (if any), and converts non-string arguments to strings (using repr()).
Ex:
>>> process.make_commandline_argument('param=', self.param)
will return the same as:
>>> 'param=' + self.param
if self.param is a string (file name) or a temporary path.
- static run_from_commandline(process_definition)[source]¶
Run a process from a commandline call. The process name (with module) are given in argument, input parameters should be passed through a JSON file which location is in the
SOMAWF_INPUT_PARAMSenvironment variable.If the process has outputs, the
SOMAWF_OUTUT_PARAMSenvironment variable should contain the location of an output file which will be written with a dict containing output parameters values.
- get_input_spec()[source]¶
Method to access the process input specifications.
- Returns:
outputs – a string representation of all the input trait specifications.
- Return type:
- get_output_spec()[source]¶
Method to access the process output specifications.
- Returns:
outputs – a string representation of all the output trait specifications.
- Return type:
- get_inputs()[source]¶
Method to access the process inputs.
- Returns:
outputs – a dictionary with all the input trait names and values.
- Return type:
- get_outputs()[source]¶
Method to access the process outputs.
- Returns:
outputs – a dictionary with all the output trait names and values.
- Return type:
- set_parameter(name, value, protected=None)[source]¶
Method to set a process instance trait value.
For File and Directory traits the None value is replaced by the special Undefined trait value.
- set_study_config(study_config)[source]¶
Set a StudyConfig for the process. Note that it can only be done once: once a non-null StudyConfig has been assigned to the process, it should not change.
- get_missing_mandatory_parameters()[source]¶
Returns a list of parameters which are not optional, and which value is Undefined or None, or an empty string for a File or Directory parameter.
- requirements()[source]¶
Requirements needed to run the process. It is a dictionary which keys are config/settings modules and values are requests for them.
The default implementation returns an empty dict (no requirements), and should be overloaded by processes which actually have requirements.
Ex:
{'spm': 'version >= "12" and standalone == "True"')
- check_requirements(environment='global', message_list=None)[source]¶
Checks the process requirements against configuration settings values in the attached CapsulEngine. This makes use of the
requirements()method and checks that there is one matching config value for each required module.- Parameters:
- Returns:
config – if None is returned, requirements are not met: the process cannot run. If a dict is returned, it corresponds to the matching config values. When no requirements are needed, an empty dict is returned. A pipeline, if its requirements are met will return a list of configuration values, because different nodes may require different config values.
- Return type:
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ProcessNode(pipeline, name, process, **kwargs)[source]¶
Bases:
NodeProcess node.
- process¶
the process instance stored in the pipeline node
- Type:
process instance
- set_callback_on_plug(plug_name, callback)[source]¶
Add an event when a plug change
- Parameters:
plug_name (str (mandatory)) – a plug name
callback (@f (mandatory)) – a callback function
- remove_callback_from_plug(plug_name, callback)[source]¶
Remove an event when a plug change
- Parameters:
plug_name (str (mandatory)) – a plug name
callback (@f (mandatory)) – a callback function
- protect_parameter(plug_name, state=True)[source]¶
Protect the named parameter.
Protecting is not a real lock, it just marks the parameter a list of “protected” parameters. This is typically used to mark values that have been set manually by the user (using the ControllerWidget for instance) and that should not be later modified by automatic parameters tweaking (such as completion systems).
Protected parameters are listed in an additional trait, “protected_parameters”.
If the “state” parameter is False, then we will unprotect it (calling unprotect_parameter())
- get_trait(trait_name)[source]¶
Return the desired trait
- Parameters:
trait_name (str (mandatory)) – a trait name
- Returns:
output – the trait named trait_name
- Return type:
trait
- is_job()[source]¶
if True, the node will be represented as a Job in Soma-Workflow. Otherwise the node is static and does not run.
- requirements()[source]¶
Requirements reimplementation for a process node. This node delegates to its underlying process. see
capsul.process.process.requirements()
- check_requirements(environment='global', message_list=None)[source]¶
Reimplementation of
capsul.pipeline.pipeline_nodes.Node.requirements()for a ProcessNode. This one delegates to its underlying process (or pipeline).
- property study_config¶
- property completion_engine¶
- populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.get_process_instance(process_or_id, study_config=None, **kwargs)[source]¶
Return a Process instance given an identifier.
Note that it is convenient to create a process from a StudyConfig instance: StudyConfig.get_process_instance()
The identifier is either:
a derived Process class.
a derived Process class instance.
a Nipype Interface instance.
a Nipype Interface class.
a string description of the class <module>.<class>.
a string description of a function to warp <module>.<function>.
a string description of a module containing a single process <module>
a string description of a pipeline <module>.<fname>.xml.
an XML filename for a pipeline.
a JSON filename for a pipeline.
a Python (.py) filename with process name in it: /path/process_source.py#ProcessName.
a Python (.py) filename for a file containing a single process.
Default values of the process instance are passed as additional parameters.
- Parameters:
process_or_id (instance or class description (mandatory)) – a process/nipype interface instance/class or a string description.
study_config (StudyConfig instance (optional)) – A Process instance belongs to a StudyConfig framework. If not specified the study_config can be set afterwards.
kwargs – default values of the process instance parameters.
- Returns:
result – an initialized process instance.
- Return type:
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ProcessCompletionEngine(process, name=None)[source]¶
Bases:
HasTraitsParameters completion from attributes for a process or pipeline node instance, in the context of a specific data organization.
ProcessCompletionEngine can be used directly for a pipeline, which merely delegates completion to its nodes, and has to be subclassed for a data organization framework on a node.
To get a completion engine, use:
completion_engine = ProcessCompletionEngine.get_completion_engine( node, name)
Note that this will assign permanently the ProcessCompletionEngine object to its associated node or process. To get and set the attributes set:
attributes = completion_engine.get_attribute_values() print(attributes.user_traits().keys()) attributes.specific_process_attribute = 'a value'
Once attributes are set, to process with parameters completion:
completion_engine.complete_parameters()
It is possible to have complete_parameters() triggered automatically when attributes or switch nodes change. To set this up, use:
completion_engine.install_auto_completion()
ProcessCompletionEngine can (and should) be specialized, at least to provide the attributes set for a given process. A factory is used to create the correct type of ProcessCompletionEngine for a given process / name:
ProcessCompletionEngineFactorycapsul.attributes.fom_completion_engine.FomProcessCompletionEngineis a specialization ofProcessCompletionEngineto manage File Organization Models (FOM).- _clear_node(wr)[source]¶
Called when the object behind the self.process proxy is about to be deleted
- get_attribute_values()[source]¶
Get attributes Controller associated to a process or node
- Returns:
attributes (ProcessAttributes instance)
The default implementation does nothing for a
single Process instance, and merges attributes from its children if
the process is a pipeline.
- complete_parameters(process_inputs={}, complete_iterations=True)[source]¶
Completes file parameters from given inputs parameters, which may include both “regular” process parameters (file names) and attributes.
- Parameters:
process_inputs (dict (optional)) – parameters to be set on the process. It may include “regular” process parameters, and attributes used for completion. Attributes should be in a sub-dictionary under the key “capsul_attributes”.
complete_iterations (bool (optional)) – if False, iteration nodes inside the pipeline will not run their own completion. Thus parameters for the iterations will not be correctly completed. However this has 2 advantages: 1. it prevents modification of the input pipeline, 2. it will not do iterations completion which will anyway be done (again) when building a workflow in ~capsul.pipeline.pipeline_workflow.workflow_from_pipeline.
- attributes_to_path(parameter, attributes)[source]¶
Build a path from attributes for a given parameter in a process.
- Parameters:
parameter (str)
attributes (ProcessAttributes instance (Controller))
- set_parameters(process_inputs)[source]¶
Set the given parameters dict to the given process. process_inputs may include regular parameters of the underlying process, and attributes (capsul_attributes: dict).
- attributes_changed(obj, name, old, new)[source]¶
Traits changed callback which triggers parameters update.
This method basically calls complete_parameters() (after some checks).
Users do not normally have to use it directly, it is used internally when install_auto_completion() has been called.
- nodes_selection_changed(obj, name, old, new)[source]¶
Traits changed callback which triggers parameters update.
This method basically calls complete_parameters() (after some checks).
Users do not normally have to use it directly, it is used internally when install_auto_completion() has been called.
- install_auto_completion()[source]¶
Monitor attributes changes and switches changes (which may influence attributes) and recompute parameters completion when needed.
- remove_auto_completion()[source]¶
Remove attributes monitoring and auto-recomputing of parameters.
Reverts install_auto_completion()
- get_path_completion_engine()[source]¶
Get a PathCompletionEngine object for the given process. The default implementation queries PathCompletionEngineFactory, but some specific ProcessCompletionEngine implementations may override it for path completion at the process level (FOMs for instance).
- static get_completion_engine(process, name=None)[source]¶
Get a ProcessCompletionEngine instance for a given process/node within the framework of its StudyConfig factory function.
- exception populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.WorkflowExecutionError(controller, workflow_id, status=None, workflow_kept=True, verbose=True)[source]¶
Bases:
ExceptionException class raised when a workflow execution fails. It holds references to the
WorkflowControllerand the workflow id
- populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.workflow_from_pipeline(pipeline, study_config=None, disabled_nodes=None, jobs_priority=0, create_directories=True, environment='global', check_requirements=True, complete_parameters=False)[source]¶
Create a soma-workflow workflow from a Capsul Pipeline
- Parameters:
pipeline (Pipeline (mandatory)) – a CAPSUL pipeline
study_config (StudyConfig (optional), or dict) – holds information about file transfers and shared resource paths. If not specified, it will be accessed through the pipeline.
disabled_nodes (sequence of pipeline nodes (Node instances) (optional)) – such nodes will be disabled on-the-fly in the pipeline, file transfers will be adapted accordingly (outputs may become inputs in the resulting workflow), and temporary files will be checked. If a disabled node was to produce a temporary files which is still used in an enabled node, then a ValueError exception will be raised. If disabled_nodes is not passed, they will possibly be taken from the pipeline (if available) using disabled steps: see Pipeline.define_steps()
jobs_priority (int (optional, default: 0)) – set this priority on soma-workflow jobs.
create_directories (bool (optional, default: True)) – if set, needed output directories (which will contain output files) will be created in a first job, which all other ones depend on.
environment (str (default: "global")) – configuration environment name (default: “global”). See
capsul.engine.CapsulEngineandcapsul.engine.settings.Settings.check_requirements (bool (default: True)) – if True, check the pipeline nodes requirements in the capsul engine settings, and issue an exception if they are not met instead of proceeding with the workflow.
complete_parameters (bool (default: False)) – Perform parameters completion on the input pipeline while building the workflow. The default is False because we should avoid to do things several times when it’s already done, but in iteration nodes, completion needs to be done anyway for each iteration, so this option offers to do the rest of the “parent” pipeline completion.
- Returns:
workflow – a soma-workflow workflow
- Return type:
Workflow
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ProcessIteration(process, iterative_parameters, study_config=None, context_name=None)[source]¶
Bases:
ProcessNote
Type ‘ProcessIteration.help()’ for a full description of this process parameters.
Type ‘<ProcessIteration>.get_input_spec()’ for a full description of this process input trait types.
Type ‘<ProcessIteration>.get_output_spec()’ for a full description of this process output trait types.
- _doc_path = 'api/pipeline.html#processiteration'¶
- __init__(process, iterative_parameters, study_config=None, context_name=None)[source]¶
Initialize the Process class.
- change_iterative_plug(parameter, iterative=None)[source]¶
Change a parameter to be iterative (or non-iterative)
- _run_process()[source]¶
Runs the processings when the instance is called.
Either this _run_process() or
get_commandline()must be defined in derived classes.Note that _run_process() is called as a python function, on a Process instance. When using remote processing (cluster for instance), this means that the commandline which will run needs to be able to re- instantiate the same process: the process thus has to be stored in a file or python module which can be accessed from the remote machine, and python / capsul correctly installed and available on it.
get_commandline()at the contrary, can implement commandlines which are completely independent from Capsul, and from python.Note
If both methods are not defined in the derived class a NotImplementedError error is raised.
On the other side, if both methods are overloaded, the process behavior in local sequential computing mode and in Soma-Workflow modes may be different.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QThread(parent: QObject | None = None)¶
Bases:
QObject- HighPriority = 4¶
- HighestPriority = 5¶
- IdlePriority = 0¶
- InheritPriority = 7¶
- LowPriority = 2¶
- LowestPriority = 1¶
- NormalPriority = 3¶
- TimeCriticalPriority = 6¶
- finished¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- priority(self) QThread.Priority¶
- quit(self)¶
- requestInterruption(self)¶
- run(self)¶
- setPriority(self, priority: QThread.Priority)¶
- start(self, priority: QThread.Priority = QThread.InheritPriority)¶
- started¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- terminate(self)¶
- yieldCurrentThread()¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QTimer(parent: QObject | None = None)¶
Bases:
QObject- setTimerType(self, atype: Qt.TimerType)¶
- singleShot(msec: int, slot: PYQT_SLOT)¶
- singleShot(msec: int, timerType: Qt.TimerType, slot: PYQT_SLOT) None
- stop(self)¶
- timeout¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- timerType(self) Qt.TimerType¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...)¶
Bases:
objecttypes is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(*args, **kwargs)¶
- signatures¶
The signatures of each of the overloaded signals
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QCursor¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QCursor(bitmap: QBitmap, mask: QBitmap, hotX: int = -1, hotY: int = -1)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QCursor(pixmap: QPixmap, hotX: int = -1, hotY: int = -1)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QCursor(cursor: QCursor | Qt.CursorShape)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QCursor(variant: Any)
Bases:
simplewrapper- setPos(x: int, y: int)¶
- setPos(p: QPoint) None
- setPos(screen: QScreen | None, x: int, y: int) None
- setPos(screen: QScreen | None, p: QPoint) None
- setShape(self, newShape: Qt.CursorShape)¶
- shape(self) Qt.CursorShape¶
- swap(self, other: QCursor | Qt.CursorShape)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon(pixmap: QPixmap)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon(other: QIcon)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon(fileName: str | None)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon(engine: QIconEngine | None)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QIcon(variant: Any)
Bases:
wrapper- Active = 2¶
- Disabled = 1¶
- Normal = 0¶
- Off = 1¶
- On = 0¶
- Selected = 3¶
- actualSize(self, size: QSize, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QSize¶
- actualSize(self, window: QWindow | None, size: QSize, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QSize
- addFile(self, fileName: str | None, size: QSize = QSize(), mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off)¶
- addPixmap(self, pixmap: QPixmap, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off)¶
- availableSizes(self, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) List[QSize]¶
- paint(self, painter: QPainter | None, rect: QRect, alignment: Qt.Alignment | Qt.AlignmentFlag = Qt.AlignCenter, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off)¶
- paint(self, painter: QPainter | None, x: int, y: int, w: int, h: int, alignment: Qt.Alignment | Qt.AlignmentFlag = Qt.AlignCenter, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) None
- pixmap(self, size: QSize, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QPixmap¶
- pixmap(self, w: int, h: int, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QPixmap
- pixmap(self, extent: int, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QPixmap
- pixmap(self, window: QWindow | None, size: QSize, mode: QIcon.Mode = QIcon.Normal, state: QIcon.State = QIcon.Off) QPixmap
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMovie(parent: QObject | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMovie(device: QIODevice | None, format: QByteArray | bytes | bytearray = QByteArray(), parent: QObject | None = None)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMovie(fileName: str | None, format: QByteArray | bytes | bytearray = QByteArray(), parent: QObject | None = None)
Bases:
QObject- CacheAll = 1¶
- CacheNone = 0¶
- NotRunning = 0¶
- Paused = 1¶
- Running = 2¶
- cacheMode(self) QMovie.CacheMode¶
- error¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- finished¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- format(self) QByteArray¶
- frameChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- frameRect(self) QRect¶
- lastError(self) QImageReader.ImageReaderError¶
- resized¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- scaledSize(self) QSize¶
- setBackgroundColor(self, color: QColor | Qt.GlobalColor)¶
- setCacheMode(self, mode: QMovie.CacheMode)¶
- setFormat(self, format: QByteArray | bytes | bytearray)¶
- setScaledSize(self, size: QSize)¶
- start(self)¶
- started¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- state(self) QMovie.MovieState¶
- stateChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- stop(self)¶
- supportedFormats() List[QByteArray]¶
- updated¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QAction(parent: QObject | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QAction(text: str | None, parent: QObject | None = None)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QAction(icon: QIcon, text: str | None, parent: QObject | None = None)
Bases:
QObject- AboutQtRole = 3¶
- AboutRole = 4¶
- ApplicationSpecificRole = 2¶
- HighPriority = 256¶
- Hover = 1¶
- LowPriority = 0¶
- NoRole = 0¶
- NormalPriority = 128¶
- PreferencesRole = 5¶
- QuitRole = 6¶
- TextHeuristicRole = 1¶
- Trigger = 0¶
- activate(self, event: QAction.ActionEvent)¶
- changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- hover(self)¶
- hovered¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- priority(self) QAction.Priority¶
- setMenuRole(self, menuRole: QAction.MenuRole)¶
- setPriority(self, priority: QAction.Priority)¶
- setShortcutContext(self, context: Qt.ShortcutContext)¶
- setShortcuts(self, shortcuts: Iterable[QKeySequence | QKeySequence.StandardKey | str | None | int])¶
- setShortcuts(self, a0: QKeySequence.StandardKey) None
- shortcut(self) QKeySequence¶
- shortcutContext(self) Qt.ShortcutContext¶
- toggle(self)¶
- toggled¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- trigger(self)¶
- triggered¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QApplication(argv: List[str])¶
Bases:
QGuiApplication- CustomColor = 1¶
- ManyColor = 2¶
- NormalColor = 0¶
- aboutQt()¶
- beep()¶
- closeAllWindows()¶
- focusChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- fontMetrics() QFontMetrics¶
- globalStrut() QSize¶
- isEffectEnabled(a0: Qt.UIEffect) bool¶
- setEffectEnabled(a0: Qt.UIEffect, enabled: bool = True)¶
- setGlobalStrut(a0: QSize)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QHBoxLayout¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QHBoxLayout(parent: QWidget | None)
Bases:
QBoxLayout
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMenu(parent: QWidget | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMenu(title: str | None, parent: QWidget | None = None)
Bases:
QWidget- aboutToHide¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- aboutToShow¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- addMenu(self, menu: QMenu | None) QAction | None¶
- addMenu(self, title: str | None) QMenu | None
- addMenu(self, icon: QIcon, title: str | None) QMenu | None
- addSection(self, text: str | None) QAction | None¶
- addSection(self, icon: QIcon, text: str | None) QAction | None
- clear(self)¶
- exec(self) QAction | None¶
- exec(self, pos: QPoint, action: QAction | None = None) QAction | None
- exec(actions: Iterable[QAction], pos: QPoint, at: QAction | None = None, parent: QWidget | None = None) QAction | None
- exec_(self) QAction | None¶
- exec_(self, p: QPoint, action: QAction | None = None) QAction | None
- exec_(actions: Iterable[QAction], pos: QPoint, at: QAction | None = None, parent: QWidget | None = None) QAction | None
- hideTearOffMenu(self)¶
- hovered¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- insertSection(self, before: QAction | None, text: str | None) QAction | None¶
- insertSection(self, before: QAction | None, icon: QIcon, text: str | None) QAction | None
- sizeHint(self) QSize¶
- triggered¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMessageBox(parent: QWidget | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QMessageBox(icon: QMessageBox.Icon, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.NoButton, parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint)
Bases:
QDialog- Abort = 262144¶
- AcceptRole = 0¶
- ActionRole = 3¶
- Apply = 33554432¶
- ApplyRole = 8¶
- ButtonMask = -769¶
- Cancel = 4194304¶
- Close = 2097152¶
- Critical = 3¶
- Default = 256¶
- DestructiveRole = 2¶
- Discard = 8388608¶
- Escape = 512¶
- FirstButton = 1024¶
- FlagMask = 768¶
- Help = 16777216¶
- HelpRole = 4¶
- Ignore = 1048576¶
- Information = 1¶
- InvalidRole = -1¶
- LastButton = 134217728¶
- No = 65536¶
- NoAll = 131072¶
- NoButton = 0¶
- NoIcon = 0¶
- NoRole = 6¶
- NoToAll = 131072¶
- Ok = 1024¶
- Open = 8192¶
- Question = 4¶
- RejectRole = 1¶
- Reset = 67108864¶
- ResetRole = 7¶
- RestoreDefaults = 134217728¶
- Retry = 524288¶
- Save = 2048¶
- SaveAll = 4096¶
- class StandardButtons¶
- class StandardButtons(f: QMessageBox.StandardButtons | QMessageBox.StandardButton)
- class StandardButtons(a0: QMessageBox.StandardButtons)
Bases:
simplewrapper
- Warning = 2¶
- Yes = 16384¶
- YesAll = 32768¶
- YesRole = 5¶
- YesToAll = 32768¶
- addButton(self, button: QAbstractButton | None, role: QMessageBox.ButtonRole)¶
- addButton(self, text: str | None, role: QMessageBox.ButtonRole) QPushButton | None
- addButton(self, button: QMessageBox.StandardButton) QPushButton | None
- button(self, which: QMessageBox.StandardButton) QAbstractButton | None¶
- buttonClicked¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- buttonRole(self, button: QAbstractButton | None) QMessageBox.ButtonRole¶
- critical(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton¶
- defaultButton(self) QPushButton | None¶
- icon(self) QMessageBox.Icon¶
- information(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton¶
- question(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton¶
- setDefaultButton(self, button: QPushButton | None)¶
- setDefaultButton(self, button: QMessageBox.StandardButton) None
- setEscapeButton(self, button: QAbstractButton | None)¶
- setEscapeButton(self, button: QMessageBox.StandardButton) None
- setIcon(self, a0: QMessageBox.Icon)¶
- setStandardButtons(self, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton)¶
- setTextFormat(self, a0: Qt.TextFormat)¶
- setTextInteractionFlags(self, flags: Qt.TextInteractionFlags | Qt.TextInteractionFlag)¶
- setWindowModality(self, windowModality: Qt.WindowModality)¶
- standardButton(self, button: QAbstractButton | None) QMessageBox.StandardButton¶
- standardButtons(self) QMessageBox.StandardButtons¶
- standardIcon(icon: QMessageBox.Icon) QPixmap¶
- textFormat(self) Qt.TextFormat¶
- textInteractionFlags(self) Qt.TextInteractionFlags¶
- warning(parent: QWidget | None, title: str | None, text: str | None, buttons: QMessageBox.StandardButtons | QMessageBox.StandardButton = QMessageBox.Ok, defaultButton: QMessageBox.StandardButton = QMessageBox.NoButton) QMessageBox.StandardButton¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QScrollArea(parent: QWidget | None = None)¶
Bases:
QAbstractScrollArea- alignment(self) Qt.Alignment¶
- setAlignment(self, a0: Qt.Alignment | Qt.AlignmentFlag)¶
- sizeHint(self) QSize¶
- viewportSizeHint(self) QSize¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QSplitter(parent: QWidget | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QSplitter(orientation: Qt.Orientation, parent: QWidget | None = None)
Bases:
QFrame- minimumSizeHint(self) QSize¶
- orientation(self) Qt.Orientation¶
- refresh(self)¶
- restoreState(self, state: QByteArray | bytes | bytearray) bool¶
- saveState(self) QByteArray¶
- setOrientation(self, a0: Qt.Orientation)¶
- sizeHint(self) QSize¶
- splitterMoved¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QToolBar(title: str | None, parent: QWidget | None = None)¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QToolBar(parent: QWidget | None = None)
Bases:
QWidget- actionTriggered¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- allowedAreas(self) Qt.ToolBarAreas¶
- allowedAreasChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- clear(self)¶
- iconSize(self) QSize¶
- iconSizeChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- isAreaAllowed(self, area: Qt.ToolBarArea) bool¶
- movableChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- orientation(self) Qt.Orientation¶
- orientationChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- setAllowedAreas(self, areas: Qt.ToolBarAreas | Qt.ToolBarArea)¶
- setIconSize(self, iconSize: QSize)¶
- setOrientation(self, orientation: Qt.Orientation)¶
- setToolButtonStyle(self, toolButtonStyle: Qt.ToolButtonStyle)¶
- toolButtonStyle(self) Qt.ToolButtonStyle¶
- toolButtonStyleChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- topLevelChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- visibilityChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QVBoxLayout¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QVBoxLayout(parent: QWidget | None)
Bases:
QBoxLayout
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.QWidget(parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())¶
Bases:
QObject,QPaintDevice- DrawChildren = 2¶
- DrawWindowBackground = 1¶
- IgnoreMask = 4¶
- class RenderFlags¶
- class RenderFlags(f: QWidget.RenderFlags | QWidget.RenderFlag)
- class RenderFlags(a0: QWidget.RenderFlags)
Bases:
simplewrapper
- activateWindow(self)¶
- adjustSize(self)¶
- backgroundRole(self) QPalette.ColorRole¶
- baseSize(self) QSize¶
- childrenRect(self) QRect¶
- childrenRegion(self) QRegion¶
- clearFocus(self)¶
- clearMask(self)¶
- contentsMargins(self) QMargins¶
- contentsRect(self) QRect¶
- contextMenuPolicy(self) Qt.ContextMenuPolicy¶
- create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- createWindowContainer(window: QWindow | None, parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = 0) QWidget¶
- customContextMenuRequested¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- effectiveWinId(self) PyQt5.sip.voidptr¶
- ensurePolished(self)¶
- focusPolicy(self) Qt.FocusPolicy¶
- fontInfo(self) QFontInfo¶
- fontMetrics(self) QFontMetrics¶
- foregroundRole(self) QPalette.ColorRole¶
- frameGeometry(self) QRect¶
- frameSize(self) QSize¶
- geometry(self) QRect¶
- getContentsMargins(self)¶
- grabGesture(self, type: Qt.GestureType, flags: Qt.GestureFlags | Qt.GestureFlag = Qt.GestureFlags())¶
- grabKeyboard(self)¶
- grabMouse(self)¶
- grabMouse(self, a0: QCursor | Qt.CursorShape) None
- grabShortcut(self, key: QKeySequence | QKeySequence.StandardKey | str | None | int, context: Qt.ShortcutContext = Qt.WindowShortcut) int¶
- hide(self)¶
- inputMethodHints(self) Qt.InputMethodHints¶
- inputMethodQuery(self, a0: Qt.InputMethodQuery) Any¶
- layoutDirection(self) Qt.LayoutDirection¶
- locale(self) QLocale¶
- lower(self)¶
- mask(self) QRegion¶
- maximumSize(self) QSize¶
- minimumSize(self) QSize¶
- minimumSizeHint(self) QSize¶
- nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)¶
- normalGeometry(self) QRect¶
- overrideWindowFlags(self, type: Qt.WindowFlags | Qt.WindowType)¶
- overrideWindowState(self, state: Qt.WindowStates | Qt.WindowState)¶
- palette(self) QPalette¶
- raise_(self)¶
- rect(self) QRect¶
- releaseKeyboard(self)¶
- releaseMouse(self)¶
- render(self, target: QPaintDevice | None, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags | QWidget.RenderFlag = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren))¶
- render(self, painter: QPainter | None, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags | QWidget.RenderFlag = QWidget.RenderFlags(QWidget.RenderFlag.DrawWindowBackground | QWidget.RenderFlag.DrawChildren)) None
- repaint(self)¶
- repaint(self, x: int, y: int, w: int, h: int) None
- repaint(self, a0: QRect) None
- repaint(self, a0: QRegion) None
- restoreGeometry(self, geometry: QByteArray | bytes | bytearray) bool¶
- saveGeometry(self) QByteArray¶
- setAttribute(self, attribute: Qt.WidgetAttribute, on: bool = True)¶
- setBackgroundRole(self, a0: QPalette.ColorRole)¶
- setContentsMargins(self, left: int, top: int, right: int, bottom: int)¶
- setContentsMargins(self, margins: QMargins) None
- setContextMenuPolicy(self, policy: Qt.ContextMenuPolicy)¶
- setCursor(self, a0: QCursor | Qt.CursorShape)¶
- setFocus(self)¶
- setFocus(self, reason: Qt.FocusReason) None
- setFocusPolicy(self, policy: Qt.FocusPolicy)¶
- setForegroundRole(self, a0: QPalette.ColorRole)¶
- setInputMethodHints(self, hints: Qt.InputMethodHints | Qt.InputMethodHint)¶
- setLayoutDirection(self, direction: Qt.LayoutDirection)¶
- setLocale(self, locale: QLocale)¶
- setPalette(self, a0: QPalette)¶
- setParent(self, parent: QWidget | None)¶
- setParent(self, parent: QWidget | None, f: Qt.WindowFlags | Qt.WindowType) None
- setSizePolicy(self, a0: QSizePolicy)¶
- setSizePolicy(self, hor: QSizePolicy.Policy, ver: QSizePolicy.Policy) None
- setWindowFlag(self, a0: Qt.WindowType, on: bool = True)¶
- setWindowFlags(self, type: Qt.WindowFlags | Qt.WindowType)¶
- setWindowModality(self, windowModality: Qt.WindowModality)¶
- setWindowState(self, state: Qt.WindowStates | Qt.WindowState)¶
- show(self)¶
- showFullScreen(self)¶
- showMaximized(self)¶
- showMinimized(self)¶
- showNormal(self)¶
- size(self) QSize¶
- sizeHint(self) QSize¶
- sizeIncrement(self) QSize¶
- sizePolicy(self) QSizePolicy¶
- testAttribute(self, attribute: Qt.WidgetAttribute) bool¶
- ungrabGesture(self, type: Qt.GestureType)¶
- unsetCursor(self)¶
- unsetLayoutDirection(self)¶
- unsetLocale(self)¶
- update(self)¶
- update(self, a0: QRect) None
- update(self, a0: QRegion) None
- update(self, ax: int, ay: int, aw: int, ah: int) None
- updateGeometry(self)¶
- updateMicroFocus(self)¶
- visibleRegion(self) QRegion¶
- winId(self) PyQt5.sip.voidptr¶
- windowFlags(self) Qt.WindowFlags¶
- windowIconChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- windowIconTextChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- windowModality(self) Qt.WindowModality¶
- windowState(self) Qt.WindowStates¶
- windowTitleChanged¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- windowType(self) Qt.WindowType¶
- populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.is_file_trait(trait, allow_dir=False, only_dirs=False)[source]¶
Tells if the given trait is a File (and/or dict) or may be a file (for a compound trait)
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ApplicationModel(resource_pool=None, parent=None)[source]¶
Bases:
QObjectModel for the application. This model was created to provide faster application minimizing communications with the server. The instances of this class hold the connections and the GuiWorkflow instances created in the current session of the application. The current workflow is periodically updated and the signal workflow_state_changed is emitted if necessary.
- connection_closed_error¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- current_connection_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- workflow_state_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- current_workflow_about_to_change¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- current_workflow_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- global_workflow_state_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- tmp_stderrout_dir = None¶
- resource_pool = None¶
- _workflows = None¶
- _expiration_dates = None¶
- _workflow_names = None¶
- _workflow_statuses = None¶
- current_connection = None¶
- current_resource_id = None¶
- _current_workflow = None¶
- current_wf_id = None¶
- workflow_exp_date = None¶
- workflow_name = None¶
- workflow_status = None¶
- _timeout_duration = None¶
- _hold = None¶
- _timer = None¶
- connection_timeout(func, args=(), kwargs={}, timeout_duration=30, default=None)[source]¶
This function will spawn a thread and run the given function using the args, kwargs and return the given default value if the timeout_duration is exceeded.
- add_connection(resource_id, connection)[source]¶
Adds a connection and use it as the current connection
- delete_connection(resource_id)[source]¶
Delete the connection. If the resource is the current connection: If any other connections exist the new current connection will be one of them. If not the current connection is set to None.
- add_to_submitted_workflows(workflow_id, workflow_exp_date, workflow_name, workflow_status, workflow=None)[source]¶
Add a workflow without modifying the current workflow
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ConnectionDialog(login_list, resource_list, resource_id=None, editable_resource=True, parent=None)[source]¶
Bases:
QDialog
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.MainWindow(model, user=None, auto_connect=False, computing_resource=None, parent=None, flags=0, config_file=None, db_file=None, interactive=False, isolated_light_mode=None)[source]¶
Bases:
QMainWindow- server_widget = None¶
- __init__(model, user=None, auto_connect=False, computing_resource=None, parent=None, flags=0, config_file=None, db_file=None, interactive=False, isolated_light_mode=None)[source]¶
- Parameters:
model (ApplicationModel)
- ui = None¶
- model = None¶
- sw_widget = None¶
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.Config(properties_path=None)[source]¶
Bases:
objectObject that handles the configuration of the software
Contains:
Methods:
_configure_matlab_only: Configures MATLAB without SPM
_configure_matlab_spm: Configures SPM and MATLAB
_configure_mcr_only: Configures MCR without SPM
_configure_standalone_spm: Configures standalone SPM and MCR
_disable_matlab_spm: Disables all MATLAB and SPM configurations
get_admin_hash: Get the value of the hash of the admin password
get_afni_path: Returns the path of AFNI
get_ants_path: Returns the path of ANTS
getBackgroundColor: Get background color
get_capsul_config: Get CAPSUL config dictionary
get_capsul_engine: Get a global CapsulEngine object used for all operations in MIA application
getChainCursors: Returns if the “chain cursors” checkbox of the mini-viewer is activated
get_freesurfer_setup: Get freesurfer path
get_fsl_config: Returns the path of the FSL config file
get_mainwindow_maximized: Get the maximized (full-screen) flag
get_mainwindow_size: Get the main window size
get_matlab_command: Returns Matlab command
get_matlab_path: Returns the path of Matlab’s executable
get_matlab_standalone_path: Returns the path of Matlab Compiler Runtime
get_max_projects: Returns the maximum number of projects displayed in the “Saved projects” menu
get_max_thumbnails: Get max thumbnails number at the data browser bottom
get_mri_conv_path: Returns the MRIManager.jar path
get_mrtrix_path: Returns mrtrix path
getNbAllSlicesMax: Returns the maximum number of slices to display in the mini viewer
get_opened_projects: Returns the opened projects
get_projects_save_path: Returns the folder where the projects are saved
get_properties_path: Returns the software’s properties path
get_referential: Returns boolean to indicate DataViewer referential
get_resources_path: Get the resources path
getShowAllSlices: Returns if the “show all slices” checkbox of the mini viewer is activated
getSourceImageDir: Get the source directory for project images
get_spm_path: Returns the path of SPM12 (license version)
get_spm_standalone_path: Returns the path of SPM12 (standalone version)
getTextColor: Return the text color
getThumbnailTag: Returns the tag that is displayed in the mini viewer
get_use_afni: Returns the value of “use afni” checkbox in the preferences
get_use_ants: Returns the value of “use ants” checkbox in the preferences
get_use_clinical: Returns the value of “clinical mode” checkbox in the preferences
get_use_freesurfer: Returns the value of “use freesurfer” checkbox in the preferences
get_use_fsl: Returns the value of “use fsl” checkbox in the preferences
get_use_matlab: Returns the value of “use matlab” checkbox in the preferences
get_use_matlab_standalone: Returns the value of “use matlab standalone” checkbox in the preferences
get_use_mrtrix: Returns the value of “use mrtrix” checkbox in the preferences
get_user_level: Get the user level in the Capsul config
get_user_mode: Returns the value of “user mode” checkbox in the preferences
get_use_spm: Returns the value of “use spm” checkbox in the preferences
get_use_spm_standalone: Returns the value of “use spm standalone” checkbox in the preferences
getViewerConfig: Returns the DataViewer configuration (neuro or radio), by default neuro
getViewerFramerate: Returns the DataViewer framerate for automatic time running images
isAutoSave: Checks if auto-save mode is activated
isControlV1: Checks if the selected display of the controller is of V1 type
isRadioView: Checks if miniviewer in radiological orientation (if not, then it is in neurological orientation)
loadConfig: Reads the config in the config.yml file
saveConfig: Saves the config to the config.yml file
set_admin_hash: Set the password hash
set_afni_path: Set the path of the AFNI
set_ants_path: Set the path of the ANTS
setAutoSave: Sets the auto-save mode
setBackgroundColor: Sets the background color
set_capsul_config: Set CAPSUL configuration dict into MIA config
setChainCursors: Set the “chain cursors” checkbox of the mini viewer
set_clinical_mode: Set the value of “clinical mode” in the preferences
setControlV1: Set controller display mode (True if V1)
set_freesurfer_setup: Set freesurfer path
set_fsl_config: Set the path of the FSL config file
set_mainwindow_maximized: Set the maximized (fullscreen) flag
set_mainwindow_size: Set main window size
set_matlab_path: Set the path of Matlab’s executable
set_matlab_standalone_path: Set the path of Matlab Compiler Runtime
set_max_projects: Set the maximum number of projects displayed in the “Saved projects” menu
set_max_thumbnails: Set max thumbnails number at the data browser bottom
set_mri_conv_path: Set the MRIManager.jar path
set_mrtrix_path: Set the path of mrtrix
setNbAllSlicesMax: Set the maximum number of slices to display in the mini viewer
set_opened_projects: Set the opened projects
set_projects_save_path: Set the folder where the projects are saved
set_radioView: Set the orientation in miniviewer (True for radiological, False for neurological orientation)
set_referential: Set the DataViewer referential
set_resources_path: Set the resources path
setShowAllSlices: Set the “show all slices” checkbox of the mini viewer
setSourceImageDir: Set the source directory for project images
set_spm_path: Set the path of SPM12 (license version)
set_spm_standalone_path: Set the path of SPM12 (standalone version)
setTextColor: Set the text color
setThumbnailTag: Set the tag that is displayed in the mini viewer
set_use_afni: Set the value of “use afni” checkbox in the preferences
set_use_ants: Set the value of “use ants” checkbox in the preferences
set_use_freesurfer: Set the value of “use freesurfer” checkbox in the preferences
set_use_fsl: Set the value of “use fsl” checkbox in the preferences
set_use_matlab: Set the value of “use matlab” checkbox in the preferences
set_use_matlab_standalone: Set the value of “use matlab standalone” checkbox in the preferences
set_use_mrtrix: Set the value of “use mrtrix” checkbox in the preferences
set_user_mode: Set the value of “user mode” checkbox in the preferences
set_use_spm: Set the value of “use spm” checkbox in the preferences
set_use_spm_standalone: Set the value of “use spm standalone” checkbox in the preferences
setViewerConfig: Set the Viewer configuration neuro or radio
setViewerFramerate: Set the Viewer frame rate for automatic running time images
update_capsul_config: Update a global CapsulEngine object used for all operations in MIA application
- capsul_engine = None¶
- __init__(properties_path=None)[source]¶
Initialization of the Config class
- Parameters:
properties_path – (str) If provided, the configuration file will be loaded / saved from the given directory. Otherwise, the regular heuristics will be used to determine the config path. This option allows to use an alternative config directory (for tests for instance).
- _configure_matlab_only(matlab_path: str) None[source]¶
Configures MATLAB without SPM, ensuring that only MATLAB is used.
- Parameters:
matlab_path – (str) The directory path of the MATLAB installation.
- _configure_matlab_spm(spm_dir, matlab_path)[source]¶
Configures SPM to use the specified SPM directory with a MATLAB installation.
- Parameters:
spm_dir – (str) The directory path of the SPM installation.
matlab_path – (str) The directory path of the MATLAB installation.
- _configure_mcr_only(mcr_dir: str) None[source]¶
Configures MATLAB Compiler Runtime (MCR) without SPM, ensuring that only MCR is used.
- Parameters:
mcr_dir – (str) The directory path of the MATLAB Compiler Runtime (MCR).
- _configure_standalone_spm(spm_dir, mcr_dir)[source]¶
Configures standalone SPM to use the specified SPM and MATLAB Compiler Runtime (MCR) directories.
- Parameters:
spm_dir – (str) The directory path of the standalone SPM installation.
mcr_dir – (str) The directory path of the MATLAB Compiler Runtime (MCR).
- _disable_matlab_spm() None[source]¶
Disables all MATLAB and SPM configurations, ensuring that neither MATLAB nor SPM is used.
- get_admin_hash()[source]¶
Retrieves the hashed admin password from the configuration.
- Returns:
The hashed admin password if found in config, False if not present in config.
- getBackgroundColor()[source]¶
Get background color.
- Returns:
(str) Background color, or “” if unknown.
- get_capsul_config(sync_from_engine=True)[source]¶
Retrieve and construct the Capsul configuration dictionary.
This function builds a configuration dictionary for Capsul, incorporating settings for various neuroimaging tools and processing engines. It manages configurations for tools like SPM, FSL, FreeSurfer, MATLAB, AFNI, ANTs, and MRTrix.
The function first retrieves local settings for each tool from the Mia preferences, then constructs the appropriate configuration structure. If requested, it can synchronize the configuration with the current Capsul engine state.
- Parameters:
sync_from_engine – (bool) If True, synchronizes the configuration with the current Capsul engine settings after building the base configuration.
- Returns:
(dict) A nested dictionary containing the complete Capsul configuration, structured with the following main sections:
engine_modules: List of available processing modulesengine: Contains global and environment-specific settings, as well as configurations specific to certain tools (SPM, FSL, etc.)
- Private functions:
_configure_spm: Configure SPM settings.
_configure_tool: Configure various neuroimaging settings (e.g. ‘fsl’, ‘afni’, etc.)
- static get_capsul_engine()[source]¶
Get or create a global CapsulEngine singleton for Mia application operations.
The engine is created only once when first needed (lazy initialization). Subsequent calls return the same instance.
- Returns:
(CapsulEngine) The global CapsulEngine instance.
- getChainCursors()[source]¶
Get the value of the checkbox ‘chain cursor’ in miniviewer.
- Returns:
(bool) Value of the checkbox.
- get_freesurfer_setup()[source]¶
Get the freesurfer path.
- Returns:
(str) Path to freesurfer, or “” if unknown.
- get_fsl_config()[source]¶
Get the FSL config file path.
- Returns:
(str) Path to the fsl/etc/fslconf/fsl.sh file.
- get_mainwindow_maximized()[source]¶
Get the maximized (fullscreen) flag.
- Returns:
(bool) Maximized (fullscreen) flag.
- get_matlab_command()[source]¶
Retrieves the appropriate Matlab command based on the configuration.
- Returns:
(str) The Matlab executable path or None if no path is specified.
- get_matlab_standalone_path()[source]¶
Get the path to matlab compiler runtime.
- Returns:
(str) A path.
- get_max_projects()[source]¶
Retrieves the maximum number of projects displayed in the “Saved projects” menu.
- Returns:
(int) The maximum number of projects. Defaults to 5 if not specified.
- get_max_thumbnails()[source]¶
Retrieves the maximum number of thumbnails displayed in the mini-viewer at the bottom of the data browser.
- Returns:
(int) The maximum number of thumbnails. Defaults to 5 if not specified.
- getNbAllSlicesMax()[source]¶
Get number the maximum number of slices to display in the miniviewer.
- Returns:
(int) Maximum number of slices to display in miniviewer.
- get_properties_path()[source]¶
Retrieves the path to the folder containing the “processes” and “properties” directories of Mia.
The properties path is defined in the configuration_path.yml file, located in ~/.populse_mia.
In user mode, the path is retrieved from the properties_user_path parameter.
In developer mode, the path is retrieved from the properties_dev_path parameter.
If outdated parameters (mia_path, mia_user_path) are found, they are automatically updated in the configuration file.
- Returns:
(str) The absolute path to the properties folder.
- get_referential()[source]¶
Retrieves the chosen referential from the anatomist_2 data viewer.
- Returns:
(str) “0” for World Coordinates, “1” for Image ref.
- getShowAllSlices()[source]¶
Get whether the show_all_slices parameters was enabled or not in the miniviewer.
- Returns:
(bool) True if the show_all_slices parameters was enabled.
- get_spm_standalone_path()[source]¶
Get the path to the SPM12 standalone version.
- Returns:
(str) A path.
- getThumbnailTag()[source]¶
Get the tag of the thumbnail displayed in the miniviewer.
- Returns:
(str) The tag of the thumbnail displayed in miniviewer.
- get_use_afni()[source]¶
Get the value of “use afni” checkbox in the preferences.
- Returns:
(bool) The value of “use afni” checkbox.
- get_use_ants()[source]¶
Get the value of “use ants” checkbox in the preferences.
- Returns:
(bool) The value of “use ants” checkbox.
- get_use_clinical()[source]¶
Get the clinical mode in the preferences.
- Returns:
(bool) The clinical mode.
- get_use_freesurfer()[source]¶
Get the value of “use freesurfer” checkbox in the preferences.
- Returns:
(bool) The value of “use freesurfer” checkbox.
- get_use_fsl()[source]¶
Get the value of “use fsl” checkbox in the preferences.
- Returns:
(bool) The value of “use fsl” checkbox.
- get_use_matlab()[source]¶
Get the value of “use matlab” checkbox in the preferences.
- Returns:
(bool) The value of “use matlab” checkbox.
- get_use_matlab_standalone()[source]¶
Get the value of “use matlab standalone” checkbox in the preferences.
- Returns:
(bool) The value of “use matlab standalone” checkbox.
- get_use_mrtrix()[source]¶
Get the value of “use mrtrix” checkbox in the preferences.
- Returns:
(bool) The value of “use mrtrix” checkbox.
- get_user_level()[source]¶
Get the user level in the Capsul config.
- Returns:
(int) The user level in the Capsul config.
- get_user_mode()[source]¶
Get if user mode is disabled or enabled in the preferences.
- Returns:
(bool) If True, the user mode is enabled.
- get_use_spm()[source]¶
Get the value of “use spm” checkbox in the preferences.
- Returns:
(bool) The value of “use spm” checkbox.
- get_use_spm_standalone()[source]¶
Get the value of “use spm standalone” checkbox in the preferences.
- Returns:
(bool) The value of “use spm standalone” checkbox.
- getViewerConfig()[source]¶
Get the viewer config “neuro” or “radio”, “neuro” by default.
- Returns:
(str) The viewer config (“neuro” or “radio”).
- getViewerFramerate()[source]¶
Get the Viewer framerate.
- Returns:
(str) The Viewer framerat (ex. “5”).
- isAutoSave()[source]¶
Get if the auto-save mode is enabled or not.
- Returns:
(bool) If True, auto-save mode is enabled.
- isControlV1()[source]¶
Gets whether the controller display is of type V1.
- Returns:
(bool) If True, V1 controller display.
- isRadioView()[source]¶
Get if the display in miniviewer is in radiological orientation.
- Returns:
(bool) If True, radiological orientation, otherwise neurological orientation.
- loadConfig()[source]¶
Read the config from config.yml file.
Attempts to read an encrypted YAML configuration file from the properties directory, decrypt it using Fernet encryption, and parse it as YAML.
- Returns:
(dict) Parsed configuration from the YAML file. Returns empty dict if parsing fails.
- saveConfig()[source]¶
Save the current parameters in the config.yml file.
Encrypts and writes the current configuration (self.config) to config.yml using Fernet encryption. Creates the necessary directory structure if it doesn’t exist. After saving, updates the capsul configuration.
- setBackgroundColor(color)[source]¶
Set background color and save configuration.
- Parameters:
color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)
- set_capsul_config(capsul_config_dict)[source]¶
Update Mia configuration with Capsul settings and synchronize tools configuration.
Called after editing Capsul config (via File > Mia preferences > Pipeline tab > Edit CAPSUL config) to synchronize Capsul settings with Mia preferences. Configures various neuroimaging tools (AFNI, ANTs, FSL, etc.) based on the Capsul engine configuration.
- Parameters:
capsul_config_dict – Dictionary containing Capsul configuration.
Structure of capsul_config_dict:
{ 'engine': { 'environment_name': {...configuration...} }, 'engine_modules': [...] }
- Private function:
_get_module_config: Extracts module configuration from the global Capsul configuration.
- setChainCursors(chain_cursors)[source]¶
Set the value of the checkbox ‘chain cursor’ in the mini viewer.
- Parameters:
chain_cursors – A boolean.
- set_clinical_mode(clinical_mode)[source]¶
Enable or disable clinical mode.
- Parameters:
clinical_mode – A boolean.
- setControlV1(controlV1)[source]¶
Set controller display mode (True if V1).
- Parameters:
controlV1 – A boolean.
- set_freesurfer_setup(path)[source]¶
Set the freesurfer config file.
- Parameters:
path – (str) Path to freesurfer/FreeSurferEnv.sh.
- set_fsl_config(path)[source]¶
Set the FSL config file.
- Parameters:
path – (str) Path to fsl/etc/fslconf/fsl.sh.
- set_mainwindow_maximized(enabled)[source]¶
Set the maximized (full-screen) flag.
- Parameters:
enabled – A boolean.
- set_matlab_path(path)[source]¶
Set the path of Matlab’s executable.
- Parameters:
path – (str) A path.
- set_matlab_standalone_path(path)[source]¶
Set the path of Matlab Compiler Runtime.
- Parameters:
path – (str) A path.
- set_max_projects(nb_max_projects)[source]¶
Set the maximum number of projects displayed in the “Saved projects” menu.
- Parameters:
nb_max_projects – An integer.
- set_max_thumbnails(nb_max_thumbnails)[source]¶
Set max thumbnails number at the data browser bottom.
- Parameters:
nb_max_thumbnails – An integer.
- setNbAllSlicesMax(nb_slices_max)[source]¶
Set the number of slices to display in the mini-viewer.
- Parameters:
nb_slices_max – (int) Maximum number of slices to display.
- set_opened_projects(new_projects)[source]¶
Set the list of opened projects and saves the modification.
- Parameters:
new_projects – (list[str]) A list of paths.
- set_projects_save_path(path)[source]¶
Set the folder where the projects are saved.
- Parameters:
path – (str) A path.
- set_radioView(radio_view)[source]¶
Set the radiological / neurological orientation in mini viewer.
True for radiological
False for neurological
- Parameters:
radio_view – A boolean.
- set_referential(ref)[source]¶
Set the referential to “image Ref” or “World Coordinates” in anatomist_2 data viewer.
- Parameters:
ref – (str) “0” for World Coordinates, “1” for Image Ref.
- setShowAllSlices(show_all_slices)[source]¶
Set the show_all_slides setting in miniviewer.
- Parameters:
show_all_slices – A boolean.
- setSourceImageDir(source_image_dir)[source]¶
Set the source directory for project images.
- Parameters:
source_image_dir – (str) A path.
- set_spm_standalone_path(path)[source]¶
Set the path of SPM (standalone version).
- Parameters:
path – (str) A path.
- setTextColor(color)[source]¶
Set text color and save configuration.
- Parameters:
color – Color string (‘Black’, ‘Blue’, ‘Green’, ‘Grey’, ‘Orange’, ‘Red’, ‘Yellow’, ‘White’)
- setThumbnailTag(thumbnail_tag)[source]¶
Set the tag that is displayed in the mini-viewer.
- Parameters:
thumbnail_tag – A string.
- set_use_afni(use_afni)[source]¶
Set the value of “use_afni” checkbox in the preferences.
- Parameters:
use_afni – A boolean.
- set_use_ants(use_ants)[source]¶
Set the value of “use_ants” checkbox in the preferences.
- Parameters:
use_ants – A boolean.
- set_use_freesurfer(use_freesurfer)[source]¶
Set the value of “use_freesurfer” checkbox in the preferences.
- Parameters:
use_freesurfer – A boolean.
- set_use_fsl(use_fsl)[source]¶
Set the value of “use_fsl” checkbox in the preferences.
- Parameters:
use_fsl – A boolean.
- set_use_matlab(use_matlab)[source]¶
Set the value of “use matlab” checkbox in the preferences.
- Parameters:
use_matlab – A boolean.
- set_use_matlab_standalone(use_matlab_standalone)[source]¶
Set the value of “use_matlab_standalone” checkbox in the preferences.
- Parameters:
use_matlab – A boolean.
- set_use_mrtrix(use_mrtrix)[source]¶
Set the value of “use_mrtrix” checkbox in the preferences.
- Parameters:
use_mrtrix – A boolean.
- set_use_spm(use_spm)[source]¶
Set the value of “use spm” checkbox in the preferences.
- Parameters:
use_spm – A boolean.
- set_use_spm_standalone(use_spm_standalone)[source]¶
Set the value of “use spm standalone” checkbox in the preferences.
- Parameters:
use_spm_standalone – A boolean.
- setViewerConfig(config_NeuRad)[source]¶
sets user’s configuration neuro or radio for data_viewer.
neuro: neurological
radio: radiological
- Parameters:
config_NeuRad – A string.
- setViewerFramerate(im_sec)[source]¶
sets user’s framerate for data_viewer.
- Parameters:
im_sec – (int) Number of images per second.
- update_capsul_config()[source]¶
Updates the global CapsulEngine object used for all operations in the Mia application.
The CapsulEngine is created once when needed and updated each time the configuration is saved. This method ensures that all necessary engine modules are loaded and configurations are properly imported from the saved settings.
- Returns:
(capsul.engine.CapsulEngine) The updated CapsulEngine object, or None if the engine is not initialized.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.IterationTable(project, scan_list=None, main_window=None)[source]¶
Bases:
QWidgetWidget that handles pipeline iteration.
This widget allows users to select tags for iteration and visualization, filter values, and manage the iteration process for pipeline execution.
- iteration_table_updated¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- __init__(project, scan_list=None, main_window=None)[source]¶
Initialize the IterationTable widget.
- Parameters:
project – Current project in the software.
scan_list – List of the selected database files. If None, all documents from the current collection will be used.
main_window – Software’s main window reference.
- _create_tag_button(text, index)[source]¶
Create a new tag button with the given text and index.
- Parameters:
(str) (text) – Text to display on the button.
(int) (index) – Index of the button in the push_buttons list.
- property current_editor¶
Return the currently active pipeline editor.
This property provides convenient access to the current editor from the pipeline manager without repeating the full attribute chain.
- Returns:
The active pipeline editor instance.
- fill_values(idx)[source]¶
Fill values_list with unique tag values for the specified tag.
- Parameters:
(int) (idx) – Index of the tag in push_buttons list.
- format_filter_value(value)[source]¶
Convert a value into a JSON-formatted string.
If
valueis a string, this method first attempts to interpret it as a Python literal (for example a list, dict, number, or boolean) usingast.literal_eval(). If parsing fails, the original string is preserved.- Parameters:
(Any) (value) – The value to serialize.
- Return (str):
The JSON representation of the resulting value.
- refresh_layout()[source]¶
Update the layout of the widget.
Called in widget’s initialization and when a tag push button is added or removed.
- select_visualized_tag(idx)[source]¶
Open a dialog to select which tag to visualize in the iteration table.
- Parameters:
(int) (idx) – Index of the clicked push button.
- update_iterated_tag(tag_name=None)[source]¶
Update the widget when the iterated tag is modified.
- Parameters:
(str) (tag_name) – Name of the iterated tag.
- update_selected_tag(selected_tag)[source]¶
Update the lists of values corresponding to the selected tag.
Retrieves all unique values of the selected tag from scans in the current collection that also exist in the scan list. Then updates the tag value lists in the current pipeline editor.
- Parameters:
(str) (selected_tag) – The tag whose values should be retrieved and updated.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.CapsulNodeController(project, scan_list, pipeline_manager_tab, main_window)[source]¶
Bases:
QWidgetA PyQt widget for managing and editing pipeline node parameters using Capsul’s AttributedProcessWidget.
This controller provides a user interface for interacting with pipeline nodes, enabling users to:
View and modify node parameters using Capsul’s AttributedProcessWidget.
Rename nodes and update the pipeline accordingly.
Filter and manage node attributes.
Handle undo/redo operations for parameter changes.
Recursively rename subprocesses and adjust context names.
The widget is designed to integrate with a pipeline editor, providing real-time updates and synchronization between the UI and the underlying pipeline state.
- value_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- __init__(project, scan_list, pipeline_manager_tab, main_window)[source]¶
Initialize the node controller.
- Parameters:
project – Current project instance.
scan_list – List of available scans.
pipeline_manager_tab – Parent pipeline manager tab.
- Parammain_window:
Main application window.
- display_parameters(node_name, process, pipeline)[source]¶
Display the parameters of the selected node.
Creates and displays widgets for all node parameters, including line edits, labels, and control buttons. Handles special cases for pipeline inputs/outputs nodes.
- Parameters:
(str) (node_name) – Name of the node to display.
process – Process instance associated with the node.
pipeline – Current pipeline containing the node.
- filter_attributes()[source]¶
Display the attributes filter dialog.
Opens a popup widget that allows users to filter and select attributes for the current process node.
- rename_subprocesses(node, parent_node_name)[source]¶
Recursively rename subprocesses within the pipeline, adjusting the context name.
This method checks if the process is part of a pipeline and modifies its context name accordingly. If the process name contains a hierarchy of at least three levels, the context name is updated with the parent node name and the remaining parts of the context name. If the process is a pipeline node, the method is called recursively for each subprocess.
- Parameters:
node – The current node being processed.
(str) (parent_node_name) – The name of the parent node to be included in the context name.
- static static_release(process, param_changed)[source]¶
Remove trait change notification from process.
- Parameters:
process – Process instance to remove notification from.
param_changed – Callback function to remove.
- parameters_changed(_, plug_name, old_value, new_value)[source]¶
Handle parameter value changes and emit signal.
- Parameters:
_ – Unused parameter (object instance).
(str) (plug_name) – Name of the changed parameter.
old_value – Previous parameter value.
new_value – New parameter value.
- update_attributes_from_filter(attributes)[source]¶
Apply selected attributes from the filter widget.
Updates the process completion engine attributes based on user selection from the filter dialog. Shows a warning if no matching attributes are found.
- Parameters:
(dict) (attributes) – Dictionary of attribute names and values to apply.
- update_node_name(new_node_name=None, old_node_name=None, from_undo=False, from_redo=False)[source]¶
Change the name of the selected node and update the pipeline.
Renames the node in the pipeline dictionary and updates all associated links. For iterated processes, ensures the name starts with “iterated_”.
- Parameters:
(str) (old_node_name) – New name for the node. If None (when this method is not called from an undo/redo), reads from the line edit widget.
(str) – Current node name. If None (when this method is not called from an undo/redo), uses self.node_name.
(bool) (from_redo) – True if this action is from an undo operation.
(bool) – True ifthis action is from a redo operation.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.NodeController(project, scan_list, pipeline_manager_tab, main_window)[source]¶
Bases:
QWidgetA PyQt widget for managing and editing the input/output values and parameters of a pipeline node.
This controller provides a user interface to interact with pipeline nodes, allowing users to:
View and edit node names and parameters
Filter and update plug values
Handle undo/redo operations for parameter changes
Manage subprocesses and context names
The widget is designed to integrate with a pipeline editor, providing real-time updates and synchronization between the UI and the underlying pipeline state.
- value_changed¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- __init__(project, scan_list, pipeline_manager_tab, main_window)[source]¶
Initialize the node controller widget.
This controller manages the interaction between the current project, the selected scans, and the active pipeline within the pipeline manager interface.
- Parameters:
project – The current project instance.
scan_list – lThe list of selected database files (scans).
pipeline_manager_tab – The parent pipeline manager tab widget.
main_window – The main application window.
- clearLayout(widget)[source]¶
Remove and delete all items from a widget’s layout.
- This method recursively clears the layout attached to the given widget:
QWidget items are detached from their parent.
Nested layouts are emptied and scheduled for deletion.
The layout itself is deleted once cleared.
- Parameters:
(QtWidgets.QWidget) (widget) – The widget whose layout should be cleared.
- display_filter(node_name, plug_name, parameters, process)[source]¶
Display an interactive filter widget for modifying plug values.
Creates and shows a PlugFilter dialog that allows users to filter and modify the value of a specific plug. The dialog’s value changes are automatically propagated back to update the plug through a signal connection.
- Parameters:
node_name – The name of the pipeline node containing the plug.
plug_name – The name of the plug to filter.
parameters – A tuple containing (plug_index, pipeline_instance, plug_value_type) that provides context for the plug being filtered.
process – The process instance associated with the node.
Note
The created PlugFilter is stored in self.pop_up and remains accessible until another filter is displayed or the instance is destroyed.
- display_parameters(node_name, process, pipeline)[source]¶
Display and configure parameters for the selected pipeline node.
Creates an interactive interface showing the node’s input and output parameters with editable fields. For pipeline global inputs (except ‘database_scans’), adds filter buttons for File/List_File/Any trait types.
- Special handling:
- ‘inputs’/’outputs’ nodes: Name field is read-only, displays
“Pipeline inputs/outputs”
Other nodes: Name field is editable and updates on Enter
Parameters with userlevel > 0 are hidden from the interface
- Parameters:
node_name – Identifier for the node being displayed
process – Node’s process object containing traits and their values
pipeline – Parent pipeline instance containing this node
- Side effects:
Clears and rebuilds the widget layout
Updates node_parameters_tmp in the current pipeline editor
Enables the run_pipeline_action
- get_index_from_plug_name(plug_name, in_or_out)[source]¶
Get the index of a plug by its name.
- Parameters:
(str) (in_or_out) – The name of the plug to find.
(str) – Direction of the plug ; “in” for input, “out” for output.
- Returns:
The zero-based index of the plug if found, None otherwise.
- update_node_name(new_node_name=None)[source]¶
Update the name of the currently selected node in the pipeline.
Renames a node in the pipeline dictionary, preserving all its properties and connections. If the pipeline contains a ProcessIteration, ensures the name is prefixed with ‘iterated_’.
- Parameters:
new_node_name – The new name for the node. If None, retrieves the name from the UI line edit widget. Is not None only when this method is called from an “undo/redo”)
- Emits:
value_changed: Signal with node rename details for undo/redo tracking.
Note
Does nothing if the new name already exists in the pipeline.
- rename_subprocesses(node, parent_node_name)[source]¶
Recursively update context names for a node and its subprocesses.
This method updates the context_name attribute throughout a node hierarchy, ensuring consistent naming based on the parent context. For pipeline processes, it preserves the hierarchical structure while incorporating the parent node name.
The context name follows these rules: - Pipeline processes:”Pipeline.{parent_node_name}.{additional_parts}” - Non-pipeline processes: “{parent_node_name}” - Nested subprocesses are updated recursively
- Parameters:
(Node) (node) – The node whose context name will be updated, along with all its subprocesses.
(str) (parent_node_name) – The parent node’s name to incorporate into the context naming hierarchy.
- update_parameters(process=None)[source]¶
Update parameter values in the UI from the process traits.
Synchronizes input and output line edit widgets with the current values of the process traits. If no process is provided, uses the current process if available. The ‘nodes_activation’ trait is ignored. Undefined trait values are handled gracefully.
- Parameters:
process – Optional process node whose parameters should be displayed. If None, uses self.current_process.
- update_plug_value(in_or_out, plug_name, pipeline, value_type, new_value=None)[source]¶
Update the value of a node plug and propagate changes through the pipeline.
The new value is either explicitly provided (typically during undo/redo) or read from the corresponding line edit widget and evaluated. If the update fails, the previous value is restored in the UI and a warning dialog is shown.
- Parameters:
(str) (plug_name) – Direction of the plug - “in” for input plugs, “out” for output plugs.
(str) – Name of the plug to update.
pipeline – The current pipeline instance.
(type) (value_type) – Expected type of the plug value.
(optional) (new_value) – New value for the plug. If None, reads from the line edit widget (is None except when this method is called from an undo/redo)
- Side Effects:
Updates the plug value in the pipeline node
Updates the corresponding line edit widget text
Triggers pipeline node and plug activation updates
Emits value_changed signal for undo/redo tracking
Displays status message in the main window
Shows error dialog on TraitError or OSError
Note
The method uses eval() to parse string input, which handles lists, dicts, and other Python literals. Special handling is included for ‘<undefined>’ values in dictionaries, which are converted to Undefined objects.
- update_plug_value_from_filter(plug_name, parameters, filter_res_list)[source]¶
Update a plug’s value based on filtered results.
Automatically unwraps single-item lists for convenience, setting the plug value to the item itself rather than a list containing one item.
- Parameters:
plug_name – Name of the plug to update.
parameters – Tuple of (plug_index, pipeline_instance, value_type).
filter_res_list – Filtered file list to set as the plug value.
Note
Empty lists are preserved as empty lists
Single-item lists are unwrapped to the item itself
Multi-item lists are kept as lists
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.PipelineEditorTabs(project, scan_list, main_window)[source]¶
Bases:
QTabWidgetTab widget for managing multiple pipeline editors.
This widget provides a tabbed interface for creating, editing, and managing multiple pipeline configurations. Each tab contains a PipelineEditor instance with its own undo/redo history.
- pipeline_saved¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- node_clicked¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- process_clicked¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- switch_clicked¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- __init__(project, scan_list, main_window)[source]¶
Initialize the pipeline editor tabs.
- Parameters:
project – Current project instance in the software.
scan_list – List of selected database files.
main_window – Main application window reference.
- check_modifications(current_index)[source]¶
Check if nodes in the current pipeline have been modified.
Validates modifications when switching between pipeline tabs. Skips validation for the special “add new pipeline” tab (last position).
- Parameters:
current_index – The index of the tab being switched to.
- Note:
The last tab (‘+’ button) may not have a widget, which is handled gracefully by catching AttributeError.
- close_tab(idx)[source]¶
Close a tab and its associated editor, prompting to save if modified.
Removes the specified tab and cleans up its undo/redo history. If the tab contains unsaved changes (indicated by “ *” suffix), prompts the user to save before closing. If all tabs are closed, creates a new default pipeline.
- Parameters:
idx – index of the tab to close
- emit_node_clicked(node_name, process)[source]¶
Emit the appropriate signal when a node is clicked.
Emits either process_clicked or node_clicked signal depending on whether the process parameter is a Process instance.
- Parameters:
node_name – The name of the clicked node.
process – The process associated with the node. If this is a Process instance, emits process_clicked; otherwise emits node_clicked.
- emit_pipeline_saved(filename)[source]¶
Update the current tab title and emit the pipeline_saved signal.
- Parameters:
filename – Path to the saved pipeline file.
- emit_switch_clicked(node_name, switch)[source]¶
Emit a signal when a switch is toggled.
- Parameters:
node_name – The name of the node whose switch was clicked.
switch – The Switch associated with the node.
- Emits:
switch_clicked: Signal containing the node name and the Switch.
- export_to_db_scans(node_name)[source]¶
Export the input of a filter to “database_scans” plug.
If database_scans already exists as a pipeline parameter, creates a link from database_scans to the node’s input. Otherwise, exports the node’s input parameter as database_scans at the pipeline level.
- Parameters:
node_name – Name of the node whose input should be exported.
- Note:
This method automatically updates the editor scene after modification.
- get_capsul_engine()[source]¶
Configure and return a CapsulEngine for the current pipeline.
Retrieves a CapsulEngine instance from the MIA configuration and sets up the study configuration with project-specific directories. If the current pipeline has completion attributes, they are preserved during the engine setup process.
- Returns (CapsulEngine):
Configured engine instance with study directories set to the project’s raw_data and derived_data folders.
- Note:
This method temporarily saves and restores completion engine attributes to prevent loss of configuration when switching between pipelines.
- get_current_editor()[source]¶
Return the editor corresponding to the currently selected tab.
- Returns:
Editor instance for the active tab.
- get_current_filename()[source]¶
Return the relative path of the file last saved in the current editor.
If the pipeline has never been saved, the current tab title is returned.
- Returns:
The filename for the current editor.
- get_current_pipeline()[source]¶
Return the pipeline associated with the current editor.
Returns None if no editor or scene is available.
- Returns:
The pipeline for the current editor
- get_current_tab_name()[source]¶
Return the name of the currently selected tab.
Trailing “*” and “&” characters are stripped.
- Returns:
The current tab name.
- get_editor_by_file_name(file_name)[source]¶
Return the editor associated with the given pipeline filename.
The filename corresponds to the last saved location of the pipeline.
- Parameters:
file_name – Name of the file the pipeline was last saved to.
- Returns:
The editor corresponding to the file name.
- get_editor_by_index(idx)[source]¶
Retrieve an editor widget by its tab index.
- Parameters:
idx – Zero-based index of the editor tab, or None if not found.
- Returns:
The editor widget at the specified index, or None if idx is None or if the index corresponds to the “add tab” button (last tab) or if index out of range.
- Note:
The last tab position is reserved for the “add tab” button and does not contain an editor widget.
- get_editor_by_tab_name(tab_name)[source]¶
Retrieve the editor instance associated with a specific tab name.
- Parameters:
(str) (tab_name) – The name of the tab to search for.
- Returns:
The editor instance corresponding to the specified tab name, or None if the tab is not found.
- Raises:
ValueError: If tab_name is empty or None.
KeyError: If no tab exists with the given name.
- get_filename_by_index(idx)[source]¶
Get the filename for the pipeline at the specified editor index.
Returns the relative path to the file where the pipeline was last saved. If the pipeline has never been saved, returns the tab title instead.
- Parameters:
idx – The zero-based index of the editor tab.
- Returns:
str or None. The filename or tab title if the editor exists, None if no editor exists at the given index.
- get_index_by_editor(editor)[source]¶
Find the tab index for a given editor widget.
- Parameters:
editor – The pipeline editor widget to locate.
- Returns:
The zero-based index of the editor’s tab, or None if not found.
- Note:
Searches all tabs except the last one (count() - 1).
- get_index_by_filename(filename)[source]¶
Get the index of the first tab with the specified filename.
- Parameters:
(str) (filename) – The pipeline filename to search for. Can be an absolute or relative path; will be normalized to relative.
- Return (int):
The zero-based index of the matching tab, or None if no match is found.
- Note:
Filenames are internally stored as relative paths for consistency. Only searches up to count() - 1 to exclude special tabs if any.
- get_index_by_tab_name(tab_name)[source]¶
Find the index of a tab by its name.
Searches through all tabs (excluding the last one) to find a tab matching the given name.
- Parameters:
(str) (tab_name) – The name of the tab to locate.
- Return (int):
The zero-based index of the matching tab, or None if no match is found.
- get_tab_name_by_index(idx)[source]¶
Get the clean tab name at the specified index.
Retrieves the tab text at the given index and removes formatting characters:
Qt keyboard shortcut indicators (ampersands)
Unsaved file indicators (trailing “ *”)
- Parameters:
idx – Zero-based index of the tab.
- Return (str):
The cleaned tab name, or None if the index is invalid or corresponds to the “add tab” button (last position).
- has_pipeline_nodes()[source]¶
Check if any pipeline in the editor tabs contains nodes.
Iterates through all tab widgets and checks if any pipeline editor contains nodes by examining the presence of plugs in the pipeline’s root node.
- Return (bool):
True if at least one pipeline contains nodes, False otherwise.
- load_pipeline(filename=None)[source]¶
Load a pipeline into the editor.
Opens a pipeline file in a new or existing tab. If the pipeline is already open, switches to that tab. If the current tab is not empty, creates a new tab for the pipeline.
- Parameters:
(str) (filename) – Path to the pipeline file to load. If None, prompts the user to select a file. Defaults to None.
- Return (None):
Returns early on success, or cleans up and returns on failure.
- Note:
This method is also called from open_sub_pipeline with a filename.
- load_pipeline_parameters()[source]¶
Load pipeline parameters for the current editor.
Opens a file dialog in the user’s home directory to select a JSON file containing pipeline configuration parameters, then loads those parameters into the currently active editor’s pipeline.
- new_tab()[source]¶
Create and initialize a new pipeline editor tab.
Creates a new PipelineEditor instance, connects all necessary signals, initializes its state, generates a unique tab name, and makes it the current tab. The new tab is inserted at the last tab position.
The tab name follows the pattern “New Pipeline {n}” where n is the first available index from 1 to 49.
- open_filter(node_name)[source]¶
Open a filter widget for the specified pipeline node.
Creates and displays a FilterWidget instance for filtering data associated with the given node in the current pipeline.
- Parameters:
node_name – The name of the node to apply filters to.
- open_sub_pipeline(sub_pipeline)[source]¶
Open a sub-pipeline in a new tab.
- This method locates and loads a sub-pipeline by:
Reading the process configuration to find package paths
Determining the pipeline’s source package (mia_processes or custom)
Resolving the full filesystem path to the pipeline file
Loading the pipeline in a new tab
- Parameters:
sub_pipeline – The pipeline object to open. Must have a ‘name’ attribute and ‘__module__’ attribute for package resolution.
- reset_pipeline()[source]¶
Reset and refresh the currently active editor’s pipeline display.
This triggers an asynchronous update of the pipeline view after a short delay (20ms). The update strategy depends on the editor’s view mode:
- Logical view: Displays logical representations of nodes, plugs,
and links
- Normal view: Displays standard representations of nodes, plugs,
and links
- Note:
The update is performed asynchronously via a single-shot timer to allow the UI thread to remain responsive.
- save_pipeline(new_file_name=None)[source]¶
Save the current pipeline to a file.
Performs either a “Save” or “Save As” operation depending on whether a filename is provided. Updates the tab text and emits a signal upon successful save.
- Parameters:
(str) (new_file_name) – Target filename for the pipeline. If None, triggers a “Save As” dialog. Defaults to None.
- Return (str or None):
The basename of the saved file if successful, None otherwise.
- Side Effects:
Updates the current tab text with the new filename
Emits pipeline_saved signal (only for explicit saves)
Modifies the editor’s _pipeline_filename attribute
- save_pipeline_parameters()[source]¶
Save pipeline parameters from the currently active editor.
Delegates the save operation to the current editor’s save method.
- set_current_editor_by_editor(editor)[source]¶
Set the specified editor as the currently active editor.
Activates the tab containing the given editor by switching to its index.
- Parameters:
editor – The editor instance to make active. Must be an editor that exists within one of the managed tabs.
- set_current_editor_by_file_name(file_name)[source]¶
Activate the editor tab containing the specified file.
Sets the active editor tab to the one associated with the given file name, typically used when reopening a previously saved pipeline.
- Parame file_name:
The name of the file whose editor tab should be activated.
- set_current_editor_by_tab_name(tab_name)[source]¶
Activate the editor tab with the specified name.
- Parameters:
tab_name – The display name of the tab to activate.
- set_tab_index(index)[source]¶
Activate the tab at the specified index and update the current node.
Sets the active tab, stores it as the previous index for navigation history, and updates the current node state for the newly active editor.
- Parameters:
index – The zero-based index of the tab to activate.
- update_iteration_checkbox()[source]¶
Update the iteration checkbox state based on pipeline node names.
Sets the iteration checkbox to checked if any pipeline node has ‘iterated_’ in its key name, otherwise sets it to unchecked. If no valid pipeline exists or the pipeline lacks nodes, the checkbox is unchecked.
- update_current_node()[source]¶
Update the node parameters display for the current pipeline.
Refreshes the UI to display parameters for all nodes in the current pipeline, updates user button states, iteration checkbox, and iterated tag display.
- update_history(editor)[source]¶
Update the undo/redo history for the specified editor.
Saves the editor’s current undo and redo stacks and marks the active tab as modified by appending an asterisk to its title if not already present.
- Parameters:
editor – The editor instance whose history should be saved.
- Note:
This method assumes the editor is in the currently active tab.
- update_pipeline_editors(editor)[source]¶
Update the pipeline editors after changes to the specified editor.
Synchronizes the editor’s undo/redo history and refreshes the scans list to reflect any modifications made in the pipeline editor.
- Parameters:
editor – The editor instance that was modified.
- update_scans_list()[source]¶
Update the list of database scans in every pipeline editor.
Iterates through all editor tabs (excluding the last tab, reserved for the “add tab” button) and updates the database_scans attribute for each pipeline that supports it. Also refreshes the iteration checkbox state after updating.
- Note:
Silently continues if updating a pipeline fails, logging the error without interrupting the update process for remaining pipelines.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ProcessLibraryWidget(main_window=None)[source]¶
Bases:
QWidgetWidget that manages the available Capsul’s processes in the software.
- __init__(main_window=None)[source]¶
Initialize the ProcessLibraryWidget.
- Parameters:
main_window – The current main window.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.ProcessMIA(*args, **kwargs)[source]¶
Bases:
ProcessExtends the Capsul Process class to customize execution for Mia bricks.
This class provides specialized methods for Mia bricks, including process initialization, output handling, and trait management.
Note
Type ‘ProcessMIA.help()’ for a full description of this process parameters.
Type ‘<ProcessMIA>.get_input_spec()’ for a full description of this process input trait types.
Type ‘<ProcessMIA>.get_output_spec()’ for a full description of this process output trait types.
- ignore_node = False¶
- ignore = {}¶
- key = {}¶
- __init__(*args, **kwargs)[source]¶
Initializes the process instance with default attributes.
- Parameters:
(tuple) (args) – Positional arguments passed to the parent class.
(dict) (kwargs) – Keyword arguments passed to the parent class
- _add_field_to_collections(database_schema, collection, tag_def)[source]¶
Add a new field to the specified collection in the database.
- Parameters:
database_schema – The database schema context used for modifying collections.
(str) (collection) – The name of the collection to which the field should be added.
(dict) (tag_def) –
Dictionary containing the field definition with the following keys: - ‘name’ (str): The name of the field. - ‘field_type’ (str): The type of the field. - ‘description’ (str): A description of the
field.
- ’visibility’ (str): The visibility status of
the field.
’origin’ (str): The origin of the field.
- ’unit’ (str): The unit associated with the
field.
- ’default_value’ (Any): The default value of
the field.
- _add_or_modify_tags(own_tags, current_values, initial_values, field_names)[source]¶
Add new tags or modify existing tag values in the current and initial collections.
- Parameters:
(list[dict]) (own_tags) – List of tags to be added or modified, where each tag is a dictionary with ‘name’, ‘value’, ‘description’, etc., keys.
(dict) (initial_values) – Dictionary storing the current tag values.
(dict) – Dictionary storing the initial tag values.
(set[str]) (field_names) – Set of field names that exist in the database schema.
- _all_values_identical(values_dict)[source]¶
Checks if all dictionaries in values_dict have identical content.
- Parameters:
(dict) (values_dict) – A dictionary where each value is expected to be comparable to the others.
- Return (bool):
True if all values in values_dict are identical or if the dictionary is empty, otherwise False.
- _after_run_process(run_process_result)[source]¶
Retrieve output values when the process is a NipypeProcess.
- Parameters:
run_process_result – The result of the process execution. (unused)
- _find_plug_for_output(out_file)[source]¶
Find the plug name associated with the given output file.
- Parameters:
(str) (out_file) – The output file to search for in user traits.
- Return (str | None):
The name of the plug (trait) if found, otherwise None.
- _get_relative_path(file_path, base_dir)[source]¶
Converts an absolute file path to a relative path based on the project folder.
- Parameters:
(str) (base_dir) – The absolute path of the file.
(str) – The base directory to make the path relative to.
- Return (str):
The relative file path.
- _remove_tags(tags2del, current_values, initial_values, out_file)[source]¶
Remove specified tags from value dictionaries and the database.
- Parameters:
(list[str]) (tags2del) – List of tag names to be removed.
(dict) (initial_values) – Dictionary storing the current tag values.
(dict) – Dictionary storing the initial tag values.
(str) (out_file) – The output file associated with the tags being removed.
- _resolve_inheritance_ambiguity(all_current_values, all_initial_values, in_files, node_name, plug_name, out_file)[source]¶
Resolves ambiguity when multiple input files could provide tags.
This method applies a series of resolution strategies in order: 1. If all input files have identical tag values, the first input is
selected.
If a previously stored selection rule exists, it is used.
If neither condition applies, the user is prompted to manually resolve the ambiguity, and their decision is stored for future use.
- Parameters:
(dict) (in_files) – A dictionary containing the current values for each possible input file.
(dict) – A dictionary containing the initial values for each possible input file.
(dict) – A mapping of input file indices to their corresponding file paths.
(str) (out_file) – The name of the processing node.
None) (plug_name (str |) – The name of the plug (trait) causing the ambiguity.
(str) – The output file for which inheritance needs to be resolved.
- _save_tag_values(rel_out_file, current_values, initial_values)[source]¶
Save tag values to the CURRENT and INITIAL database collections.
- Parameters:
(str) (rel_out_file) – The relative path of the output file used as the document’s primary key.
(dict) (initial_values) – Dictionary containing the current tag values to be saved.
(dict) – Dictionary containing the initial tag values to be saved.
- init_process(int_name)[source]¶
Instantiate the process attribute given a process identifier.
- Parameters:
(str) (int_name) – A process identifier used to fetch the process instance.
- load_nii(file_path, scaled=True, matlab_like=False)[source]¶
Load a NIfTI image and return its header and data, optionally adjusting for MATLAB conventions.
MATLAB and Python (in particular NumPy) treat the order of dimensions and the origin of the coordinate system differently. MATLAB uses main column order (also known as Fortran order). NumPy (and Python in general) uses the order of the main rows (C order). For a 3D array data(x, y, z) in MATLAB, the equivalent in NumPy is data[y, x, z]. MATLAB and NumPy also handle the origin of the coordinate system differently: MATLAB’s coordinate system starts with the origin in the lower left-hand corner (as in traditional matrix mathematics). NumPy’s coordinate system starts with the origin in the top left-hand corner. When taking matlab_like=True as argument, the numpy matrix is rearranged to follow MATLAB conventions. Using scaled=False generates a raw unscaled data matrix (as in MATLAB with header = loadnifti(fnii) and header.reco.data).
- Parameters:
(str) (file_path) – The path to a NIfTI file.
(bool) (matlab_like) – If True the data is scaled.
(bool) – If True the data is rearranged to match the order of the dimensions and the origin of the coordinate system in Matlab.
- relax_nipype_exists_constraints()[source]¶
Relax the ‘exists’ constraint of the process.inputs traits.
- tags_inheritance(in_file, out_file, node_name=None, own_tags=None, tags2del=None)[source]¶
Inherit and manage data tags from input file(s) to an output file.
This method handles the inheritance of metadata tags from one or more input files to an output file. It also allows adding new tags, modifying existing ones, or deleting unwanted tags in the process.
Notes: This method performs inheritance in two ways: 1. Immediate inheritance during process execution 2. Deferred inheritance by storing inheritance information for later
use during workflow generation (addresses issue #290, #310)
In ambiguous cases (multiple input files), the method will either: - Use previously stored inheritance rules - Prompt the user for a decision if no rule exists - Auto-resolve if all inputs have identical tag values
- Parameters:
dict) (own_tags (list of) –
Source of tag inheritance. Either: - A string representing a single input
file path (unambiguous case)
A dictionary mapping plug names to corresponding input file paths (ambiguous case)
(str) (node_name) – Path of the output file that will inherit the tags.
(str) – Name of the processing node in the workflow.
dict) –
Tags to be added or modified. Each dictionary must contain: - “name”: Tag identifier - “field_type”: Data type of the tag - “description”: Human-readable
description
- ”visibility”: Boolean or visibility
level
”origin”: Source of the tag
- ”unit”: Unit of measurement
(if applicable)
”default_value”: Default value
”value”: Current value to set
str) (tags2del (list of) – Tags to be deleted from the output file.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.PopUpInheritanceDict(values, node_name, plug_name, iterate)[source]¶
Bases:
QDialogDialog for selecting tag inheritance between input and output plugs.
This dialog allows users to select which input plug should pass its tags to a specific output plug, or to choose to ignore tag inheritance altogether.
- Methods:
_setup_buttons: Set up action buttons for the dialog
_setup_radio_buttons: Set up radio buttons for each input option
ok_clicked: Event when ok button is clicked
okall_clicked: Event when Ok all button is clicked
on_clicked: Event when radiobutton is clicked
ignoreall_clicked: Event when ignore all plugs button is clicked
ignore_clicked: Event when ignore button is clicked
ignore_node_clicked: Event when ignore all nodes button is clicked
- __init__(values, node_name, plug_name, iterate)[source]¶
Initialize the inheritance selection dialog.
- Parameters:
(dict) (values) – Dict mapping input names (keys) to their paths (values)
(str) (plug_name) – Name of the current node
(str) – Name of the current output plug
(bool) (iterate) – Boolean indicating if the choice applies to iterations
- _setup_buttons(node_name, plug_name, layout)[source]¶
Set up action buttons for the dialog.
- Parameters:
node_name – Name of the current node
plug_name – Name of the current output plug
layout – Layout to add the buttons to
- _setup_radio_buttons(values, layout)[source]¶
Set up radio buttons for each input option.
- Parameters:
values – Dict mapping input names to their paths
layout – Layout to add the radio buttons to
- ok_clicked()[source]¶
Handle OK button click.
Accepts the dialog with current selection applied to current plug.
- okall_clicked()[source]¶
Handle ‘OK for all output plugs’ button click.
Accepts the dialog with current selection applied to all output plugs.
- on_clicked()[source]¶
Handle radio button selection event.
Updates the currently selected input value and key.
- ignoreall_clicked()[source]¶
Handle ‘Ignore for all output plugs’ button click.
Accepts the dialog with tag inheritance ignored for all output plugs.
- populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.update_auto_inheritance(node, job=None)[source]¶
Automatically infer database tags for output parameters from input parameters.
- Single input case: When only one input parameter has a database
value, all outputs inherit from this input.
- Multiple inputs with same value: When multiple inputs exist but
have identical database values, fallback to single input behavior.
- Ambiguous case: When multiple inputs have different database
values, track all possible inheritance sources for user resolution.
The process attribute auto_inheritance_dict is filled with these values. It’s a dict with the shape:
{output_filename: <input_spec>}
output_filename is the relative filename in the database
<input_spec> can be:
a string: filename
a dict:
{input_param: input_filename}
auto_inheritance_dict is built automatically, and is used as a fallback to
ProcessMIAinheritance_dict, built “manually” (specialized for each process) in theProcessMIA.list_outputs()when the latter does not exist, or does not specify what an output inherits from.If ambiguities still subsist, the Mia infrastructure will ask the user how to solve them, which is not very convenient, and error-prone, thus should be avoided.
- Parameters:
node – The node (typically a process or process node) whose inputs and outputs are analyzed for tag inheritance.
job – An optional job object containing parameter values to override or populate the node’s inputs and outputs. Defaults to None.
- Return (dict or None):
Auto-inheritance mapping if successful and no job provided, None if no inheritance can be determined or job is provided (in which case the job object is updated in-place).
- populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.protected_logging()[source]¶
Context manager that preserves logging configuration across soma-workflow interference.
This context manager creates a snapshot of all logger configurations before execution and intelligently restores them afterwards. It preserves any new handlers or filters that were added during execution while ensuring original configurations are restored.
- The protection covers:
All named loggers in the logger hierarchy
The root logger
Handler and filter lists (with intelligent merging)
Logger levels, disabled state, and propagation settings
- Usage:
- with protected_logging():
# Code that might interfere with logging some_workflow_operation() # Any new handlers/filters added here are preserved
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.PipelineManagerTab(project, scan_list, main_window)[source]¶
Bases:
QWidgetWidget that handles the Pipeline Manager tab.
- item_library_clicked¶
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- __init__(project, scan_list, main_window)[source]¶
Initialize the Pipeline Manager tab.
The Pipeline Manager provides a comprehensive interface for creating, editing, and executing data processing pipelines. It integrates process libraries, pipeline editors, node controllers, and iteration tables to manage complex data analysis workflows.
- Parameters:
project – The current project instance containing database and configuration
scan_list – List of selected database files to process. If None or empty, defaults to all documents in the current collection
main_window – Main application window instance for UI integration
- _register_node_io_in_database(job, node, pipeline_name='', history_id='')[source]¶
Register node input and output values in the database.
This method processes the inputs and outputs of a given node, associates them with a job, and updates the database with the appropriate values. It handles leaf processes, user-defined traits, and completion attributes, ensuring that initialization data is recorded correctly.
- Parameters:
job – Job object containing parameter values and unique identifier (UUID).
node – Node instance (Process, Pipeline, or custom node) to register.
optional) (history_id (str,) – Name of the containing pipeline, if any.
optional) – Database history entry identifier. Defaults to an empty string.
Note
Pipeline and PipelineNode instances are skipped as only leaf processes produce meaningful output data.
- _set_anim_frame()[source]¶
Update the pipeline status action icon with the current animation frame.
This method serves as a callback that synchronizes the animated movie’s current frame with the status action’s icon, creating a smooth animated icon effect in the UI.
Note: This method is typically connected to QMovie’s frameChanged signal to automatically update the icon as the animation progresses.
- _should_register_plug(process, plug_name: str) bool[source]¶
Determine if a plug should be registered in the database.
- Parameters:
process – Process instance
(str) (plug_name) – Name of the plug to check
- Returns:
True if plug should be registered, False otherwise
- add_plug_value_to_database(p_value, brick_id, history_id, node_name, plug_name, full_name, job, trait, inputs, attributes)[source]¶
Add plug value(s) to the database with proper metadata and inheritance.
This method handles adding file-based plug values to a project database, managing inheritance of metadata tags from input files, and resolving ambiguities when multiple parent files exist.
- Parameters:
p_value – The plug value - either a single file path (str) or list of file paths. Can also be special values like “<undefined>” or Undefined.
(str) (full_name) – UUID of the brick in the database.
(str) – UUID of the processing history in the database.
(str) – Name of the processing node.
(str) – Name of the specific plug/parameter.
(str) – Full hierarchical name including parent bricks. Equals node_name if no parent exists.
(Job) (job) – Job object containing the plug, may have inheritance dictionaries.
(Trait) (trait) – Handler for the plug trait or sub-trait for list elements. Used to validate value types (file vs non-file).
(dict) (attributes) – Input parameter values for the process/node.
(dict) – Completion engine attributes to be applied to all outputs.
Notes
Recursively processes list values by calling itself on each element
Only processes file-type traits within the project folder
Handles tag inheritance from parent files using inheritance_dict and auto_inheritance_dict from the job
May prompt user to resolve ambiguous inheritance scenarios
Automatically determines file types based on extensions
Updates both CURRENT and INITIAL database collections
- Raises:
May raise database-related exceptions during document operations.
- ask_iterated_pipeline_plugs(pipeline)[source]¶
Display a configuration dialog for pipeline plug iteration and database connections.
This method opens an interactive dialog that allows users to configure how pipeline plugs (inputs and outputs) should be handled during execution. Users can specify:
Which plugs should be iterated over during pipeline execution
Which input plugs should be connected to database filters
Interactive dependency management (database connection requires iteration)
The dialog presents a grid layout with checkboxes for each available plug:
Iteration checkbox: Mark plug for iteration during execution
Database checkbox: Connect input plug to database filter (inputs only)
- Behavioral constraints:
Database connection automatically enables iteration
Disabling iteration automatically disables database connection
Only file-compatible plugs can connect to database filters
Certain system plugs are excluded from configuration
- Parameters:
pipeline – Pipeline object containing plugs to be configured
- Returns:
- Optional[Tuple[List[str], List[str]]]: A tuple containing:
iterated_plugs: List of plug names marked for iteration
database_plugs: List of plug names connected to database
None if the user cancels the dialog.
- build_iterated_pipeline()[source]¶
Build an iteration pipeline wrapper around the current pipeline.
This method creates a new pipeline that iterates over the current pipeline, allowing batch processing of multiple datasets. The process involves:
Interactive selection of plugs to iterate over and database connections
Preprocessing of list-type plugs with ReduceNode to handle nested lists
Creation of an iterative pipeline using the CAPSUL engine
Addition of Input_Filter nodes for database-connected plugs
Proper linking of database_scans parameter across all filters
The method handles both single processes and full pipelines, converting single processes into single-node pipelines when necessary.
- Returns:
Pipeline or None: The new iteration pipeline if successful, None if aborted
- Raises:
ValueError – If Input_Filter process cannot be found in the library.
Notes
Modifies pipeline completion settings for database plugs
Sets the editor’s iterated flag to True upon successful completion
Handles context name parsing for proper iteration naming
- check_requirements(environment='global')[source]¶
Check and return the configuration of a pipeline based on its requirements.
This method iterates through the nodes in the pipeline, gathers their requirements, and determines the appropriate configuration for each node in the specified environment. It uses the settings from the study configuration engine to select configurations that match the requirements.
- Parameters:
(str) (environment) – The target environment for checking configurations. Defaults to “global”.
- Return (dict):
A dictionary mapping each pipeline node to its selected configuration.
- cleanup_older_init()[source]¶
Clean up data browser state and remove orphaned files.
- This method performs the following cleanup operations:
Removes non-existent entries from the data browser for each brick
Cleans up orphaned non-existing files from the project
Clears the brick and node lists
Updates the data browser table display
Note: The table update is performed asynchronously using QtThreadCall to ensure UI responsiveness.
- complete_pipeline_parameters(pipeline=None)[source]¶
Complete pipeline parameters using Capsul’s completion engine.
This method utilizes Capsul’s completion engine to automatically populate the parameters of a pipeline based on a set of attributes. These attributes can be retrieved from an associated database. If no pipeline is specified, the current pipeline or process is used.
- Parameters:
(Pipeline) (pipeline) – The pipeline object to be completed. If not provided, the method retrieves the current pipeline or process.
Notes: The completion process relies on Capsul’s ProcessCompletionEngine to automatically determine appropriate parameter values.
- controller_value_changed(signal_list)[source]¶
Update history when a node or plug value changes.
This method processes change signals from the pipeline editor and maintains an undo history for user actions. It handles two types of changes:
- Node name updates: Updates the node name and refreshes the
pipeline view while preserving the current view state.
- Plug value updates: Records parameter changes while filtering
out protected parameters, empty values, and system-generated changes to avoid cluttering the undo history.
- Parameters:
signal_list –
- A list containing change information with the
first element being the change type (“node_name” or “plug_value”), followed by context-specific data:
- For “node_name”: [“node_name”, ProcessNode_object,
new_node_name, old_node_name]
- For “plug_value”: [“plug_value”, node_name, old_value,
plug_name, plug_type, new_value]]
- displayNodeParameters(node_name, process)[source]¶
Display the node controller interface for the specified node.
This method configures and shows the node parameter interface when a user clicks on a node in the pipeline editor. It updates the scroll area widget to display the node controller with the current pipeline context.
- Parameters:
node_name – The name/identifier of the selected node.
process – The process instance associated with the selected node.
- finish_execution()[source]¶
Handle pipeline execution completion and update UI state.
This callback is invoked after a pipeline execution completes, whether successfully or with errors. The method performs comprehensive cleanup and user feedback operations:
Disables pipeline control actions during cleanup
Disconnects progress worker signals to prevent memory leaks
Checks execution status and handles WorkflowExecutionError/RuntimeError
Updates status bar with clear success/failure messages
Sets appropriate visual status icon (green checkmark or red cross)
Cleans up progress indicators and re-enables pipeline actions
Updates node controller parameters for next execution
The method ensures proper cleanup regardless of execution outcome and provides comprehensive user feedback through status messages and visual indicators.
- Raises:
WorkflowExecutionError: When pipeline execution fails RuntimeError: When execution is aborted before running
- garbage_collect()[source]¶
Clean up obsolete data and maintain database consistency.
- This method performs comprehensive cleanup operations including:
Processing finished pipeline executions with error protection
Removing orphaned files and historical data entries
Refreshing the data browser table display
Resetting pipeline editor initialization state if applicable
Updating UI button states to reflect current system status
The cleanup operations ensure the application remains performant and maintains data integrity across user sessions.
- get_capsul_engine()[source]¶
Retrieve and configure a Capsul engine from the pipeline editor.
This method obtains a CapsulEngine object from the current pipeline editor tabs and configures it using the Mia configuration settings.
- Return (CapsulEngine):
A configured Capsul engine instance ready for pipeline execution, with settings applied from the Mia config object.
- get_pipeline_or_process(pipeline=None)[source]¶
Get the pipeline or its single unconnected process node.
When a pipeline contains only one process node with no connections, this method returns the process directly instead of the pipeline wrapper. This simplifies GUI workflows where single processes can act as pipelines.
- Parameters:
(Pipeline) (pipeline) – Optional pipeline to evaluate. If None, uses the currently selected pipeline from the editor GUI.
- Return (Pipeline | Process):
The process node if pipeline contains a single unconnected process, otherwise the pipeline itself.
- get_missing_mandatory_parameters()[source]¶
Find missing mandatory parameters across all pipeline nodes.
Checks each node in the pipeline for missing mandatory parameters, accounting for workflow job parameter overrides and temporary values.
- Return (list[str]):
Parameter names that are missing, formatted as either ‘parameter_name’ for pipeline root or ‘node.parameter_name’ for other nodes.
Note
Parameters with non-null values in the workflow job dictionary are not considered missing, even if undefined at the node level.
- initialize()[source]¶
Initialize the pipeline after cleaning up any previous initialization.
- This method performs the following operations:
Sets a wait cursor to indicate processing
Cleans up any previous initialization if needed
Resets internal state variables
Attempts to initialize the pipeline
Updates the UI with the results
Restores the normal cursor
The method handles initialization errors gracefully by logging warnings and updating the status bar with error messages.
- Side Effects:
Modifies cursor appearance during execution
Updates pipeline editor tabs and node parameters
May display error messages in the status bar
Sets self.init_clicked to True upon completion
- init_pipeline(pipeline=None, pipeline_name='')[source]¶
Initialize the current pipeline in the pipeline editor.
- This method:
Retrieves and configures the pipeline or sub-pipeline.
Generates and validates the workflow.
Checks requirements (FSL, AFNI, ANTS, Matlab, MRtrix, SPM).
Verifies that mandatory inputs/outputs are properly set.
Records initialization results in the project database.
Updates the status bar and displays warnings when needed.
- Parameters:
Process) (pipeline (Pipeline,) – The pipeline or process instance to initialize. If None, the main pipeline is retrieved.
(str) (pipeline_name) – The name of the parent pipeline, if applicable.
- Return (bool):
True if the pipeline was successfully initialized, False otherwise.
- layout_view()[source]¶
Initialize the layout and toolbar for the pipeline manager tab.
This method sets up the main diagram editor window, configures the scroll area, builds the toolbar with pipeline actions, and arranges widgets in splitters and layouts for the pipeline editor interface.
- loadParameters()[source]¶
Load pipeline parameters into the current pipeline of the editor.
This method refreshes the pipeline editor by loading the stored parameters and then updates the node controller accordingly.
- loadPipeline()[source]¶
Load a pipeline into the pipeline editor.
This method initializes the pipeline editor with the selected pipeline.
- postprocess_pipeline_execution(pipeline=None)[source]¶
Operations to be performed after a run has been completed.
It can be called either within the run procedure (the user clicks on the “run” button and waits for the results), or after a disconnetion / reconnection of the client app: the user clicks on “run” with distributed/remote execution activated, then closes the client Mia. Processing takes place (possibly remotely) within a soma-workflow server. Then the user runs Mia again, and we have to collect the outputs of runs which happened (finished) while we were disconnected.
Such post-processing includes database indexing of output data, and should take into account not only the current pipeline, but all past runs which have not been postprocessed yet.
When called with a pipeline argument, it only deals with this one.
The method can be called from within a worker run thread, thus has to be thread-safe.
- Parameters:
(Pipeline) (pipeline) – The pipeline to postprocess. If not provided, the method will use self.last_run_pipeline or fetch the currently selected pipeline from the pipeline editor.
- redo()[source]¶
Redo the last undone action on the current pipeline editor
- Supported redoable actions:
add_process
delete_process
export_plug
export_plugs
remove_plug
update_node_name
update_plug_value
add_link
delete_link
- register_completion_attributes(pipeline)[source]¶
Register completion attributes for a given pipeline in the project database.
This method retrieves attribute values from the pipeline’s completion engine and records them in the project database. Only attributes corresponding to existing fields (tags) in the database schema are stored. For each pipeline parameter that resolves to a file path within the project directory, the attributes are associated with both the current and initial collections.
- Parameters:
(Pipeline) (pipeline) – The pipeline whose completion attributes should be registered. The pipeline must provide a completion engin capable of exporting its attributes
- remove_progress()[source]¶
Remove and clean up the progress widget.
Safely removes the progress widget from the UI and frees associated resources. This method handles the complete lifecycle cleanup of the progress widget, nsuring proper Qt object disposal and memory management.
Note
This method is idempotent - it can be safely called multiple times without side effects if the progress widget has already been removed.
- runPipeline()[source]¶
Execute the current pipeline in the pipeline editor.
This method initializes and runs the active pipeline with the following steps:
Initializes the pipeline and validates prerequisites
Sets up pipeline metadata and UI state
Configures soma-workflow connection (if enabled)
Starts pipeline execution with progress tracking
The method handles both local and remote execution via soma-workflow, displays progress animation, and manages UI state during execution.
- saveParameters()[source]¶
Saves the parameters of the currently active pipeline in the pipeline editor.
- savePipeline(skip_overwrite_warning: bool = False)[source]¶
Save the current pipeline in the pipeline editor.
- This method handles three scenarios:
Save to existing file with overwrite confirmation (unless skipped)
Save to existing file without confirmation when warning is skipped
Save as new file when no filename exists or file is in protected directory
- Parameters:
(bool) (skip_overwrite_warning) – If True, skip the overwrite confirmation dialog when saving to an existing file. Defaults to False.
- Side Effects:
Updates the main window status bar with save operation messages
May display a confirmation dialog for file overwriting
Saves the pipeline to disk via pipelineEditorTabs.save_pipeline()
Note
Files in “mia_processes/mia_processes” directory are treated as protected and will trigger a “save as” operation regardless of other conditions.
- save_pipeline_as()[source]¶
Save the current pipeline under a new name via ‘Save As’ dialog.
This method displays a status message during the save operation and provides user feedback based on the save result. The pipeline name in the success message is capitalized and stripped of its file extension for display.
- show_status()[source]¶
Display the execution status window with runtime information.
Opens a new status widget window that shows the last execution run details, including runtime statistics, error messages, and other diagnostic information. The widget is stored as an instance attribute for potential future reference.
- stop_execution()[source]¶
Interrupt pipeline execution gracefully.
This method signals the pipeline to stop its current execution flow. The interruption is handled asynchronously through the progress tracker, allowing any in-flight operations to complete safely before termination.
- undo()[source]¶
Undo the last action performed on the current pipeline editor.
This method reverts the most recent undoable action by popping it from the undo stack and performing the inverse operation. The method handles all reversible operations in the pipeline editor interface.
- Supported undoable actions:
add_process: Remove the added process node
delete_process: Restore the deleted process node with its links
export_plug/export_plugs: Remove the exported pipeline plug(s)
remove_plug: Restore the removed plug(s) and reconnect links
update_node_name: Revert node name change
update_plug_value: Restore previous plug value
add_link: Remove the added connection
delete_link: Restore the deleted connection
The method automatically updates the pipeline state and node parameters after performing the undo operation.
Note
Does nothing if no undoable actions are available in the stack.
- update_inheritance(job, node)[source]¶
Update the inheritance dictionary for a process node in a pipeline execution.
This method manages metadata inheritance by updating a job’s inheritance_dict based on the node’s execution context and the project’s inheritance history. The inheritance dictionary defines relationships between input and output parameters, enabling propagation of database tags and other metadata properties through the pipeline.
- The method follows this precedence order:
Project-specific inheritance history (if matching parameters are found)
Process-level inheritance dictionary (fallback)
- Parameters:
job – Job execution object containing param_dict (parameter name->value mapping) and inheritance_dict (will be updated by this method)
node – Process node being evaluated (ProcessNode or Process object). Used to determine inheritance rules via context_name or name attribute.
- Note: For Pipeline nodes, the method strips the “Pipeline.” prefix
from the context_name to match against inheritance history keys.
- update_node_list(brick=None)[source]¶
Update the node list with unique nodes from workflow jobs.
Iterates through all jobs in the current workflow and adds their associated process nodes to the node list, ensuring no duplicates. Only jobs with a ‘process’ attribute are considered.
- Parameters:
brick – Reserved for future use. Currently unused parameter that could be used for filtering or extending functionality.
Note
This method modifies self.node_list in-place by extending it with new unique nodes. Jobs without a ‘process’ attribute are silently skipped.
- updateProcessLibrary(filename)[source]¶
Update the library of processes when a pipeline is saved.
- This method performs the following operations:
Renames the Pipeline class in the saved file to match the filename
Updates the __init__.py file to include the new import
Refreshes the module in sys.modules if it already exists
Adds the module to the process library
- Parameters:
filename – Path to the pipeline file that has been saved
Note
Only processes saved in the User_processes directory are added to the library.
- update_project(project)[source]¶
Update the project reference across all relevant components.
This method propagates the project instance to all components that require access to project data, ensuring consistency across the application state. It also updates the node controller’s visible tags from the project database.
- Parameters:
project – The current project instance containing application data and database connections.
Note
This method has the side effect of setting ProcessMIA.project as a class attribute, which is required for Mia brick functionality.
- update_scans_list(iteration_list, all_iterations_list)[source]¶
Update the user-selected list of scans based on iteration settings.
This method handles the transition between regular and iterated pipeline modes, updating the scan list accordingly. When iteration mode is enabled, it builds an iterated pipeline and uses the full iterations list. When disabled, it extracts the pipeline from the iteration node and reverts to the original scan list.
- Parameters:
iteration_list – Current list of scans in the iteration table (unused in current implementation)
all_iterations_list – Complete list of all iteration scan lists
- Side Effects:
Updates UI button states
May modify the current pipeline (switch between regular/iterated)
Updates scan lists for both iteration table and pipeline editor
May update node parameters display
Falls back to database scan list if pipeline scan list is empty
- update_user_buttons_states(index=-1)[source]¶
Update the visibility and state of pipeline-related UI actions.
Updates the enabled/disabled state of pipeline actions (Run, Save, Save As) based on the current pipeline state. The method evaluates the pipeline associated with either the specified editor or the current active editor.
- Button states updated:
Run Pipeline: Disabled when pipeline is empty or None
Save Pipeline & Save As: Enabled only when pipeline is not iterated
- Parameters:
(int) (index) – Index of the specific editor to check. If -1 (default), uses the currently active editor.
Note
If the specified editor doesn’t exist or has no scene, the pipeline is treated as None and buttons are disabled accordingly.
- update_user_mode()[source]¶
Update widget/action visibility and functionality based on user mode configuration.
- In user mode:
Disables pipeline saving (process library unavailable)
Disables pipeline overwriting
Disables project deletion
Also synchronizes user level across pipeline editor and node controller components.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.RunProgress(pipeline_manager, settings=None)[source]¶
Bases:
QWidgetA Qt widget for displaying and managing pipeline execution progress.
This widget provides a visual progress indicator and manages the lifecycle of pipeline execution through a worker thread. It handles user feedback, error reporting, and resource cleanup.
The widget integrates with a PipelineManagerTab to control pipeline execution, providing real-time feedback and graceful error handling.
Notes
- pipeline_manager (PipelineManagerTab):
The pipeline manager instance that handles the pipeline operations.
- progressbar (QProgressBar):
The progress bar widget to show execution progress.
- worker (RunWorker):
The worker thread that runs the pipeline.
- MIN_PROGRESS_WIDTH = 350¶
- AUTO_CLOSE_DELAY_MS = 2000¶
- __init__(pipeline_manager, settings=None)[source]¶
Initialize the RunProgress widget with a progress bar and worker thread.
- Parameters:
(PipelineManagerTab) (pipeline_manager) – A PipelineManagerTab instance responsible for managing the pipeline.
(dict) (settings) – A dictionary of settings to customize pipeline iteration, default is None.
- _determine_completion_message()[source]¶
Analyze execution results and determine appropriate user message.
- Returns:
Dictionary containing message box configuration with keys: ‘icon’, ‘title’, and ‘text’.
- _setup_ui() None[source]¶
Set up the user interface for the widget.
This method initializes an indeterminate progress bar with a predefined minimum width and places it inside a horizontal box layout, which is then assigned to the widget.
- _show_completion_message(icon, title, text)[source]¶
Display execution completion message with auto-close timer.
- Parameters:
(QMessageBox.Icon) (icon) – Message box icon type.
(str) (text) – Dialog window title.
(str) – Message content to display.
- cleanup()[source]¶
Clean up resources and prepare for widget destruction.
Ensures the worker thread completes, disconnects signals, and releases resources. Should be called before widget destruction.
Note
This method blocks until the worker thread finishes.
- end_progress()[source]¶
Handle completion of pipeline execution and show results.
Called automatically when the worker thread finishes. Restores the application cursor, evaluates execution status, and displays an appropriate message to the user.
The message dialog automatically closes after a brief delay.
- start()[source]¶
Starts the worker thread to begin the pipeline execution process.
This method initiates the worker thread by calling its start method, which in turn triggers the execution of the pipeline.
- stop_execution()[source]¶
Stops the execution of the pipeline by signaling the worker to interrupt.
This method sets the interrupt_request flag to True within the worker thread’s lock, which tells the worker to stop its execution. The method can be used to cancel the pipeline execution at any point during its run.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.RunWorker(pipeline_manager)[source]¶
Bases:
QThreadWorker thread for executing a pipeline in the background.
This class runs a pipeline or process using a separate thread to avoid blocking the GUI. Execution can be interrupted at any time by setting the
interrupt_requestflag while holdinglock.- __init__(pipeline_manager)[source]¶
Initialize the worker thread for pipeline execution.
- Parameters:
(PipelineManager) (pipeline_manager) – The manager responsible for configuring, running, and monitoring the pipeline execution.
- _check_interrupt(engine=None) bool[source]¶
Check whether an interrupt has been requested.
If an interrupt is detected, log the event and optionally stop the execution engine.
- Parameters:
(CapsulEngine) (engine) – Execution engine to interrupt if running.
- Return (bool):
True if an interrupt was requested, False otherwise.
- _disable_nipype_copy(proc)[source]¶
Recursively check and disable the copy flag for Nipype processes in the pipeline.
This function traverses the pipeline’s nodes and checks if the nodes contain a NipypeProcess. If it does, it sets the activate_copy flag to False. The recursion handles nested pipelines.
- Parameters:
proc – A Pipeline or NipypeProcess instance.
- run()[source]¶
Run the pipeline in a background thread.
The method prepares the pipeline, disables unnecessary copy flags for Nipype processes, rebuilds workflows when file transfer or path translation is required, and starts execution using the Capsul engine. The status is monitored until the workflow completes or an interrupt is requested.
- class populse_mia.user_interface.pipeline_manager.pipeline_manager_tab.StatusWidget(pipeline_manager)[source]¶
Bases:
QWidgetA widget that displays the current or last pipeline execution status
along with logs and an optional Soma-Workflow monitoring panel.
- Features:
Shows the last known pipeline status (or a default message if unavailable).
Displays the execution log of the most recent run.
Provides a toggleable Soma-Workflow monitoring section.
- __init__(pipeline_manager)[source]¶
Initializes the execution status window for monitoring pipeline runs.
This window displays the latest pipeline execution status, the execution log, and provides an optional section for Soma-Workflow monitoring. The log is automatically populated from the pipeline manager’s last recorded run.
- Parameters:
pipeline_manager – The pipeline manager instance containing