Coverage for openhcs/constants/input_source.py: 100.0%
6 statements
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-14 05:57 +0000
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-14 05:57 +0000
1"""
2Input Source Strategy Enum for OpenHCS.
4This module defines the InputSource enum for explicit input source declaration
5in pipeline steps, replacing the @chain_breaker decorator system with a cleaner,
6more declarative approach.
8Doctrinal Clauses:
9- Clause 3 — Declarative Primacy
10- Clause 88 — No Inferred Capabilities
11- Clause 245 — Declarative Enforcement
12"""
14from enum import Enum
17class InputSource(Enum):
18 """
19 Enum defining input source strategies for pipeline steps.
21 This enum replaces the @chain_breaker decorator system with explicit
22 input source declaration, providing cleaner and more predictable
23 pipeline behavior.
25 The InputSource enum supports two strategies:
27 1. **PREVIOUS_STEP** (Default): Standard pipeline chaining where each step
28 reads from the output directory of the previous step. This is the normal
29 pipeline flow behavior.
31 2. **PIPELINE_START**: Step reads from the original pipeline input directory,
32 effectively "breaking the chain" and accessing the initial input data.
33 This replaces the @chain_breaker decorator functionality.
35 Usage Examples:
37 Standard chaining (default behavior):
38 ```python
39 step = FunctionStep(
40 func=my_processing_function,
41 name="process_images"
42 # input_source defaults to InputSource.PREVIOUS_STEP
43 )
44 ```
46 Chain breaking for position generation:
47 ```python
48 step = FunctionStep(
49 func=ashlar_compute_tile_positions_gpu,
50 name="compute_positions",
51 input_source=InputSource.PIPELINE_START # Access original input images
52 )
53 ```
55 Quality control accessing original data:
56 ```python
57 step = FunctionStep(
58 func=quality_control_function,
59 name="qc_check",
60 input_source=InputSource.PIPELINE_START # Compare against original
61 )
62 ```
63 """
65 PREVIOUS_STEP = "previous"
66 """
67 Standard pipeline chaining strategy.
69 The step reads input from the output directory of the previous step
70 in the pipeline. This is the default behavior and maintains normal
71 pipeline flow where each step processes the output of the previous step.
73 This strategy:
74 - Maintains sequential data flow
75 - Enables progressive image processing
76 - Uses VFS backend from previous step
77 - Is the default for all steps
78 """
80 PIPELINE_START = "start"
81 """
82 Pipeline start input strategy (replaces @chain_breaker).
84 The step reads input from the original pipeline input directory,
85 bypassing all previous step outputs. This is equivalent to the
86 @chain_breaker decorator behavior but declared explicitly.
88 This strategy:
89 - Accesses original input data
90 - Bypasses all previous processing steps
91 - Uses disk backend for VFS consistency
92 - Is required for position generation and quality control
94 Common use cases:
95 - Position generation functions (MIST, Ashlar)
96 - Quality control and validation steps
97 - Analysis requiring original image data
98 - Debugging and comparison operations
99 """