Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1622d81
loading dialog stays untill all tracks are rendered
TeunHuijben Sep 13, 2024
c42a658
removed unneccessary parts
TeunHuijben Sep 13, 2024
f3af62a
lint fixes
TeunHuijben Sep 13, 2024
e20c2f0
Merge branch 'main' into loading-sign-untill-all-tracks-loaded
TeunHuijben Oct 2, 2024
a7f7ae8
replaced Promise.all by Promise.allSettled
TeunHuijben Oct 5, 2024
fd0c901
changed default dataset
TeunHuijben Apr 21, 2025
8963837
updated annotTime and hexbinar to TracksManager.ts
TeunHuijben Apr 21, 2025
9d18899
hex-binary in PointCanvas
TeunHuijben Apr 21, 2025
b250dd2
handleBinarySelection to CellControls, without button yet
TeunHuijben Apr 21, 2025
7505fc4
added button
TeunHuijben Apr 21, 2025
5c5c804
final changes in export
TeunHuijben Apr 21, 2025
7ddc8f4
fixed pink issue
TeunHuijben Apr 21, 2025
f0d005e
lint fix
TeunHuijben Apr 22, 2025
cd1c422
config back to default + remove log
TeunHuijben Apr 22, 2025
ef2878c
handle binarySelection when annotation have different colors (not jus…
TeunHuijben Jun 30, 2025
10d972e
Merge branch 'main' into Xiang
TeunHuijben Oct 24, 2025
7481551
select red cells, only available when annot_time in zattrs
TeunHuijben Apr 6, 2026
c2d8203
track annotations, instead of selecting at annot_time
TeunHuijben Apr 6, 2026
0630198
Merge branch 'main' into loading-sign-untill-all-tracks-loaded
TeunHuijben Apr 6, 2026
c35aeb4
lint fixes
TeunHuijben Apr 6, 2026
4e7896e
Merge branch 'loading-sign-untill-all-tracks-loaded' into Xiang
TeunHuijben Apr 6, 2026
6fb7233
button to save video
TeunHuijben Apr 7, 2026
7892e37
readme update
TeunHuijben Apr 7, 2026
6368878
precommit
TeunHuijben Apr 7, 2026
0750a3c
new movie icon
TeunHuijben Apr 7, 2026
1865224
lint fixes
TeunHuijben Apr 7, 2026
d108462
color of icon
TeunHuijben Apr 7, 2026
a18a3fb
change cli to take an url and use browser - much cleaner
TeunHuijben Apr 8, 2026
f2952c6
cleanup
TeunHuijben Apr 8, 2026
a1ccd56
bugfix in record.py
TeunHuijben Apr 8, 2026
a2dc5f2
correct progress from from cli with ski~=1
TeunHuijben Apr 8, 2026
6171b4b
fix mac quicktime mp4 issue from linux
TeunHuijben Apr 8, 2026
573922d
Merge branch 'main' into Xiang
TeunHuijben Apr 8, 2026
6ff0e6d
two buttons working + no pink
TeunHuijben Apr 8, 2026
0238ae7
colors cells of loaded lineage by their own tissue color + fix pink i…
TeunHuijben Apr 8, 2026
53c7c57
hoover over tissue indicator + many bug fixes
TeunHuijben Apr 9, 2026
9a3d57f
Merge branch 'video' into Xiang
TeunHuijben Apr 9, 2026
ee9ad24
Merge branch 'main' into Xiang
TeunHuijben Apr 21, 2026
6fa0f71
latest build for python/frontend
TeunHuijben Apr 21, 2026
e1e01fb
axes helper off by default
TeunHuijben Apr 21, 2026
2efc18f
lint fixes
TeunHuijben Apr 21, 2026
dc13274
fix NaN export for last point of each track
TeunHuijben Jun 23, 2026
b1821bd
allow coloring by two tissues, when binary_hex columns are chosen
TeunHuijben Jun 23, 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,5 @@ cython_debug/

.history/

# Claude
#Claude
.claude/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:python": "tsc && vite build && mkdir -p python/src/intracktive/frontend/assets && cp dist/index.html dist/spark1.png dist/Biohub_logo_60x60.png dist/icon_zebrafish.png python/src/intracktive/frontend/ && cp dist/assets/* python/src/intracktive/frontend/assets/",
"build:python": "tsc && vite build && rm -rf python/src/intracktive/frontend && mkdir -p python/src/intracktive/frontend/assets && cp dist/index.html dist/spark1.png dist/Biohub_logo_60x60.png dist/icon_zebrafish.png python/src/intracktive/frontend/ && cp dist/assets/* python/src/intracktive/frontend/assets/",
"preview": "vite preview",
"lint": "eslint src",
"format": "prettier --write src",
Expand Down
113 changes: 113 additions & 0 deletions python/src/intracktive/add_annotations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
"""
Standalone script to precompute annotated track point IDs for an inTRACKtive zarr store.

For each hex-binary attribute, finds all cells with a non-background annotation value,
looks up their track IDs, and stores one representative point ID per unique annotated track
in attributes.attrs["annot_point_ids"] (a list of lists, parallel to attribute_names).

Usage:
python -m intracktive.add_annotations <zarr_path>
"""

import sys
from pathlib import Path

import numpy as np
import zarr

# The hex value used to represent "no annotation" (grey: #404040)
NO_ANNOTATION_VALUE = 4210752
# Sentinel value used to pad the jagged array
INF_SPACE = -9000.0


def add_annotated_point_ids(zarr_path: str | Path) -> None:
"""
Process an existing inTRACKtive zarr store and write annot_point_ids to attributes.attrs.

For each hex-binary attribute column, scans all timepoints to find annotated cells,
resolves their track IDs via points_to_tracks, and stores one representative point ID
per unique annotated track. Non-hex-binary attributes get an empty list.

Parameters
----------
zarr_path : str or Path
Path to the inTRACKtive zarr store.
"""
zarr_path = Path(zarr_path)
store = zarr.open(zarr_path.as_posix(), mode="r+")

if "attributes" not in store:
print("No attributes array found in zarr — nothing to do.")
return

attributes = store["attributes"]
zattrs = dict(attributes.attrs)

attribute_names = zattrs.get("attribute_names", [])
attribute_types = zattrs.get("attribute_types", [])

if not attribute_names:
print("No attribute_names found in attributes.zattrs — nothing to do.")
return

n_attributes = len(attribute_names)
max_pts = attributes.shape[1] // n_attributes

# Load points_to_tracks CSR arrays once
indptr = store["points_to_tracks/indptr"][:]
indices = store["points_to_tracks/indices"][:]

annot_point_ids: list[list[int]] = []
annot_colors: list[int | None] = []

for col_idx, (name, attr_type) in enumerate(zip(attribute_names, attribute_types)):
if attr_type != "hex-binary":
annot_point_ids.append([])
annot_colors.append(None)
continue

print(f"Processing hex-binary attribute '{name}' (column {col_idx})...")

# Load full attribute column for all timepoints: shape (n_times, max_pts)
start_col = col_idx * max_pts
end_col = start_col + max_pts
attr_data = attributes[:, start_col:end_col]

# Find all (t, i) that are annotated: not background and not INF_SPACE padding
mask = (attr_data != NO_ANNOTATION_VALUE) & (attr_data > INF_SPACE)
t_indices, i_indices = np.where(mask)
point_ids = (t_indices * max_pts + i_indices).astype(np.int64)

# For each point, look up its track(s) and keep one representative point ID per track
seen_tracks: set[int] = set()
representative_point_ids: list[int] = []

for point_id in point_ids:
pid = int(point_id)
start = int(indptr[pid])
end = int(indptr[pid + 1])
for track_id in indices[start:end]:
tid = int(track_id)
if tid not in seen_tracks:
seen_tracks.add(tid)
representative_point_ids.append(pid)

# Extract tissue color (all annotated cells share the same hex color for hex-binary)
annotated_values = attr_data[mask]
tissue_color = int(annotated_values[0]) if len(annotated_values) > 0 else None
annot_colors.append(tissue_color)

print(f" → {len(seen_tracks)} annotated tracks found")
annot_point_ids.append(representative_point_ids)

attributes.attrs["annot_point_ids"] = annot_point_ids
attributes.attrs["annot_colors"] = annot_colors
print(f"Saved annot_point_ids to {zarr_path / 'attributes' / '.zattrs'}")


if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python -m intracktive.add_annotations <zarr_path>")
sys.exit(1)
add_annotated_point_ids(sys.argv[1])

Large diffs are not rendered by default.

9,372 changes: 0 additions & 9,372 deletions python/src/intracktive/frontend/assets/index-CLy-n6J5.js

This file was deleted.

2 changes: 1 addition & 1 deletion python/src/intracktive/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
rel="stylesheet"
/>
<title>inTRACKtive</title>
<script type="module" crossorigin src="/assets/index-CLy-n6J5.js"></script>
<script type="module" crossorigin src="/assets/index-BLTjMDY-.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-3tFKGWso.css">
</head>
<body>
Expand Down
Loading
Loading