Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cbb334f
feat: Add support/config for InstanceSegmentationMask
aranega Aug 15, 2025
c4aa044
chore: Add new generated code from the new config for
aranega Aug 15, 2025
c4527da
feat: add instance segmentation mask class and instance creation
aranega Sep 4, 2025
2bb7506
chore: remove debug/test code in configuration 10441.yaml
aranega Sep 4, 2025
4a3d320
Merge branch 'main' of github.com:chanzuckerberg/cryoet-data-portal-b…
aranega Sep 12, 2025
bdf0085
feat: remove the instancesegmentation mask from v1, and enhance it for
aranega Sep 12, 2025
5d4bb52
Merge branch 'main' of github.com:chanzuckerberg/cryoet-data-portal-b…
aranega Sep 17, 2025
598e594
feat: add first steps for the InstanceSegmentationMask ingestion
aranega Oct 1, 2025
00a379d
fix: remove bad guard and simplify it
aranega Oct 1, 2025
6dec931
feat: add dedicated shape for the InstanceSegmentationMask
aranega Oct 2, 2025
5d6ac85
fix: remove labels param to convert function of instance seg masks
seankmartin Oct 2, 2025
6101bb2
feat: allow passing seg list into gen and v1 of instance seg mask config
seankmartin Oct 2, 2025
129fde5
feat: Add configuration generation for InstanceSegmentationMask
aranega Oct 7, 2025
0cf3ffe
feat: Remove mask_label for InstanceSegmentationMask
aranega Oct 7, 2025
7eccd55
feat: add label computation and storing before configuration generation
aranega Oct 8, 2025
0968ac4
Merge branch 'main' of github.com:chanzuckerberg/cryoet-data-portal-b…
aranega Oct 17, 2025
a438369
feat: clean schema attribute for the InstanceSegmentationMask
aranega Oct 27, 2025
ac1f46e
feat: add tests for the instance segmentation mask
aranega Oct 27, 2025
0af2440
chore: Updating schema to add InstanceSegmentationMask
aranega Oct 27, 2025
23cd1c5
fix: change is_a property of InstanceSegmentationMask in metadata.yaml
aranega Oct 27, 2025
2233c94
chore: update portal-neuroglancer to v1.7.0
aranega Oct 27, 2025
6f024df
feat: change metadata storing for labels in image-label
aranega Oct 27, 2025
8ec69d7
feat: add tests for instance segmentation mask db ingestion
aranega Oct 27, 2025
6f48941
feat: add a different method for downscaling multi-label segmentation
aranega Oct 28, 2025
6702b85
chore: Add back missing migration script
aranega Oct 28, 2025
37005bb
chore: Update schema to add InstanceSegmentationMask shape
aranega Oct 28, 2025
6bc118c
chore: Fix comment and poetry version
aranega Oct 28, 2025
72a0379
feat: change the container for the image-label metadata
aranega Oct 28, 2025
9ce3ceb
chore: apply old formatter for the migration
aranega Oct 29, 2025
4ac545e
chore: remove InstanceSegmentationMask from v1 schema
aranega Oct 29, 2025
bf96a29
chore: remove lefovers for v1 for InstanceSegmenationMask
aranega Oct 29, 2025
a15f3e6
chore: add back AnnotationInstanceSegmentationFile in metadata.yaml f…
aranega Oct 31, 2025
b31d94c
Merge branch 'main' of github.com:chanzuckerberg/cryoet-data-portal-b…
aranega Oct 31, 2025
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
30 changes: 3 additions & 27 deletions ingestion_tools/scripts/common/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,34 +125,10 @@ def write_data(

# Store the labels contained in the data if the flag is activated
if store_labels_metadata:

arr = data[0]

# t = time.perf_counter()
labels = [int(label) for label in np.unique(arr[arr > 0])]
# print(f"Time full image {time.perf_counter() - t:.3f}s {labels}")

# t = time.perf_counter()
# sub = arr[::10, :, :]
# labels = set(int(label) for label in np.unique(sub[sub > 0]))
# sub = arr[:, ::10, :]
# labels.update(int(label) for label in np.unique(sub[sub > 0]))
# sub = arr[:, :, :10]
# labels.update(int(label) for label in np.unique(sub[sub > 0]))
# print(f"Time 10th slices {time.perf_counter() - t:.3f}s {list(labels)}")

# t = time.perf_counter()
# sub = arr[::50, :, :]
# labels = set(int(label) for label in np.unique(sub[sub > 0]))
# sub = arr[:, ::50, :]
# labels.update(int(label) for label in np.unique(sub[sub > 0]))
# sub = arr[:, :, :50]
# labels.update(int(label) for label in np.unique(sub[sub > 0]))
# print(f"Time 50th slices {time.perf_counter() - t:.3f}s {list(labels)}")

# Move to other section
label_values = [{"id": label, "label": f"{label}"} for label in labels]
self.root_group.attrs["labels_metadata"] = {"version": "1.0", "labels": label_values}
labels = [int(label) for label in np.unique(arr)]
label_values = [{"label-value": label} for label in labels]
self.root_group.attrs["image-label"] = {"version": "0.4", "colors": label_values}

# Write the pyramid to the zarr store
return ome_zarr.writer.write_multiscale(
Expand Down
22 changes: 10 additions & 12 deletions ingestion_tools/scripts/importers/visualization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,13 @@ def get_annotation_layer_info(self, alignment_metadata_path: str) -> dict[str, A
is_instance_seg = shape == "InstanceSegmentation" or shape == "InstanceSegmentationMask"

args = {

"source_path": path,
"file_metadata": file,
"name_prefix": name_prefix,
"color": hex_colors[0],
"shape": shape,
"resolution": (voxel_spacing * 1e-10,) * 3,

}
"source_path": path,
"file_metadata": file,
"name_prefix": name_prefix,
"color": hex_colors[0],
"shape": shape,
"resolution": (voxel_spacing * 1e-10,) * 3,
}

if shape == "InstanceSegmentationMask":
args["visible_segments"] = visible_segments
Expand Down Expand Up @@ -299,16 +297,16 @@ def _get_labels(self, path: str):

reader = ZarrReader(self.config.fs, segmentation_filename)
try:
labels_info = reader.attrs.get("labels_metadata", {})["labels"]
labels = [label["id"] for label in labels_info]
labels_info = reader.attrs.get("image-label", {})["colors"]
labels = [label["label-value"] for label in labels_info]
except Exception:
# Get labels iterating by chunks over the tab
# We lazy import dask and numpy
import dask.array as da
import numpy as np

arr = reader.get_data()
labels = set(da.unique(arr[arr > 0]).compute().astype(np.integer))
labels = set(da.unique(arr).compute().astype(np.integer))
return tuple(labels)

def _create_config(self, alignment_metadata_path: str) -> dict[str, Any]:
Expand Down