IHC Nuclear Counter
Viewer Controls
100%Manual Counting
Current Mode: Positive
ROI Control
AI Detection
Minimum nucleus size:
DAB sensitivity:
Blue sensitivity:
🎨 Image Adjustments
Export
👤 About
Dr. Abdul Kadir Rifaei
Anatomic Pathologist
HTI & IAPMD Council Member
NUCLY v2 — IHC Nuclear Counter. Built with OpenCV.js for local, privacy-preserving image analysis.
Version 2.0
📖 NUCLY Usage Guide — Complete Reference v3.0
1. Upload Image — Select an immunohistochemistry (IHC) stained histopathology image (JPG/PNG). Works for any nuclear IHC marker such as ER, PR, Ki-67, p53, etc.
💡 Tip for phone camera photos: Keep the slide field flat and evenly lit. Avoid glare. After uploading, click ✨ Auto-Enhance to optimize the image automatically before running AI.
2. AI Analysis — Click "Start AI Analysis" to auto-detect strong positive (brown/black DAB), weak/blush positive (pale brown), and negative (blue hematoxylin) nuclei. Weak positives are shown as 🟠 orange dots for observer review.
3. Manual Correction — Use 🔴 Strong Positive / 🟠 Weak/Blush / 🔵 Negative to add missed nuclei. AI = filled dots, Manual = hollow rings. The IHC Index shows both Strong-only and All-Positive (strong + weak) percentages.
4. Erase — Select 🧹 Erase, adjust brush size, then click & drag to remove incorrect AI or manual markers.
5. ROI (Freehand Pen Trace) — Click "Draw ROI" and trace around the region of interest with your mouse (like drawing with a pen). Release to close the polygon. "Analyze ROI" runs AI only inside the traced region. Press Esc to cancel mid-trace.
6. Image Adjustments (Phone Camera Photos) — Essential for images taken through the microscope eyepiece:
- ✨ Auto-Enhance — One-click optimization. Automatically adjusts brightness, contrast, gamma, white balance (temperature), background whitening, saturation, and sharpening based on image histogram analysis. Recommended first step for all phone camera images.
- ⚙️ Manual Adjust — Opens the slider panel for fine-tuning. Use when Auto-Enhance needs tweaking:
- Brightness — Overall light/dark correction.
- Contrast — Stretch tones to make nuclei pop from background.
- Exposure (Gamma) — Brighten dark areas or darken washed-out regions.
- Saturation — Boost color separation between brown DAB and blue hematoxylin.
- Sharpen — Edge enhancement for crisper nuclear boundaries.
- Whiten Background — Cleans up gray/yellow background from phone camera uneven lighting.
- Temperature — Correct warm (yellow) or cool (blue) white balance casts. Slide left for cooler, right for warmer.
- ↩️ Reset — Reverts to original uploaded image.
- ✅ Apply — Locks adjustments so AI analyzes the processed image.
7. AI Sensitivity Settings — Fine-tune detection before running AI:
- Minimum nucleus size — Smallest area (in pixels) a detected blob must have to count as a nucleus. Increase if AI picks up tiny debris/dust; decrease if small nuclei are missed.
- DAB sensitivity — How strictly the AI filters for brown/black positive staining. Increase to catch lighter/greyish brown nuclei; decrease if background tissue is falsely counted as positive. Phone camera photos often need lower DAB sensitivity (~25–35) because phone cameras boost saturation.
- Blue sensitivity — How strictly the AI filters for hematoxylin (blue) negative nuclei. Increase to catch pale blue nuclei; decrease if non-nuclear blue areas (collagen, mucin) are being counted. For phone camera images, try ~30–40 to avoid overcounting background.
8. Weak / Blush Staining Guide — Clinically important for ER, PR, and other markers where any nuclear staining counts as positive:
- 🟠 Orange dots = Weak/blush DAB staining that the AI detected but classified as low-intensity. These are NOT included in the main IHC Index by default.
- IHC Index (Strong) = Only 🔴 strong brown/black nuclei counted as positive. Use this for strict scoring (e.g., Ki-67 where only clear staining matters).
- All Pos % = 🔴 Strong + 🟠 Weak counted together. Use this for ER/PR where any nuclear staining is considered positive per ASCO/CAP guidelines.
- Manual reclassification — Click a 🟠 orange dot with 🔴 Strong + button to upgrade it to strong positive. Or erase it if you think it's artifact. Your choice is recorded in the report.
- Phone camera tip — Weak staining is hardest for AI. If many nuclei are unmarked (no dot at all), lower DAB sensitivity to ~20. If too many blue nuclei turn orange, raise it to ~50.
9. Export — Save annotated PNG, CSV of coordinates, session JSON, or print the full report. The report includes both Strong-only and All-Positive IHC indices.
Shortcuts: 1=Strong Positive, 2=Negative, 3=Erase, 4=Weak/Blush, R=ROI, Ctrl+Z=Undo, Ctrl+Y=Redo, Esc=Cancel
📚 General Detection Guide (v3.0)
Getting Started & Upload
NUCLY is a nuclei detection and counting tool for microscopy and histology images. Supported formats: PNG, JPG, JPEG, TIFF, BMP. Max 50 MB per image. Images should be in focus with reasonable contrast between nuclei and background. For best results, use images at the same magnification and staining protocol across your dataset.
Running Detection
Detection Parameters: Min/Max Nucleus Size filters debris and splits clusters. Confidence Threshold controls strictness. Stain Type is always set to DAPI for optimal nuclear detection. Start with defaults and refine after reviewing the first pass.
Reviewing Results
🔴 Red dots = Strong Positive (brown/black DAB). 🟠 Orange dots = Weak/Blush Positive (pale brown) — shown for observer review. 🔵 Blue dots = Negative (blue hematoxylin). Green outlines = Segmentation boundaries. Zoom with mouse wheel, pan by click-drag. Toggle layers in the layer panel.
Manual Corrections
Add Nucleus, Remove Nucleus, Accept Rejected, Reject Accepted, Merge/Split for clusters. Manual corrections are saved automatically per session. Export before closing the tab.
Export Formats
CSV (coordinates, size, confidence), JSON (metadata + parameters), Annotated Image (with legend and count), Mask (binary/instance segmentation for downstream analysis).
Slider Safety Guide
| Adjustment | Risk | Recommendation |
|---|---|---|
| Whiten Background | HIGH | Apply BEFORE detection only |
| Brightness | HIGH | Apply BEFORE detection only |
| Contrast | HIGH | Apply BEFORE detection only |
| Gamma | HIGH | Apply BEFORE detection only |
| Sharpen | MEDIUM | Safe if subtle; re-run if aggressive |
| Saturation | LOW | Generally safe after detection |
| Temperature | LOW | Safe after detection |
Troubleshooting
- Too many false positives — Increase Confidence Threshold. Increase Min Nucleus Size. Apply Whiten Background BEFORE detection.
- Too many missed nuclei — Decrease Confidence Threshold. Decrease Min Nucleus Size. Increase Brightness/Gamma BEFORE detection. Check Stain Type.
- Clusters counted as single nuclei — Decrease Max Nucleus Size. Apply Sharpen BEFORE detection. Use manual Split tool.
- Counts changed after image adjustment — Expected behavior. Follow the safe workflow: Adjust → Apply → Detect → Correct → Export.
- Export file too large — Use Downsample option. Export CSV/JSON instead of PNG masks.