cellmap_flow.dashboard.routes.pipeline
The dashboard’s chain, and the settings the pipeline builder keeps here.
PUT /api/pipeline: set the chain and redraw the viewer through it (the dashboard page’s Apply, and the pipeline builder after each edit).GET /api/raw/channels: the raw’s channels, which the Processing tab’s Channel picks among (the chain’s ChannelSelector).set_declared_input_norm(): a model’s start sets the input normalization it declares, or its kind of model’s convention, when the chain has none (services.launch.update_run_models).reset_postprocess_of_models_gone(): a start with none of the models that were running left clears the postprocessing set for those.set_start_postprocess(): the models’ starts set the step a model’s metadata declares is applied after it (a sigmoid), else the sigmoid a model’s logits need, when the chain has none, once every model started has its server and so says what its output is (services.launch.run_model).POST /api/processandPOST /api/pipeline/apply: the two routes it replaced, kept for one release as its deprecated aliases./api/blockwise-config: the builder’s blockwise settings./update/equivalences: a segmentation layer’s merged ids.
Attributes
Classes
The pipeline builder's canvas as it sends it: its nodes by type, and |
|
The body of PUT /api/pipeline. |
Functions
|
/api/pipeline/apply's check of the builder's nodes: |
Show a merging postprocessor's merged ids (an Equivalences) in its |
|
|
What |
|
Set the input normalization a model declares as the chain's, or the |
|
The first of |
|
Clear the chain's postprocessing, as part of starting models, when it |
|
Set the postprocessing the models' starts call for as the chain's, |
|
The model of |
Set the chain, and redraw the viewer through it. |
|
The raw's channels, for the Processing tab's Channel: |
|
|
Submit's route before PUT /api/pipeline. |
The pipeline builder's route before PUT /api/pipeline, answering as it did. |
|
Get or set the blockwise settings. |
Module Contents
- cellmap_flow.dashboard.routes.pipeline.logger
- cellmap_flow.dashboard.routes.pipeline.pipeline_bp
- cellmap_flow.dashboard.routes.pipeline.validate_pipeline_config(config)
/api/pipeline/apply’s check of the builder’s nodes:
{"valid": True}, or{"valid": False, "error"}for the first node that names no registered op, or for a body it cannot read.
- class cellmap_flow.dashboard.routes.pipeline.BuilderCanvas(/, **data: Any)
The pipeline builder’s canvas as it sends it: its nodes by type, and its edges, each a list (a missing one is empty). The dashboard keeps it for the builder’s next load, and each model node’s
configfor a model node that comes back without one; the chain is not read from it.- inputs: list[dict] = []
- outputs: list[dict] = []
- edges: list[dict] = []
- normalizers: list[dict] = []
- models: list[dict] = []
- postprocessors: list[dict] = []
- class cellmap_flow.dashboard.routes.pipeline.PipelineUpdate(/, **data: Any)
The body of PUT /api/pipeline.
input_normandpostprocessare the two chains, each a list of{"name": <op class>, **its parameters}steps in the order they run (pipeline_spec’s form). Both are required,[]for none, and every step must name a registered op of its kind.builderis the pipeline builder’s canvas (BuilderCanvas); only the builder sends it.- input_norm: list[dict]
- postprocess: list[dict]
- builder: BuilderCanvas | None = None
- cellmap_flow.dashboard.routes.pipeline.update_equivalences()
Show a merging postprocessor’s merged ids (an Equivalences) in its segmentation layer. Its inference server posts them as it merges.
- cellmap_flow.dashboard.routes.pipeline.start_input_norm(model_config, raw_dtype, raw_range)
What
model_config’s start sets on a chain with no input normalization, for raw data ofraw_dtypespanningraw_range: (the chain steps, whether the model declares them). Its declaration (_declared_steps), else the convention for its kind of model, a CellMap or DaCapo model’s [-1, 1] (the model advice’s suggestion at medium confidence, model_advice.input_norm_suggestion).([], False)for a model nothing is known of, whose suggestion of the range assumed stays a suggestion, and without the raw data’s range (no dataset open), where the convention’s MinMaxNormalizer would be a guess. The Finetune tab’s ranking reads a model through these steps too (finetune/rank_routes.py), whatever the chain has.
- cellmap_flow.dashboard.routes.pipeline.set_declared_input_norm(model_configs) str | None
Set the input normalization a model declares as the chain’s, or the convention for its kind of model when it declares none, as part of starting it, when the chain has none. Returns the name of the model whose input normalization it is, or None when nothing changed.
The Models tab’s Submit (services.launch.update_run_models) and Add a model call this with the models they are about to start, in the tab’s order, before their layers are drawn, so they are drawn through it. The first of them with any steps to set (start_input_norm: declared, or a CellMap or DaCapo model’s convention) gives them, and the postprocessing stays as it is (set_start_postprocess sets that once their servers are up); the chain is set through _set_chain_and_redraw, as PUT /api/pipeline sets it, so the layers of the models already running are redrawn through it too. A chain that has input normalizers already (a YAML’s, the user’s Apply) is left alone, and after this only Apply changes it: the Processing tab’s input list shows the chain as set (GET /api/models/loaded’s
pipeline, which the page reads after every model change) and the notice that says where it came from. A model with nothing to set (one nothing is known of) changes nothing. Steps that name an op the registry does not have, or a value its class refuses, are skipped with a warning, and the next model’s are tried.The browser’s twin is web/src/backend/serving.ts setDeclaredInputNorm, whose models all declare theirs (their manifests).
- cellmap_flow.dashboard.routes.pipeline.input_norm_set_by(model_configs)
The first of
model_configswhose start sets the chain’s input part as it stands, step for step (start_input_norm), as (its name, whether the model declares the steps);(None, None)when none does, or the chain has no input normalizers.GET /api/models/loaded answers them beside the chain, so the page can say where an input normalization a model’s start set came from (set_declared_input_norm sets the steps as they are).
- cellmap_flow.dashboard.routes.pipeline.reset_postprocess_of_models_gone(staying) bool
Clear the chain’s postprocessing, as part of starting models, when it was set for models none of which runs any more:
staying, the names of the models that were running before this start and still are after it, is empty. Returns whether it cleared any.The Models tab’s Submit (services.launch.update_run_models) and Add a model call this after their stops and before their starts, so the starts set what the new models declare or need (set_start_postprocess) and the model advice suggests the rest. A chain Applied over an affinity model, its DefaultPostprocessor clipping to [0, 1] ahead of the watershed, otherwise stayed for the model submitted once that one was stopped, a semantic model whose uint8 output it clipped to 0-1.
Only a chain that came from the dashboard is cleared: one the user Applied over models (Session.applied_over, PUT /api/pipeline’s), or one a model’s start set and that still stands (Session.start_postprocess). A YAML’s or the command line’s chain, never Applied, is left alone, as is one Applied before any model ran, and any chain while a model it was running over keeps running. The input normalization stays: a start sets the declared one only on a chain with none.
The browser’s twin is web/src/backend/routes/models.ts resetPostprocessOfModelsGone.
- cellmap_flow.dashboard.routes.pipeline.set_start_postprocess() bool
Set the postprocessing the models’ starts call for as the chain’s, when it has none, once every model started has its server: the step a model’s metadata declares is applied after it (a sigmoid), without asking, else the sigmoid a model’s logits need (_start_choice). Returns whether it set any, and so drew every running model’s layer.
services.launch.run_model calls this as each start ends: once the model’s server has its host, before its layer is drawn; and when the start ended without a server, as it may be the one the others waited on. Every start goes through it (the Models tab’s Submit, Add a model, the Finetune tab’s Use this model). What a chain shows a model is known only once its server says what its output is (its probe, serving/client.fetch_model_info’s
output_class): set at Submit, a declared sigmoid showed a model whose network ends in one already flattened, that one or another submitted with it. So while another model’s start is still going (services.launch.others_starting) nothing is set, and the start that ends last decides, over every model running. The chain is set through _set_chain_and_redraw, as PUT /api/pipeline sets it, so every layer is redrawn through it, the starting model’s among them; and the session remembers which model’s start it was and whether its metadata declares the steps (Session.start_postprocess, which postprocess_set_by reads), so the Processing tab says where they came from. Nothing else is set at a start from what a model says of its output: what it wants beyond that (an affinity model’s watershed, a semantic model’s argmax) is the model advice’s suggestion, for the user to Apply. A chain with postprocessing (a YAML’s, the user’s Apply, the ranking’s) is left alone, and after a start set it only Apply changes it; a chain the user Applied with none stays so for the models running then (_start_choice).The browser’s twin is web/src/backend/serving.ts setStartPostprocess, which knows every model’s output before they serve it, from its network.
- cellmap_flow.dashboard.routes.pipeline.postprocess_set_by(model_names)
The model of
model_nameswhose settings the chain’s postprocessing is, step for step, as (its name, whether the ranking fitted them to the paint, whether its metadata declares them);(None, None, None)when it is none’s, or the chain has none.The ranking’s (Session.rank_fits: what Use this model, Fit to Paint and Use these settings set, a sigmoid and the threshold the paint is fitted best at), else a model’s start’s (Session.start_postprocess: set_start_postprocess, the step its metadata declares follows it, or the sigmoid its logits need). GET /api/models/loaded answers them beside the chain, as it answers where the input normalization came from (input_norm_set_by).
- cellmap_flow.dashboard.routes.pipeline.put_pipeline()
Set the chain, and redraw the viewer through it.
The body is a PipelineUpdate. The answer is
{"success": true, "pipeline": {"input_norm", "postprocess"}, "digest", "layers"}: the chain as it is now configured, its digest (which names the layers’ source, so the same chain sent again leaves neuroglancer’s chunks and each server’s built chain as they are), and the prediction layers drawn. A body that is not a PipelineUpdate, a step its op’s class refuses, or a ChannelSelector past the raw’s channels (_channel_problems), is a 400{"success": false, "error"}that changes nothing.
- cellmap_flow.dashboard.routes.pipeline.get_raw_channels()
The raw’s channels, for the Processing tab’s Channel:
{"success": true, "channels", "labels", "selected"}.channelsis how many there are (1 for a raw with no channel axis, or no dataset open),labelstheir names (io.raw.raw_channels: an OME-Zarr’s omero labels) or null, andselectedthe one the models read, the chain’s ChannelSelector’s, else 0. A raw that cannot be read is a 400{"success": false, "error"}. The browser’s twin answers the same.
- cellmap_flow.dashboard.routes.pipeline.process()
Submit’s route before PUT /api/pipeline.
The body is
{"input_norm", "postprocess"}, either chain in the list or the older dict form. The answer is{"message", "received_data"}, the body with the dashboard’s address and the chain’s digest added; the older answer’sfound_custom_normalizerandreceived_data.time, which nothing read, are gone. An op it does not know is kept in the chain and skipped where it is built; a body without both chains, or a step its class refuses, is a 500.
- cellmap_flow.dashboard.routes.pipeline.apply_pipeline()
The pipeline builder’s route before PUT /api/pipeline, answering as it did.
The body is the builder’s nodes by type (
input_normalizers,postprocessors,models,inputs,outputs) and itsedges. The chain is taken from the normalizer and postprocessor nodes, each{"name", "params"}; everything is kept as the builder’s canvas. The answer is{"message", "normalizers_applied", "postprocessors_applied"}. A node that names no registered op is a 400{"valid": false, "error"}, and anything else that goes wrong a 500{"error"}.
- cellmap_flow.dashboard.routes.pipeline.blockwise_config_api()
Get or set the blockwise settings.