lw_pipeline.register_output#

class lw_pipeline.register_output(name, description='', enabled_by_default=True, group=None, check_exists=False, extension=None, suffix=None, use_bids_structure=None, custom_dir=None, **extra_path_params)[source]#

Bases:

Register a method as an optional output generator.

This allows steps to define multiple outputs that can be selectively generated based on CLI arguments or config settings.

Parameters:
  • name (str) – Name of the output (used for CLI selection, e.g., “plot”, “stats”).

  • description (str, optional) – Human-readable description of the output.

  • enabled_by_default (bool, optional) – Whether this output is generated by default. Default is True.

  • group (str, optional) – Optional group name for categorization (future use).

  • check_exists (bool, optional) – If True, check if output file exists before running the method. Respects overwrite_mode setting. Prevents expensive computations when output already exists. Default is False.

  • extension (str, optional) – Default file extension (e.g., ‘.png’, ‘.csv’). Used for both existence checking and as default when saving.

  • suffix (str, optional) – Default BIDS suffix. Used for both checking and saving.

  • use_bids_structure (bool, optional) – Default for BIDS path structure.

  • custom_dir (str or Path, optional) – Default custom output directory.

  • **extra_path_params (dict) – Additional default path parameters (e.g., datatype, processing).

Returns:

Decorated function.

Return type:

callable

Examples

>>> class MyStep(Pipeline_Step):
...     @register_output(
...         "expensive_plot",
...         "Channel visualization",
...         check_exists=True,
...         extension=".png"
...     )
...     def generate_plot(self):
...         # Skipped if file exists and overwrite_mode='never'
...         data = expensive_computation()
...         fig = create_plot(data)
...         # extension=".png" used automatically
...         self.output_manager.save_figure(fig, "expensive_plot")
__init__(**kwargs)#