PRIZM is a napari-based toolkit for zebrafish cardiac analysis.
- Overview
- Requirements
- Installation
- How to Confirm PRIZM Installed Correctly
- Reinstall / Update
- Running Demo Dataset
- GUI Usage
- Command-Line Usage
- License
This repository provides the PRIZM napari plugin and companion CLIs for:
- batch segmentation and downstream functional analysis from organized image folders
- 2-stage mode-of-action prediction from
PerFishMetrics_*.xlsxworkbooks - MiniPanel visualization and statistics from
PerFishMetrics_*.xlsxworkbooks
The napari manifest currently exposes three widgets:
PRIZM Batch SegmentationPRIZM MoA 2-Stage PredictionPRIZM MiniPanel Heatmap/LDA
PRIZM is a Python package and napari plugin. The package requires Python 3.10 or newer. The current release has been validated on Windows 11 and Ubuntu 24.04.2 LTS.
CPU execution does not require non-standard hardware. GPU inference is optional and requires an NVIDIA GPU with a compatible NVIDIA driver and CUDA/cuDNN runtime. The demo run below was validated on Ubuntu 24.04.2 LTS with NVIDIA GeForce RTX 3080 GPU, NVIDIA driver 580.159.03, and CUDA 13.0.
The README installation and demo commands were validated with these software versions:
Tested software versions (click to expand)
| Software | Tested version |
|---|---|
| PRIZM package | prizm-napari 0.0.1 |
| Python | 3.12.13 |
| Conda | 25.5.1 |
| napari | 0.7.0 |
| magicgui | 0.10.2 |
| PyQt5 | 5.15.11 |
| QtPy | 2.4.3 |
| NumPy | 2.4.6 |
| pandas | 3.0.3 |
| SciPy | 1.17.1 |
| matplotlib | 3.10.9 |
| scikit-image | 0.26.0 |
| OpenCV | opencv-python 4.13.0.92 |
| dask | 2026.3.0 |
| tifffile | 2026.5.15 |
| PyTorch | 2.12.0+cu130 |
| torchvision | 0.27.0 |
| segmentation-models-pytorch | 0.5.0 |
| openpyxl | 3.1.5 |
| scikit-learn | 1.8.0 |
| statsmodels | 0.14.6 |
| umap-learn | 0.5.12 |
| ONNX | 1.21.0 |
| ONNX Runtime | onnxruntime 1.26.0 by default; onnxruntime-gpu 1.26.0 for optional GPU inference |
| seaborn | 0.13.2 |
| tqdm | 4.67.3 |
See pyproject.toml and requirements.txt for the package-defined dependency list.
These instructions are written for Windows first and assume you are
starting from a fresh machine. If you are using macOS or Linux, use
Terminal instead of Anaconda Prompt and replace Windows commands such as
dir and where with the equivalents for your platform.
The demo dataset and pretrained model files can be found at https://doi.org/10.6084/m9.figshare.32109697.
- Install Git.
Download and install Git from the Git website.
(Click to see screenshot) If you are not familiar with Git or the terminal, make sure Git is added to PATH during installation.
Verification:
git --versionYou should see a version number such as git version 2.x.x.
- Install Anaconda (Conda).
Download and install Anaconda from the Anaconda website.
(Click to see screenshot) If you are not familiar with Conda or the terminal, make sure Anaconda is added to PATH during installation.
Verification:
conda --versionYou should see a version number such as conda 24.x.x.
- Open the Anaconda Prompt.
For a Windows beginner, this is the safest terminal to use for the rest of the installation.
Verification:
conda info --envsIf this prints a list of environments, the prompt is ready to use.
- Clone this repository:
git clone https://github.com/NICALab/prizm-public.gitVerification:
dirYou should see a folder named prizm-public.
- Move into the cloned repository:
cd prizm-publicVerification:
cdThe printed path should end with prizm-public.
- Create a Conda environment:
conda create -n prizm-env python=3.12When Conda asks you to confirm, type y and press Enter.
Verification:
conda env listYou should see an environment named prizm-env.
- Activate the environment:
conda activate prizm-envVerification:
python --version
where pythonThe prompt usually starts with (prizm-env), and python --version
should print a Python 3.12 version.
- Install napari:
pip install "napari[all]"Verification:
python -m pip show napariYou should see package information for napari.
- Install this repository and its required dependencies from the cloned checkout.
This command installs the Python package named prizm-napari from your
local prizm-public folder.
pip install .Verification:
python -m pip show prizm-napariYou should see package information for prizm-napari.
- Optional: use ONNX Runtime GPU on NVIDIA CUDA.
The default install above gives you the CPU ONNX Runtime package. If you want PRIZM ONNX inference to use an NVIDIA GPU, replace the CPU runtime with the GPU runtime that matches your CUDA stack.
For CUDA 12.x:
python -m pip uninstall -y onnxruntime onnxruntime-gpu
python -m pip install "onnxruntime-gpu[cuda,cudnn]"For CUDA 11.x:
python -m pip uninstall -y onnxruntime onnxruntime-gpu
python -m pip install flatbuffers numpy packaging protobuf sympy
python -m pip install onnxruntime-gpu --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-11/pypi/simple/You still need a compatible NVIDIA driver and CUDA/cuDNN runtime on the system. If you are also using GPU PyTorch, install the PyTorch build that matches your CUDA setup. Verification:
python -m pip show onnxruntime-gpuIf you installed the GPU runtime, this command should show package
information for onnxruntime-gpu.
Note: after replacing onnxruntime with onnxruntime-gpu, python -m pip check
may report that prizm-napari requires onnxruntime. This is a package
metadata limitation because the GPU package provides the same importable
onnxruntime module. The GPU runtime is working if this command lists
CUDAExecutionProvider:
python -c "import onnxruntime as ort; print(ort.get_available_providers())"Typical installation time on a normal desktop computer is 10-20 minutes for the CPU installation, plus 5-20 additional minutes for the optional GPU ONNX Runtime packages depending on network speed.
Run these checks after the installation steps above.
- Confirm the package is installed:
python -m pip show prizm-napariYou should see package information including the package name and installation location.
- Confirm Python can import the package:
python -c "import prizm_napari; print(prizm_napari.__version__)"If this prints a version number and no error, the Python package is installed correctly.
- Confirm the CLI commands were installed:
prizm-batch-segmentation --help
prizm-moa-2stage --help
prizm-minipanel-analysis --helpEach command should print a help message instead of an error.
- Confirm the napari plugin loads:
napariWhen napari opens, go to Plugins -> PRIZM. You should see the PRIZM
widgets listed there.
If napari opens and the PRIZM menu entries are visible, the GUI
installation is working.
If you already cloned the repository and want to refresh your local installation:
- Move into your existing clone:
cd \path\to\prizm-public- Activate the environment:
conda activate prizm-envVerification:
python --versionYou should still be using the prizm-env environment.
- Pull the latest changes:
git pullVerification:
git statusYou should see that your branch is up to date or that the working tree is clean.
- Reinstall from the updated repository:
pip install .Verification:
python -m pip show prizm-napariYou should again see package information for prizm-napari.
The dataset from the paper (https://doi.org/10.6084/m9.figshare.32109697) can be used to verify batch
segmentation, functional analysis, and MiniPanel output generation. In
the commands below, replace /path/to/figshare_dataset with the folder
where you downloaded or mounted the figshare dataset.
Use the parent folder that contains the nested Representative image dataset
condition folder:
/path/to/figshare_dataset/Representative image dataset
Do not select the inner folder ending in
Representative image dataset/Representative image dataset as the batch
segmentation root. That inner folder contains the Series### sample
folders directly, but PRIZM expects the root directory to contain one or
more condition folders, each of which contains sample folders.
The demo model used for validation is:
/path/to/figshare_dataset/Trained_model/PRIZM-DeepLab_2026-04-21-10-55.onnx.ortfixed.onnx
Run the demo from an activated prizm-env environment:
prizm-batch-segmentation \
--data-dir "/path/to/figshare_dataset/Representative image dataset" \
--output-dir /path/to/prizm_demo_output \
--model "/path/to/figshare_dataset/Trained_model/PRIZM-DeepLab_2026-04-21-10-55.onnx.ortfixed.onnx" \
--model-type onnx \
--input-channels 3 \
--postprocess-masks \
--infer-batch-size 8The --input-channels 3 option is required for this ONNX demo model.
If GPU ONNX Runtime is installed correctly, PRIZM uses the ONNX
CUDAExecutionProvider automatically when a compatible NVIDIA GPU is
available.
Expected demo output:
- one output folder per input series, such as
Series006,Series008, and so on - raw and cleaned segmentation TIFF files for each series
- JPG frame visualizations by default (
cropped,preprocessing,masked, andFS); select TIFF instead with the GUI or CLI visualization-format control - masked and FS GIFs with per-frame elapsed time and a centered 50 µm scale bar; GIF playback follows the recorded frame intervals and loops continuously
- per-series analysis outputs under each series folder
- one condition-level
PerFishMetrics_*.xlsxworkbook underRepresentative image dataset/results - one top-level
batch_combined_*.csvfile
On a computer with an NVIDIA GeForce RTX
3080 GPU, this command processed 14 series with 589 frames each in around 20 minutes. The resulting
batch_combined_*.csv contained one row per series.
The generated PerFishMetrics_*.xlsx workbook can also be used to verify
the MiniPanel CLI:
prizm-minipanel-analysis \
--data-dir "/path/to/prizm_demo_output/Representative image dataset/results" \
--output-dir /path/to/prizm_minipanel_outputExpected MiniPanel output includes separate mini_bar_panel_core.* and
mini_bar_panel_extended.* figures, separate heatmap_core.* and
heatmap_extended.* figures, corresponding stats_significance_*.xlsx files,
LDA_REPORT/, and FIGURES_300dpi/ outputs.
Use PRIZM Batch Segmentation to run segmentation and functional
analysis on an organized root folder of image sequences.
Expected input layout:
Root Data Directory
├── {CHEMICAL}_{CONCENTRATION}/
│ ├── {SAMPLE_OR_SERIES}/
│ │ ├── frame_0.png
│ │ ├── frame_1.tif
│ │ ├── ...
│ │ └── metadata/ # optional
│ │ └── {ID}_Properties.xml # optional
│ └── ...
└── ...
Basic workflow:
-
Open
Plugins -> PRIZM -> PRIZM Batch Segmentation. -
Set
Root Data Directoryto the parent folder containing the{CHEMICAL}_{CONCENTRATION}condition folders. Each condition folder must contain one or more sample/series folders with.png,.jpg,.jpeg,.tif, or.tiffframes. -
Choose
Metadata Mode:Manual Entryis the GUI default. Enter the image scale inResize Scale(micrometres per source pixel) and the seconds between frames inRelative Time Interval. The defaults are0.9210and0.062.Use Metadata XMLdisables those two manual fields and searches each sample and condition folder for the matching XML metadata.
-
Set
Output Directory. PRIZM creates the condition, sample, and results subfolders inside it without modifying the input data. -
Click
Browse Model...and choose the.onnxor.pthsegmentation model. The file extension selects the matchingModel Typeautomatically. -
Set the image input:
Select ChannelusesChannel to segment; the default1is the green channel (0red/gray,2blue).Convert to Grayscaleconverts the source frames and disables the channel field.
-
Confirm the model settings. For an ONNX model, the exported graph already fixes
Backbone,Encoder Depth,Decoder Channels,Encoder Output Stride, andAtrous Rates, so those fields are disabled.Model Input Channelsis detected from the ONNX graph when possible; the figshare demo model uses3. The architecture fields are editable for.pthcheckpoints and must match how that checkpoint was trained. -
Leave
Inference Batch Sizeat1unless you have tested a larger value with the available GPU memory. -
Choose
Visualization Format.jpgis the space-saving default;tifwrites the four human-viewable frame sets as TIFF instead. -
Keep
Postprocess masks before saving and analysischecked. It is enabled by default and corrects the inference masks before PRIZM saves them and runs downstream measurements. -
Optional: check
Load images and segmentations to naparito add the completed image and label stacks to the open viewer. CheckGenerate analysis visualization overlayas well if that overlay should also be added to napari. Both are off by default because large batches can use a lot of memory. -
Click
Run Batch. The progress bar andBatch Logshow the current sample and stage.Stoprequests cancellation after the current work can stop safely.
Outputs are written to the selected output directory, including per-sample results and a combined batch CSV.
For either visualization choice, the integer-valued raw and cleaned
segmentation label stacks are always saved as lossless TIFF. Only the
human-viewable cropped, preprocessing, masked/labeled, and FS
frames change format. The masked and FS GIFs receive the elapsed-time and
50 µm scale-bar burn-in; individual frame files remain unannotated.
The crop and heart-detection window are scaled from the acquisition metadata so that different microscope pixel sizes retain approximately the same physical field of view. The cropped image is then resized to 300 x 300 for the current PRIZM model. If metadata is missing or invalid, PRIZM uses the existing 0.9210 µm/pixel baseline.
Use PRIZM MoA 2-Stage Prediction to run hierarchical MoA prediction
from PerFishMetrics_*.xlsx workbooks.
Basic workflow:
-
Open
Plugins -> PRIZM -> PRIZM MoA 2-Stage Prediction. -
Set
Excel Root Directory (recursive)to a parent folder containing thePerFishMetrics_*.xlsxworkbooks. PRIZM searches all subfolders and shows the number discovered. -
Click
Pick TRAIN / Vehicle / UNKNOWN.... Complete the dialogs in order:- In
Pick TRAIN Files, check the known training workbooks. UseMove UpandMove Downif their order matters. - In
Pick Vehicle(Control), select at least one vehicle/control workbook from the TRAIN set. - In
Edit Non-Vehicle TRAIN Group Names, confirm or edit the MoA group assigned to every other TRAIN workbook. - In
Pick UNKNOWN Files, select the remaining workbooks that should be predicted.
- In
-
Review
Selected Rolesbefore running. Vehicle workbooks must appear asVehicle; all other TRAIN workbooks must have the intended group name. -
Set
Output Directory. If left blank, PRIZM creates a timestampedPRIZM_2STAGE_results_*folder under the selected Excel root. -
Generate visual reportsandInclude TRAIN files in prediction outputsare both checked by default. Leave them checked for the complete output. -
Keep the collapsed
Training Parametersat their defaults unless you are intentionally reproducing a different validated analysis configuration. The current core defaults include target FPR0.05, minimum feature match0.90, five CV folds, robust median/MAD control statistics, Euclidean similarity with top3,200bagged trees, and random seed0. Self similarity and TOST equivalence tables are enabled by default. The additional dominance analyses are optional and disabled by default. -
Click
Run 2-Stage MoA. When it finishes, napari displays a summary with the output paths.
The output directory contains prizm_bundle_2STAGE.mat,
TRAIN_2STAGE_report.xlsx, MASTER_unknown_2STAGE.xlsx, per-workbook
prediction files, and the visual-report files when enabled.
Use PRIZM MiniPanel Heatmap/LDA to analyze selected
PerFishMetrics_*.xlsx workbooks with bar panels, heatmaps, and
dimensionality-reduction views.
Basic workflow:
-
Open
Plugins -> PRIZM -> PRIZM MiniPanel Heatmap/LDA. -
Set
Excel Root Directory (recursive)to a parent folder containing thePerFishMetrics_*.xlsxworkbooks. PRIZM searches all subfolders and initially selects every discovered workbook. -
Click
Pick Files / Order.... Check only the workbooks to analyze and useMove Up/Move Downto set their display order. SelectingOKimmediately opens the control/reference dialog. -
In
Pick Control / Reference / Stats...:- choose the actual vehicle/control workbook as
Control Group; - choose the group used for statistical and heatmap comparisons as
Reference Group(normally the same control group); - keep
Include reference group in heatmapchecked if its heatmap column should be shown; - enable
Save all pairwise Welch t-testsonly if the extra all-pairs tables are needed. It is off by default.
- choose the actual vehicle/control workbook as
-
Review the selected-workbook order and the control/reference summary. MiniPanel automatically uses the PRIZM 22-core/23-extended functional metric mapping; segmentation-entropy and count fields are not included in these functional figures.
-
Set
Output Directory. If left blank, PRIZM creates a timestampedoutput_*folder under the selected Excel root. -
Generate heatmap,Run Fisher LDA,Run PCA, andRun t-SNEare all checked by default. Disable only the outputs you do not need.Bar Panel Columnsdefaults to5. -
Click
Run MiniPanel Analysis. When it finishes, napari displays a summary with the output paths.
The output directory contains separate core/extended MiniPanels, heatmaps, and
statistics workbooks under panel_heatmap/, plus metric_selection.xlsx,
LDA_REPORT/, and FIGURES_300dpi/ for the enabled analyses.
Run batch segmentation and downstream analysis without napari.
prizm-batch-segmentation \
--data-dir /path/to/data \
--output-dir /path/to/output \
--model /path/to/model.onnx \
--model-type onnx \
--input-channels 3 \
--postprocess-masks \
--visualization-format jpgCommon options:
--model-type {auto,onnx,pth}--channel <int>--grayscale--postprocess-masks: postprocess inference masks before saving and analysis; unlike the GUI, CLI postprocessing is off unless this flag is supplied--backbone,--encoder-depth,--decoder-channels,--encoder-output-stride, and--atrous-rates:.ptharchitecture settings--metadata-mode {xml,manual}--metadata-file <path>--resize-scale <float>--frame-interval <float>--infer-batch-size <int>: default1--input-channels <int>: use3for the figshare ONNX demo model--visualization-format {jpg,tif}: defaultjpg; label stacks remain TIFF--no-amp
Use prizm-batch-segmentation --help for the full option list.
Run 2-stage MoA prediction from training and unknown workbook folders.
prizm-moa-2stage \
--train-dir /path/to/train_workbooks \
--unknown-dir /path/to/unknown_workbooks \
--output-dir /path/to/outputCommon options:
--kfold <int>--clip-z <float>--missing-frac-max <float>--min-match-frac <float>--top-features <int>--rng-seed <int>--n-trees <int>--target-fpr <float>--stage1-final-id <name>--sim-metric {euclid,cosine}--sim-top-k <int>--self-label <name>--tost-alpha <float>--tost-delta-softmax <float>--tost-delta-distance <float>--sim-multiplier <float>--dominance-alpha <float>--dominance-competitor-mode {mean,top2mean,best}--perm-n <int>--perm-max-exact-n <int>--no-figures--no-robust-control-stats--no-self-similarity--dominance-stats: add the Python dominance tables--ml-dominance-stats: add the Python ML-dominance tables--include-self-in-dominance--no-tost-vs-self--no-train-in-analysis
Use prizm-moa-2stage --help for the full option list.
Run MiniPanel analysis from a directory of Excel workbooks.
prizm-minipanel-analysis \
--data-dir /path/to/workbooks \
--output-dir /path/to/outputCommon options:
--control-group <name>--reference-group <name>--ordered-files file1.xlsx,file2.xlsx,...--n-cols <int>--exclude-ctrl-heatmap--save-all-pairs-excel--no-heatmap--no-lda--no-pca--no-tsne
Use prizm-minipanel-analysis --help for the full option list.
This project is licensed under the PolyForm Noncommercial License 1.0.0.
Commercial use is not permitted without a separate license from the copyright holder.