-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add segmentation property objects
- Loading branch information
1 parent
759def1
commit d7664bc
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
cryoet_data_portal_neuroglancer/precompute/segmentation_properties.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
from cryoet_data_portal_neuroglancer.models.json_generator import SegmentPropertyJSONGenerator | ||
|
||
|
||
def write_segment_properties(base_folder: str | Path, ids: list[int], labels: list[str]): | ||
segment_generator = SegmentPropertyJSONGenerator(ids=ids, labels=labels) | ||
segment_properties = segment_generator.generate_json() | ||
segment_properties_path = Path(base_folder) / "segment_properties" / "info" | ||
segment_properties_path.parent.mkdir(exist_ok=True, parents=True) | ||
segment_properties_path.write_text(json.dumps(segment_properties, indent=2)) |