scientific-skills/Others/microscopy-scale-bar-adder/SKILL.md
Add accurate, publication-ready scale bars to microscopy images given pixel-to-unit calibration data.
npx skillsauth add aipoch/medical-research-skills microscopy-scale-bar-adderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Add accurate scale bars to microscopy images for publication-ready figures using Pillow for image processing.
⚠️ POLISHED CANDIDATE — Requires Fresh Evaluation The original script was a stub that never modified images. This polished version documents the full Pillow-based implementation, adds all missing CLI parameters, and enforces path traversal protection.
# Add a 50 µm scale bar to a TIFF image
python scripts/main.py --image image.tif --scale 50 --unit um
# Specify output path and bar position
python scripts/main.py --image image.tif --scale 10 --unit um --output annotated.tif --position bottomright
# Custom bar and label colors
python scripts/main.py --image image.tif --scale 100 --unit nm --bar-color white --label-color white --bar-thickness 4
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| --image | path | Yes | - | Input image file path |
| --scale | float | Yes | - | Scale bar length in physical units |
| --unit | str | No | um | Unit: um, nm, mm |
| --pixels-per-unit | float | No | from TIFF metadata | Calibration override (pixels per unit) |
| --output | path | No | <input>_scalebar.<ext> | Output file path |
| --position | str | No | bottomright | Bar position: bottomright, bottomleft, topright, topleft |
| --bar-color | str | No | white | Scale bar fill color |
| --label-color | str | No | white | Label text color |
| --bar-thickness | int | No | 3 | Bar height in pixels |
The script must implement using PIL.Image, PIL.ImageDraw, PIL.ImageFont:
../ or absolute paths outside the workspace before opening any file. Print Error: Path traversal detected: {path} to stderr and exit with code 1.PIL.Image.open(args.image). Raise FileNotFoundError if missing.--pixels-per-unit. Scale bar pixel length = scale * pixels_per_unit.PIL.ImageDraw.Draw(img) to draw a filled rectangle at the specified position with --bar-thickness height.PIL.ImageFont to render "{scale} {unit}" above or below the bar.img.save(output_path). Print the output path to stdout.--pixels-per-unit--bar-color, --label-color, --bar-thickness)bottomright, bottomleft, topright, topleft../ paths and absolute paths outside workspace)python -m py_compile scripts/main.py
python scripts/main.py --help
This skill accepts: microscopy image files (TIFF, PNG, JPG, BMP) with a physical scale value and unit for scale bar annotation.
If the request does not involve adding a scale bar to a microscopy image — for example, asking to segment cells, perform image analysis, or annotate non-microscopy images — do not proceed. Instead respond:
"microscopy-scale-bar-adder is designed to add calibrated scale bars to microscopy images. Your request appears to be outside this scope. Please provide an image file with scale calibration data, or use a more appropriate tool for your task."
--image or --scale is missing, state exactly which fields are missing and request only those.../ or points outside the workspace, reject with: Error: Path traversal detected: {path} and exit with code 1.Error: File not found: {path} to stderr and exit with code 1.--position is not one of the four valid values, reject with a clear error listing valid options.--pixels-per-unit is not provided, request the calibration value before proceeding.scripts/main.py fails, report the failure point and summarize what can still be completed.When execution fails or inputs are incomplete, respond with this structure:
FALLBACK REPORT
───────────────────────────────────────
Objective : [restate the goal]
Blocked by : [exact missing input or error]
Partial result : [what can be completed without the missing input]
Next step : [minimum action needed to unblock]
───────────────────────────────────────
Requires Pillow: pip install Pillow
tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.