pipeline_model#

class LinearPipeline(steps: list[PipelineStep] = <factory>)[source]#

Bases: object

Ordered, reorderable sequence of binarization steps. Locked steps cannot be moved and cannot be displaced by adjacent moves.

move(step_id: str, direction: int) None[source]#

Move a step up (-1) or down (+1) in the pipeline.

Constraints#

  • Locked steps cannot move.

  • No step can displace a locked step.

param step_id:

ID of the step to move.

type step_id:

str

param direction:

-1 to move up, +1 to move down.

type direction:

int

toggle(step_id: str) None[source]#

Toggle the enabled state of a step. No-op for locked steps.

property enabled_steps: list[str]#

Ordered list of spec_names for enabled steps only.

steps: list[PipelineStep]#
class PipelineStep(spec_name: 'str', step_id: 'str' = <factory>, enabled: 'bool' = True, locked: 'bool' = False, keep_intermediate: 'bool' = True)[source]#

Bases: object

enabled: bool = True#
keep_intermediate: bool = True#
locked: bool = False#
spec_name: str#
step_id: str#
class StepSpec(name: str, label: str, color: str = '#2d6a4f', description: str = '')[source]#

Bases: object

Static definition of one binarization post-processing step.

color: str = '#2d6a4f'#
description: str = ''#
label: str#
name: str#
default_binarization_pipeline() LinearPipeline[source]#

Build the default pipeline from BINARIZATION_STEPS. The first step (binarize) is locked — it must always run first.