Pipeline

This module contains the Pipeline class and related components for the EZStitcher pipeline architecture.

For conceptual explanation, see Pipeline. For information about directory structure, see Directory Structure.

Pipeline

class ezstitcher.core.pipeline.Pipeline(steps=None, name=None)

A sequence of processing steps that are executed in order.

For detailed information on pipeline construction, including best practices and different approaches, see Pipeline.

Parameters:
  • steps (list of Step) – Initial list of steps

  • name (str) – Human-readable name for the pipeline

add_step(step)

Add a step to the pipeline. See Pipeline for best practices on when to use this method versus providing all steps during initialization.

Parameters:

step (Step) – The step to add

Returns:

Self, for method chaining

Return type:

Pipeline

run(input_dir=None, output_dir=None, well_filter=None, microscope_handler=None, orchestrator=None, positions_file=None)

Execute the pipeline.

This method can either:

  1. Take individual parameters and create a ProcessingContext internally, or

  2. Take a pre-configured ProcessingContext object (when called from PipelineOrchestrator)

The orchestrator parameter is required as it provides access to the microscope handler and other components.

Parameters:
  • input_dir (str or Path) – Optional input directory override

  • output_dir (str or Path) – Optional output directory override

  • well_filter (list) – Optional well filter override

  • microscope_handler (MicroscopeHandler) – Optional microscope handler override

  • orchestrator (PipelineOrchestrator) – PipelineOrchestrator instance (required)

  • positions_file (str or Path) – Optional positions file to use for stitching

Returns:

The results of the pipeline execution

Return type:

dict

input_dir

Get or set the input directory for the pipeline.

Type:

Path or None

output_dir

Get or set the output directory for the pipeline.

Type:

Path or None

ProcessingContext

class ezstitcher.core.pipeline.ProcessingContext(input_dir=None, output_dir=None, well_filter=None, config=None, **kwargs)

Maintains state during pipeline execution.

The ProcessingContext holds input/output directories, well filter, configuration, and results during pipeline execution. It serves as a communication mechanism between steps in a pipeline, allowing each step to access and modify shared state.

For detailed information about how the context is used for communication between steps, see Pipeline Context in the Pipeline documentation.

Parameters:
  • input_dir (str or Path) – The input directory

  • output_dir (str or Path) – The output directory

  • well_filter (list) – Wells to process

  • config (dict) – Configuration parameters

  • **kwargs

    Additional context attributes that will be added to the context

input_dir

The input directory for processing.

Type:

Path or None

output_dir

The output directory for processing results.

Type:

Path or None

well_filter

List of wells to process.

Type:

list or None

config

Configuration parameters.

Type:

dict

results

Processing results.

Type:

dict

Step Classes

For documentation on step classes like ImageStitchingStep, see Steps.