Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
fa4d9ba
feat: add timelapse classic seg, individual, and MegaSeg eval for Car…
kiryteo Mar 11, 2026
62ed5ab
feat: add timelapse visualization script for MIP-based comparison fig…
kiryteo Mar 11, 2026
d7826d1
feat: add HTML gallery builder for timelapse visualizations
kiryteo Mar 11, 2026
26e5184
docs: add comprehensive 9-chapter experimental report for MegaSeg ben…
kiryteo Mar 24, 2026
c9ab674
docs: reclassify NPM1 as unseen structure throughout experimental report
kiryteo Mar 31, 2026
1f303a3
Update Chs 3-5 to use 57-sample filtered results
kiryteo Mar 31, 2026
e1a8dd7
feat: add Tubulin_MultiCh_2 support, extraction scripts, and SLURM jo…
kiryteo Apr 2, 2026
e5951c4
fix SOTA comparison structure overlap
kiryteo May 26, 2026
e4c200a
Standardize benchmark to 57 filtered test samples everywhere
kiryteo Jun 29, 2026
eb51080
Regenerate all result artifacts with 57 filtered samples
kiryteo Jun 29, 2026
7df5e87
Add single-sample SOTA qualitative comparison script
kiryteo Jun 30, 2026
8621b78
Fix SOTA single-sample script paths for worktree/cluster use
kiryteo Jun 30, 2026
87a728c
Fix SOTA single-sample inference: z-score norm, model arch, cache fal…
kiryteo Jun 30, 2026
d47713a
Merge pull request #43 from AllenCell/fix-issue-42-sota-structures
smishra3 Jul 1, 2026
cde5cec
Merge pull request #38 from AllenCell/docs/experimental-report
smishra3 Jul 1, 2026
3f2b93e
Merge pull request #32 from AllenCell/timelapse-classic-individual
smishra3 Jul 1, 2026
4f8b875
Add Figure 1 panels and generation scripts to Results_Figure_Tracking
smishra3 Jul 1, 2026
b48ae81
Merge pull request #47 from AllenCell/fig1-results-tracking
smishra3 Jul 1, 2026
5cf5b8b
Add Figure 2 heatmaps and generation scripts to Results_Figure_Tracking
smishra3 Jul 1, 2026
1a00a14
Merge pull request #48 from AllenCell/fig2-results-tracking
smishra3 Jul 1, 2026
59a4d27
Add Figure 3 (finetuning) combined figure to Results_Figure_Tracking
smishra3 Jul 1, 2026
45daf34
Merge pull request #49 from AllenCell/fig3-results-tracking
smishra3 Jul 1, 2026
d9bd297
Fig3: consolidate to a single config-driven generator
smishra3 Jul 1, 2026
fd21673
Merge pull request #50 from AllenCell/fig3-consolidate
smishra3 Jul 1, 2026
ccf1f2b
Fig3: FN-centered crop + correct raw channel for LMNB1 Panel A
smishra3 Jul 1, 2026
f3d6765
Merge pull request #51 from AllenCell/fig3-channel-fix
smishra3 Jul 1, 2026
250a609
Update LMNB1 README tables and heatmaps to 57-sample values
kiryteo Jul 1, 2026
f230d90
Fix visualize_finetune.py to derive n_test from summary CSV
kiryteo Jul 1, 2026
1a213fb
Add Fig3 script: 2×2 heatmap (LMNB1/LAMP1 × finetune/scratch)
kiryteo Jul 1, 2026
13c4092
Update Fig3: both structures, from-scratch, MegaSeg generalist column
kiryteo Jul 1, 2026
0582da3
Add Figure 4 (drug-perturbation qualitative) generator
smishra3 Jul 1, 2026
c6adfd2
Merge pull request #52 from AllenCell/fig4-results-tracking
smishra3 Jul 1, 2026
e9674c7
Fig4: larger scale-bar font + FBL Actinomycin crop shift
smishra3 Jul 1, 2026
95daf40
Merge pull request #53 from AllenCell/fig4-scalebar-crop
smishra3 Jul 1, 2026
d552cab
Refine Fig3: ascending data fractions, error maps for MegaSeg, Panel A/B
kiryteo Jul 2, 2026
b368001
Fix Fig3 qualitative y-axis label alignment
kiryteo Jul 2, 2026
66a095c
Fig3: add shared colorbar, better sample selection
kiryteo Jul 2, 2026
63b6044
Update Fig2: pseudo-labels, larger fonts, fixed data paths
kiryteo Jul 2, 2026
4707b54
Standardize benchmark to 57 filtered test samples everywhere
kiryteo Jun 29, 2026
b4c8ddc
Regenerate all result artifacts with 57 filtered samples
kiryteo Jun 29, 2026
380f234
Add single-sample SOTA qualitative comparison script
kiryteo Jun 30, 2026
651665b
Fix SOTA single-sample script paths for worktree/cluster use
kiryteo Jun 30, 2026
4271f0e
Fix SOTA single-sample inference: z-score norm, model arch, cache fal…
kiryteo Jun 30, 2026
650ae5e
Update LMNB1 README tables and heatmaps to 57-sample values
kiryteo Jul 1, 2026
6c2c18f
Fix visualize_finetune.py to derive n_test from summary CSV
kiryteo Jul 1, 2026
ce23900
Add Fig3 script: 2×2 heatmap (LMNB1/LAMP1 × finetune/scratch)
kiryteo Jul 1, 2026
e532dd5
Update Fig3: both structures, from-scratch, MegaSeg generalist column
kiryteo Jul 1, 2026
ff360fc
Refine Fig3: ascending data fractions, error maps for MegaSeg, Panel A/B
kiryteo Jul 2, 2026
37ec20a
Fix Fig3 qualitative y-axis label alignment
kiryteo Jul 2, 2026
b38479c
Fig3: add shared colorbar, better sample selection
kiryteo Jul 2, 2026
54e196a
Update Fig2: pseudo-labels, larger fonts, fixed data paths
kiryteo Jul 2, 2026
d565289
Update Fig2 v5: pseudo-labels, larger fonts, remove old v4 subdirs
kiryteo Jul 2, 2026
44d6c32
Fig2: increase label sizes for combined figure readability
kiryteo Jul 2, 2026
ec90bba
Add SOTA method comparison heatmap for f2_new figure
kiryteo Jul 2, 2026
ee1f553
Add ±std to all Fig2 heatmaps for consistency
kiryteo Jul 5, 2026
34ac52a
Fix empty dendrogram axes in radial cross-eval heatmap
kiryteo Jul 5, 2026
682443c
Increase heatmap annotation font sizes for combined figure readability
kiryteo Jul 5, 2026
8c0f4d4
Add MicroSAM (vit_b_lm) as 9th SOTA comparison method
kiryteo Jul 6, 2026
a0cdfe4
Merge remote changes (figure tracking) with MicroSAM addition
kiryteo Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,410 changes: 8,410 additions & 0 deletions Results_Figure_Tracking/Fig1/Fig1_combined_v2.ai

Large diffs are not rendered by default.

Binary file added Results_Figure_Tracking/Fig1/Fig1_combined_v2.pdf
Binary file not shown.
159 changes: 159 additions & 0 deletions Results_Figure_Tracking/Fig1/fig1a_image_manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"figure": "Fig1a — MegaSeg structure gallery (13 training structures)",
"naming_convention": "Viana et al., Nature 2023 (s41586-022-05563-7), Fig. 1a: '<structure> via <protein>' with 6-bucket cellular-compartment color squares.",
"source_root": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test",
"image_type": "single-channel 3D fluorescence TIFF, displayed as max-intensity projection (MIP)",
"pixel_size_um": 0.10833,
"scalebar_um": 10,
"crop_size_px": 400,
"render": {
"projection": "MIP (max over z)",
"p_lo": 2,
"p_hi": 99.7,
"gamma": 0.85,
"cmap": "gray",
"interpolation": "bilinear"
},
"compartment_colors": {
"nucleus": "#5B9BD5",
"nuclear_periphery": "#2A5DB0",
"cytoplasm": "#EFC275",
"apical_domain": "#84BB4C",
"cell_periphery": "#F5A8C6",
"basal_domain": "#D63F9B"
},
"compartment_labels": {
"nucleus": "Nucleus",
"nuclear_periphery": "Nuclear periphery",
"cytoplasm": "Cytoplasm",
"apical_domain": "Apical domain",
"cell_periphery": "Cell periphery",
"basal_domain": "Basal domain"
},
"compartment_legend_order": [
"nucleus",
"nuclear_periphery",
"cytoplasm",
"apical_domain",
"basal_domain"
],
"structures": [
{
"gene": "ACTN1",
"marker": "α-actinin 1",
"structure": "Actin bundles",
"compartment": "basal_domain",
"sample_stem": "ACTN1_11459",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/ACTN1_11459.tiff",
"exists": true
},
{
"gene": "ATP2A2",
"marker": "SERCA2",
"structure": "ER (SERCA)",
"compartment": "cytoplasm",
"sample_stem": "ATP2A2_146598",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/ATP2A2_146598.tiff",
"exists": true
},
{
"gene": "CTNNB1",
"marker": "β-catenin",
"structure": "Adherens junctions",
"compartment": "apical_domain",
"sample_stem": "CTNNB1_13430",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/CTNNB1_13430.tiff",
"exists": true
},
{
"gene": "DSP",
"marker": "desmoplakin",
"structure": "Desmosomes",
"compartment": "apical_domain",
"sample_stem": "DSP_4144",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/DSP_4144.tiff",
"exists": true
},
{
"gene": "GJA1",
"marker": "connexin-43",
"structure": "Gap junctions",
"compartment": "apical_domain",
"sample_stem": "GJA1_10539",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/GJA1_10539.tiff",
"exists": true
},
{
"gene": "MYH10",
"marker": "non-muscle-myosin IIB",
"structure": "Actomyosin bundles",
"compartment": "basal_domain",
"sample_stem": "MYH10_7549",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/MYH10_7549.tiff",
"exists": true
},
{
"gene": "NUP153",
"marker": "NUP153",
"structure": "Nuclear pores",
"compartment": "nuclear_periphery",
"sample_stem": "NUP153_140317",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/NUP153_140317.tiff",
"exists": true
},
{
"gene": "RAB5A",
"marker": "RAB5A",
"structure": "Endosomes",
"compartment": "cytoplasm",
"sample_stem": "RAB5A_147798",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/RAB5A_147798.tiff",
"exists": true
},
{
"gene": "SEC61B",
"marker": "SEC61β",
"structure": "ER (SEC61β)",
"compartment": "cytoplasm",
"sample_stem": "SEC61B_5293",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/SEC61B_5293.tiff",
"exists": true
},
{
"gene": "SON",
"marker": "SON",
"structure": "Nuclear speckles",
"compartment": "nucleus",
"sample_stem": "SON_136098",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/SON_136098.tiff",
"exists": true
},
{
"gene": "ST6GAL1",
"marker": "sialyltransferase 1",
"structure": "Golgi",
"compartment": "cytoplasm",
"sample_stem": "ST6GAL1_5555",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/ST6GAL1_5555.tiff",
"exists": true
},
{
"gene": "TJP1",
"marker": "ZO-1",
"structure": "Tight junctions",
"compartment": "apical_domain",
"sample_stem": "TJP1_7369",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/TJP1_7369.tiff",
"exists": true
},
{
"gene": "TOMM20",
"marker": "TOM20",
"structure": "Mitochondria",
"compartment": "cytoplasm",
"sample_stem": "TOMM20_3822",
"raw_path": "//allen/aics/assay-dev/users/Suraj/megaSeg/14structs_rand/test/TOMM20_3822.tiff",
"exists": true
}
]
}
Binary file not shown.
150 changes: 150 additions & 0 deletions Results_Figure_Tracking/Fig1/fig1a_structure_gallery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
"""
Fig 1a — MegaSeg structure gallery (13 training structures).

Self-contained regeneration script. Reads the image list and all styling from
`fig1a_image_manifest.json` (same folder) and writes `fig1a_structure_gallery.pdf`.

Naming convention follows Viana et al., Nature 2023 (s41586-022-05563-7), Fig. 1a:
each panel is labelled "<structure> via <protein>" with a small cellular-compartment
colour square beside the name (6-bucket radial scheme, nucleus -> cell periphery).

Usage:
python fig1a_structure_gallery.py
"""

import json
import os
from pathlib import Path

import numpy as np
import tifffile as tif
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import Patch

# ── Nature-style rcParams (Arial, editable PDF text) ──────────────
plt.rcParams.update({
"font.family": "sans-serif",
"font.sans-serif": ["Arial", "Helvetica", "DejaVu Sans"],
"font.size": 7,
"figure.dpi": 300,
"savefig.dpi": 300,
"pdf.fonttype": 42,
"ps.fonttype": 42,
})

HERE = Path(__file__).parent
MANIFEST = HERE / "fig1a_image_manifest.json"
OUT_PDF = HERE / "fig1a_structure_gallery.pdf"


# ── Image helpers ─────────────────────────────────────────────────
def mip(vol):
return np.max(vol, axis=0)


def normalize(img, p_lo=2, p_hi=99.7, gamma=0.85):
"""Per-image percentile contrast stretch + gamma (gamma < 1 lifts dim signal)."""
lo, hi = np.percentile(img, p_lo), np.percentile(img, p_hi)
if hi > lo:
img = (img - lo) / (hi - lo)
else:
img = np.zeros_like(img, dtype=np.float32)
img = np.clip(img, 0, 1)
if gamma and gamma != 1.0:
img = np.power(img, gamma)
return img


def center_crop(img, size):
h, w = img.shape[:2]
size = min(size, h, w)
y0 = (h - size) // 2
x0 = (w - size) // 2
return img[y0:y0 + size, x0:x0 + size]


def add_scalebar(ax, img_size, bar_um, pixel_um):
"""White scale bar + value label in the bottom-right corner.

Drawn once for the whole gallery — all crops share the same pixel size.
"""
import matplotlib.patheffects as pe
bar_px = bar_um / pixel_um
margin = img_size * 0.04
y = img_size - margin
x_end = img_size - margin
x_start = x_end - bar_px
stroke = [pe.withStroke(linewidth=1.4, foreground="black")]
line, = ax.plot([x_start, x_end], [y, y], color="white", linewidth=1.6,
solid_capstyle="butt")
line.set_path_effects(stroke)
txt = ax.text((x_start + x_end) / 2, y - img_size * 0.03,
f"{bar_um:g} µm", color="white", ha="center", va="bottom",
fontsize=5.5, fontweight="bold")
txt.set_path_effects(stroke)


# ── Build the gallery ─────────────────────────────────────────────
def main():
with open(MANIFEST, encoding="utf-8") as f:
m = json.load(f)

structs = m["structures"]
colors = m["compartment_colors"]
labels = m["compartment_labels"]
order = m["compartment_legend_order"]
crop = m["crop_size_px"]
px_um = m["pixel_size_um"]
bar_um = m["scalebar_um"]
r = m["render"]
p_lo, p_hi, gamma = r["p_lo"], r["p_hi"], r["gamma"]

n_cols, n_rows = 7, 2
fig, axes = plt.subplots(n_rows, n_cols, figsize=(7.2, 2.8), facecolor="white")
fig.subplots_adjust(wspace=0.06, hspace=0.35, left=0.01, right=0.99,
top=0.85, bottom=0.08)

for idx, s in enumerate(structs):
ax = axes[idx // n_cols, idx % n_cols]
try:
vol = tif.imread(s["raw_path"]).astype(np.float32)
img = center_crop(normalize(mip(vol), p_lo, p_hi, gamma), crop)
except Exception as e:
print(f" {s['gene']}: ERROR {e}")
img = np.zeros((crop, crop))

ax.imshow(img, cmap="gray", vmin=0, vmax=1, interpolation="bilinear")
if idx == len(structs) - 1: # single shared, labelled scale bar
add_scalebar(ax, crop, bar_um, px_um)

# Compartment colour square + "<structure> via <protein>" label.
ax.plot(0.03, 1.15, marker="s", markersize=4.2,
color=colors[s["compartment"]], transform=ax.transAxes, clip_on=False)
ax.text(0.14, 1.15, f"{s['structure']}\nvia {s['marker']}",
transform=ax.transAxes, ha="left", va="center",
fontsize=4.8, fontweight="bold", linespacing=1.1)

ax.set_xticks([])
ax.set_yticks([])
for spine in ax.spines.values():
spine.set_visible(False)
print(f" {s['gene']}: {s['sample_stem']} OK")

# Compartment legend in the empty cell (row 1, col 6).
ax_leg = axes[1, 6]
ax_leg.axis("off")
handles = [Patch(facecolor=colors[k], label=labels[k], edgecolor="none")
for k in order]
ax_leg.legend(handles=handles, loc="center", ncol=1, fontsize=5,
frameon=False, handlelength=1.2, handletextpad=0.4,
labelspacing=0.6)

fig.savefig(str(OUT_PDF), dpi=300, facecolor="white", pad_inches=0.05)
plt.close(fig)
print(f" Saved: {OUT_PDF}")


if __name__ == "__main__":
main()
Binary file not shown.
Binary file not shown.
Loading