Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Parameters

Parameters say what to run. Put them in a params.yml file and pass it with -params-file:

input: /data/myproject/sheets/samplesheet.csv
outdir: /data/myproject/results

use_instanseg: true
pixel_size: 0.65

Every run needs input (the samplesheet) and outdir (where results go), and a segmentation method. Everything else has a default. This page covers the parameters most runs change, by topic; All parameters lists every one.

Write true and false in the params file. On the command line, --use_backsub false does not switch it off, so the run refuses it; use the params file for anything that is off.

The run checks combinations when it starts and stops with a message when they do not fit. The rules are given under each topic below.

Which steps run

By default the pipeline corrects illumination, stitches, segments, quantifies and writes a QC report. Two switches change the route:

You wantSetTutorial
Start from images stitched elsewhereuse_preprocessing: falsePre-stitched image
Stitched images only, nothing afterpreprocessing_only: trueStitching only

Two optional steps add to the route; both need the raw-cycle route: background subtraction and TMA dearray.

Segmentation

Methods and targets

Pick one method or both. Unless preprocessing_only, at least one is needed.

MethodSetChannels it reads
Cellposeuse_cellpose: true and cellpose_channels, e.g. "CD45 DNA_1", nuclear lastthe two you name, or two projected ones
InstanSeguse_instanseg: true and pixel_size, your pixel size in µmevery dna and marker channel of the marker sheet

Then pick what to find. Cells are on by default.

You wantSet
Cellsnothing
Cells, nuclei and cytoplasm, linkedsegment_nuclei: true
Nuclei onlysegment_cells: false, segment_nuclei: true

Each method × target is one more pass over the image: two methods and two targets are four. With both methods finding cells, the QC compares them. How to choose: Multiple segmentations.

Many markers with Cellpose

Cellpose looks at two channels, nuclear and cell, but an mIF panel spreads cell outlines across many markers. Channel projection combines them into those two channels:

use_cellpose: true
use_projection: true

Patch size

The image is cut into square patches that are segmented in parallel; see Tiled segmentation. patch_width_pixel sets their width. The default, 2000 px, suits TMA cores and small slides. Set it for anything larger: aim for 16 to 200 patches.

Stitched image (px)20005000800010000
3 000 × 3 0004111
25 000 × 25 00016925169
50 000 × 50 0006251004925
115 000 × 115 0003364529225144

The rule: patch_width_pixel = √(width × height / patches). A 30 000 × 20 000 px image at 70 patches gives 2928; round to 3000. The image size is in the stitched OME-TIFF’s metadata, which QuPath or Fiji show when you open it.

GPU

On the cluster, use_gpu: true gives each Cellpose and InstanSeg patch one GPU. Run with the slurm profile; with mdc as well, it asks for an A40. See GPU for other clusters.

Skip empty glass

use_tissue_segmentation: true finds the tissue first and segments only patches that touch it. For fluorescence, also set mode: staining:

use_tissue_segmentation: true
mode: staining

Preprocessing

Stitching

Ashlar stitches and aligns the cycles. Its settings go in ashlar_args, default --maximum-shift 30. Setting it replaces the default, so repeat what you want to keep:

ashlar_args: "--maximum-shift 50 --filter-sigma 1"

What to change when: When stitching looks wrong. A poor alignment does not stop the run; check the QC report every time.

Background subtraction

use_backsub: true subtracts autofluorescence channels from the markers before segmentation; see backsub. The marker sheet needs exposure and background columns. Tutorial: WSI with background subtraction.

TMA dearray

use_tma_dearray: true cuts a tissue microarray into cores, processes each core alone and merges them per slide; see Coreograph. It needs:

From these the pipeline tries several detection settings and keeps the one that finds the cores you expect. Both apply to every slide in the run, so run arrays with different layouts separately. To set Coreograph yourself instead, use coreograph_args. Tutorial: TMA.

Quality control

On by default. use_qc writes the QC report and Ashlar’s stitching QC; use_qc_images adds outline crops and a clustering of cells to the report, which takes minutes rather than seconds. To switch either off, write false in the params file. What the report shows: Reports.