Steps
This module contains the Step class and all step implementations for the EZStitcher pipeline architecture, including the base Step class and various step types like ZFlatStep, FocusStep, CompositeStep, PositionGenerationStep, and ImageStitchingStep.
For conceptual explanation, see Step. For information about function handling in steps, see Function Handling. For information about directory structure, see Directory Structure.
Step
- class ezstitcher.core.steps.Step(func, variable_components=None, group_by=None, input_dir=None, output_dir=None, well_filter=None, name=None)
A processing step in a pipeline.
For detailed information about step parameters and their usage, see Step Parameters in the Step documentation.
For information about variable components, see Variable Components in the Step documentation.
For information about the group_by parameter, see Group By in the Step documentation.
For best practices when using steps, see Best Practices documentation.
- Parameters:
func (callable, tuple, list, or dict) – The processing function(s) to apply. Can be a single callable, a tuple of (function, kwargs), a list of functions or function tuples, or a dictionary mapping component values to functions or function tuples.
variable_components (list) – Components that vary across files (e.g., ‘z_index’, ‘channel’)
group_by (str) – How to group files for processing (e.g., ‘channel’, ‘site’)
input_dir (str or Path) – The input directory
output_dir (str or Path) – The output directory
well_filter (list) – Wells to process
name (str) – Human-readable name for the step
- process(context)
Process the step with the given context.
- Parameters:
context (
ProcessingContext) – The processing context- Returns:
The updated processing context
- Return type:
PositionGenerationStep
- class ezstitcher.core.steps.PositionGenerationStep(name='Position Generation', input_dir=None, output_dir=None)
A specialized Step for generating positions.
This step takes processed reference images and generates position files for stitching. It stores the positions file in the context for later use by ImageStitchingStep.
- Parameters:
- process(context)
Generate positions for stitching and store them in the context.
- Parameters:
context (
ProcessingContext) – The processing context- Returns:
The updated processing context
- Return type:
ImageStitchingStep
- class ezstitcher.core.steps.ImageStitchingStep(name='Image Stitching', input_dir=None, positions_dir=None, output_dir=None)
A specialized Step for stitching images using position files.
This step stitches images using position files. It works with the PositionGenerationStep to create complete stitched images from individual tiles.
- Parameters:
name (str) – Name of the step (optional)
input_dir (str or Path) – Input directory containing images to stitch (optional)
positions_dir (str or Path) – Directory containing position files (optional, can be provided in context)
output_dir (str or Path) – Output directory for stitched images (optional)
- process(context)
Stitch images using the positions file from the context.
This step: 1. Locates the positions file for the current well 2. Loads images according to the positions file 3. Stitches the images together 4. Saves the stitched image to the output directory
- Parameters:
context (
ProcessingContext) – The processing context- Returns:
The updated processing context
- Return type:
ZFlatStep
- class ezstitcher.core.steps.ZFlatStep(method='max', input_dir=None, output_dir=None, well_filter=None)
Specialized step for Z-stack flattening.
This step performs Z-stack flattening using the specified method. It pre-configures variable_components=[‘z_index’] and group_by=None.
FocusStep
- class ezstitcher.core.steps.FocusStep(focus_options=None, input_dir=None, output_dir=None, well_filter=None)
Specialized step for focus-based Z-stack processing.
This step finds the best focus plane in a Z-stack using FocusAnalyzer. It pre-configures variable_components=[‘z_index’] and group_by=None.
- Parameters:
focus_options (dict, optional) –
Dictionary of focus analyzer options: - metric: Focus metric. Options: “combined”, “normalized_variance”,
”laplacian”, “tenengrad”, “fft” or a dictionary of weights (default: “combined”)
input_dir (str or Path, optional) – Input directory
output_dir (str or Path, optional) – Output directory
well_filter (list, optional) – Wells to process
CompositeStep
- class ezstitcher.core.steps.CompositeStep(weights=None, input_dir=None, output_dir=None, well_filter=None)
Specialized step for creating composite images from multiple channels.
This step creates composite images from multiple channels with specified weights. It pre-configures variable_components=[‘channel’] and group_by=None.