| title | Zebrafish Segmentation Web App |
|---|---|
| emoji | 🐟 |
| colorFrom | blue |
| colorTo | green |
| sdk | gradio |
| sdk_version | 6.3.0 |
| app_file | app.py |
| pinned | false |
zebrafish_analysis/
├── core/ — shared analysis package (seg, length, scalebar, models)
├── webapp/ — Gradio frontend
└── slicer_extension/ZebrafishAnalysis/ — 3D Slicer extension
- Open 3D Slicer 5.x
- Go to Edit → Application Settings → Modules → Additional module paths
- Add the path to
zebrafish_analysis/slicer_extension/ZebrafishAnalysis/ - Restart Slicer
- On first run, required Python packages are installed automatically (requires internet access, ~2 min)
Note: The extension downloads deep learning models (~500 MB) from Hugging Face Hub on first use.
Install 3D Slicer 5.x, open Extension Wizard, point to
zebrafish_analysis/slicer_extension/ZebrafishAnalysis/.
Dependencies are installed automatically on first load.
All models are hosted on Hugging Face and downloaded automatically on first use:
| Model | Repository | Purpose |
|---|---|---|
| Body segmentation (VGG19) | markdanielarndt/Zebrafish_Segmentation |
Fish body mask |
| Eye segmentation | markdanielarndt/Zebrafish_Segmentation |
Eye region mask |
| Curvature classifier (ConvNeXt) | markdanielarndt/Classification |
Curvature grade 1–4 |
Before you begin, you can select the model that will analyze the images. The General Model is trained on a broad dataset. Fine-tuned models are optimized for specific imaging setups. In addition, you can choose between a faster model and a more accurate model.
You can upload images of the zebrafish in two ways:
You can upload an entire folder containing zebrafish images.
Select the folder of your choosing from the file dialog:
Then click "Upload" to upload the folder. You'll need to confirm the upload by clicking "Upload" again:
Wait for the images to load and appear:
Alternatively, you can upload individual images one by one.
Select the images of your choosing and click "Open" to upload them:
Wait for the images to load and appear:
Once the images are successfully uploaded, the first one will appear on the screen. The scale bar will be automatically detected and the number of pixels it spans will be displayed.
Enter the physical length printed above the bar (e.g. 500) and its unit, then click Apply to compute the µm/px calibration. The image width/height fields below will be filled automatically.
If automatic detection has incorrectly identified the scale bar, you can use the Manual Scale Bar Entry option below. The image loads automatically below. Click on it to mark the two endpoints of the scale bar line:
- 1st click → START (one end, shown in green)
- 2nd click → END (other end, shown in red)
After both endpoints are set, enter the physical length below and click Apply Manual Points to fill in the calibration automatically.
You can also skip this step and enter the distances manually.
After uploading your images, choose which endpoints you want to analyze:
You can select:
- Length: Measure the length of the zebrafish (centerline path length in µm)
- Curvature: Classify the zebrafish into curvature classes (1-4)
- Class 1: Most severe curvature
- Class 2: Moderate-severe curvature
- Class 3: Mild curvature
- Class 4: Most healthy (minimal curvature)
- Length/Straight Line Ratio: The ratio between the actual centerline length and the straight-line distance between endpoints. A value close to 1.0 indicates a nearly straight fish, while higher values indicate more curvature. This metric quantifies body curvature independently of fish size.
- Eye Size: Calculates the eye area in µm² and measures the eye diameter in µm.
- Edema: ... .
- Swim Blader: ... .
To start the processing, click the Run button.
After processing, you'll see boxplots visualizing the distribution of the selected endpoints. These boxplots are also included in the Excel file:
The boxplots display:
- Fish Lengths: Distribution of measured centerline lengths in µm
- Curvatures: Distribution of curvature classifications (1-4)
- Length/Straight Line Ratio: Distribution of the length ratio metric, where values closer to 1.0 indicate straighter fish
- Eye Area: Distribution of calculated eye areas in µm²
- Eye Diameter: Distribution of measured eye diameters in µm
The ratio visualization helps identify fish with significant body curvature. You can see in the example image that some fish have ratios above 1.0, indicating curved body shapes:
The cyan line shows the straight-line distance between endpoints, while the actual centerline path (shown in red) is longer due to body curvature. The ratio quantifies this difference.
A gallery displays segmentation overlays for the uploaded images (thumbnails include a short filename label).
If automatic detection fails use Manual Point Adjustment tool to manually set head and tail points.
- Click an image in the gallery above to select it for manual editing
- Click on the large image below to set HEAD (green) and TAIL (red) points
- Click 'Apply Manual Points' to recalculate the length
When you're ready, press the Generate Final Excel button.
Below will be a button to download the file.



















