phenotypic.gui.builder._conversion_dag.from_pipeline_dag#
- phenotypic.gui.builder._conversion_dag.from_pipeline_dag(pipeline: ImagePipeline) _DagBuilderState[source]#
Convert an
ImagePipelineto a DAG-shapedBuilderState.Steps (spec §5.4):
Construct an empty
BuilderState(the rootBuilderScopeauto-seeds anInputImageblock via its__post_init__).Walk
pipeline.get_ops() + get_meas() + get_post()minting oneBlockNodeper entry and adding"image"edges between consecutive entries (plus fromInputImageto the first entry).For each block, extract op-typed parameters via the registry’s
ParamInfometadata into embedded aux blocks + aux edges. Recursive walks handle aux-of-aux + container aux.Track an
id(op) → block_idmap: when the same Python instance appears in both_opsand a consumer’s aux param (legacy shared-instance edge case), deep-copy the aux source into a fresh block and append an info toast tostate.toast_queue.Copy
pipeline.name,pipeline._desc,pipeline.nrows, andpipeline.ncolsto the root scope; container scopes leavenrows/ncolsasNone.
- Parameters:
pipeline (ImagePipeline) – The
ImagePipelineto mirror.- Returns:
A
BuilderStatewhose root scope reproduces the pipeline.- Return type:
Examples
Mirror a tiny
ImagePipelineback into a DAGBuilderState. The auto-seededInputImageblock sits at index 0 of the root scope’sblockslist and the mirrored op follows at index 1:>>> from phenotypic import ImagePipeline >>> from phenotypic.enhance import GaussianBlur >>> from phenotypic.data import load_synth_yeast_plate >>> from phenotypic.gui.builder._conversion_dag import ( ... from_pipeline_dag, ... ) >>> pipeline = ImagePipeline(ops=[GaussianBlur()], name="demo") >>> state = from_pipeline_dag(pipeline) >>> [b.class_name for b in state.root.blocks] ['InputImage', 'GaussianBlur'] >>> _ = load_synth_yeast_plate() # microbiology context anchor