Batch processing¶
The Batch tab runs segmentation, spot detection, and quantification across folders of images.
Interface overview¶
Input section¶
Controls:
- Input folder (browse field): Select the folder containing input images.
- Extensions (text field): Comma-separated file extensions to include.
- Include subfolders (checkbox): Recursively scan nested folders.
- Process all scenes (checkbox): Process all scenes in multi-scene files.
Behavior notes:
- If the extensions field is empty, all files are considered.
- Extensions are normalized to lowercase and a leading dot is added if missing.
- By default, the extensions field is pre-filled with common image formats.
- Batch settings are saved/loaded from the Settings tab using
senoquant_settings.json.
Channels section¶
Use channel mappings to define reusable channel names for all dropdowns in the tab.
Controls:
- Add channel (button): Add a new channel row.
- Auto populate channel(s) (button): Populate channel rows from the first discovered input image.
- Name (text field): Channel display name (for example,
DAPI). - Index (spin box): Zero-based channel index in the source image.
- Delete (button): Remove that mapping row.
Behavior notes:
- If Name is left blank, Batch uses the index as the name (for example,
0). - Auto populate channel(s) is enabled only when a valid Input folder is set.
- Auto-populate uses the first matching image from the selected input folder (respecting Extensions and Include subfolders) and fills channel names/indices from reader metadata.
- Channel names from this section drive nuclear/cytoplasmic/spot channel selectors and quantification layer choices.
Segmentation section¶
Nuclear segmentation controls¶
- Run nuclear segmentation (checkbox): Enable or disable nuclear segmentation.
- Nuclear model (dropdown): Select a nuclear model.
- Nuclear channel (dropdown): Select the image channel for nuclear segmentation.
- Edit nuclear settings (button): Open the model settings dialog.
Cytoplasmic segmentation controls¶
- Run cytoplasmic segmentation (checkbox): Enable or disable cytoplasmic segmentation.
- Cytoplasmic model (dropdown): Select a cytoplasmic model.
- Cytoplasmic channel (dropdown): Select the image channel for cytoplasmic segmentation.
- Nuclear channel (dropdown): Select a nuclear channel when required by the selected model.
- Edit cytoplasmic settings (button): Open the model settings dialog.
Behavior notes:
- Cytoplasmic models that support
nuclear+cytoplasmicinput enable the nuclear channel selector. - For models where nuclear input is optional, the label updates to
Nuclear channel (optional)and includes(none)as a valid choice. - For models where nuclear input is required, the label updates to
Nuclear channel (required). - Batch settings dialogs mirror Segmentation-tab model settings.
- Some model behaviors are fixed and not shown as controls:
- StarDist (
default_2d/default_3d) normalization is always enabled. - CPSAM auto-detects 2D vs 3D from input dimensionality and always normalizes.
Spot detection section¶
Controls:
- Run spot detection (checkbox): Enable or disable spot detection.
- Spot detector (dropdown): Select the spot detector.
- Edit spot settings (button): Open detector settings.
- Minimum diameter (px) (spin box): Minimum post-detection filter value in pixels (
0means no minimum filter). - Maximum diameter (px) (spin box): Maximum post-detection filter value in pixels (
0means no maximum filter). - Add spot channel (button): Add a spot channel row.
- Spot channel row: Channel dropdown plus Delete button.
Behavior notes:
- Spot filtering is applied after detector output.
- Internally,
min_sizeandmax_sizeare interpreted as diameter thresholds in pixels and converted to effective area (2D) or volume (3D) before filtering labels. - If spot detection is enabled, at least one spot channel must be selected before run.
- Batch spot-settings dialogs mirror Spots-tab detector settings.
- Spot label names in Batch preview/quantification follow
<channel>_<detector>_spot_labels, matching Segmentation/Spots naming style used for channel resolution. - Detector behaviors fixed internally and not shown as controls:
- RMP angle spacing is fixed to
5and denoising is always enabled. - UFISH denoising is always enabled.
Quantification section¶
The Batch tab embeds the Quantification feature editor with batch-safe options.
Controls:
- Run quantification (checkbox): Enable or disable quantification.
- Embedded feature editor: Add and configure Markers or Spots features.
Batch-mode differences from the Quantification tab:
- Output-path controls are hidden.
- The Process button is hidden.
- ROI configuration is disabled.
- Threshold controls are disabled.
- Quantification format is set in the Batch Output section.
Output section¶
Controls:
- Output folder (browse field): Destination root for batch outputs.
- Quantification format (dropdown):
xlsxorcsv. - Overwrite existing outputs (checkbox): Control behavior when output folders already exist.
Behavior notes:
- If output folder is left empty, Batch defaults to
<input_folder>/batch-output. - If overwrite is off and a target output folder already exists, that item is skipped.
Run section¶
Controls:
- Run batch (button): Start batch processing.
- Progress bar: Shows percent completion.
- Status label: Shows current status and per-item progress text.
Behavior notes:
- Processing runs in a background thread.
- Progress messages include file name and scene when relevant.
- Completion reports processed, failed, and skipped item counts.
- You must enable at least one processing path (segmentation, spots, or quantification).
- If spot detection is enabled, at least one spot channel is required.
Settings integration¶
Batch no longer has dedicated Load profile / Save profile buttons. Instead:
- Use the Settings tab to save or load unified settings bundles.
- When loading a settings bundle, Batch state is applied automatically if
the file contains a
batch_jobpayload. - During batch runs, SenoQuant writes a
senoquant_settings.jsonfile in the batch output root so run configuration is captured with results.
Processing behavior¶
For each discovered image file (and each scene, if scene processing is enabled), Batch runs steps in this order:
- Nuclear segmentation (if enabled).
- Cytoplasmic segmentation (if enabled).
- Spot detection (if enabled).
- Quantification (if enabled and features are configured).
Batch continues processing remaining items even if one item fails.
Output structure¶
Per-image output folders¶
Batch writes outputs under:
<output_folder>/<image_base_name>/
If Process all scenes is enabled:
<output_folder>/<image_base_name>/<scene_name>/
Segmentation and spots output names¶
- Nuclear masks:
<channel>_<model>_nuc_labels.npy. - Cytoplasmic masks:
<channel>_<model>_cyto_labels.npy. - Spot masks:
<channel>_<detector>_spot_labels.npy.
Quantification output layout¶
Quantification outputs are written into feature folders inside the same per-image (or per-scene) folder:
<output_folder>/<image_or_scene>/<feature_name_sanitized>/
Within each feature folder:
- Markers feature: One file per segmentation.
- Spots feature:
- With segmentation(s):
<segmentation_label>_cells.<format>and<segmentation_label>_spots.<format>. - Without segmentation:
all_spots.<format>. - Shared feature metadata:
feature_settings.json.
Feature folder names are normalized to lowercase and spaces become underscores.
Example layout¶
batch-output/
senoquant_settings.json
sample_01/
dapi_default_2d_nuc_labels.npy
fitc_ufish_spot_labels.npy
if_markers/
dapi_default_2d_nuc_labels.xlsx
feature_settings.json
if_spots/
dapi_default_2d_nuc_labels_cells.xlsx
dapi_default_2d_nuc_labels_spots.xlsx
feature_settings.json
sample_02/
Scene_0/
...
Scene_1/
...
Tips¶
- Keep channel mapping complete before configuring feature dropdowns.
- Verify detector/model settings on one representative image before full batch runs.
- Use the Settings tab save/load flow to reuse segmentation, spot, and batch configurations.
- Leave overwrite off when resuming interrupted runs.