Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion apiv2/db_import/importers/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def get_filters(self) -> dict[str, Any]:
def get_finder_args(self) -> dict[str, Any]:
return {
"path": os.path.join(self.tomogram_voxel_spacing.s3_prefix, "Annotations/"),
"file_glob": "*/*.json",
# Use *[0-9].json to match only annotation metadata files (e.g., foo-1.0.json)
# and exclude annotation data files which have a _{shape} suffix (e.g., foo-1.0_globalcaption.json)
"file_glob": "*/*[0-9].json",
}


Expand Down
2 changes: 1 addition & 1 deletion apiv2/db_import/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ def expected_dataset(http_prefix: str) -> dict[str, Any]:
"key_photo_url": f"{http_prefix}/{DATASET_ID}/KeyPhoto/snapshot.png",
"key_photo_thumbnail_url": f"{http_prefix}/{DATASET_ID}/KeyPhoto/thumbnail.png",
"deposition_id": 300,
"file_size": 1374849.0,
"file_size": 1375370.0,
}
9 changes: 9 additions & 0 deletions apiv2/db_import/tests/test_db_annotation_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def expected_annotations(http_prefix: str) -> list[dict[str, Any]]:
def expected_annotation_files(http_prefix: str) -> list[dict[str, Any]]:
path = f"{DATASET_ID}/RUN1/Reconstructions/VoxelSpacing12.300/Annotations/"
return [
{
"tomogram_voxel_spacing_id": TOMOGRAM_VOXEL_ID1,
"s3_path": f"s3://test-public-bucket/{path}100-foo-1.0_globalcaption.json",
"https_path": f"{http_prefix}/{path}100-foo-1.0_globalcaption.json",
"source": "community",
"format": "saber",
"is_visualization_default": False,
"file_size": 0,
},
{
"tomogram_voxel_spacing_id": TOMOGRAM_VOXEL_ID1,
"s3_path": f"s3://test-public-bucket/{path}100-foo-1.0_instancesegmask.mrc",
Expand Down
6 changes: 3 additions & 3 deletions apiv2/graphql_api/types/annotation_shape.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions apiv2/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ enums:
Mesh:
text: Mesh
description: A surface mesh volumes
GlobalCaption:
text: GlobalCaption
description: A text caption for the tomogram
annotation_method_link_type_enum:
name: annotation_method_link_type_enum
description: Describes the type of link associated to the annotation method.
Expand Down Expand Up @@ -925,11 +928,11 @@ classes:
annotations:
cascade_delete: true
shape_type:
description: The shape of the annotation (SegmentationMask, OrientedPoint, Point, InstanceSegmentation, Mesh, InstanceSegmentationMask)
description: The shape of the annotation (SegmentationMask, OrientedPoint, Point, InstanceSegmentation, Mesh, InstanceSegmentationMask, GlobalCaption)
name: shape_type
from_schema: cdp-dataset-config
range: annotation_file_shape_type_enum
pattern: (^SegmentationMask$)|(^OrientedPoint$)|(^Point$)|(^InstanceSegmentation$)|(^Mesh$)|(^InstanceSegmentationMask$)
pattern: (^SegmentationMask$)|(^OrientedPoint$)|(^Point$)|(^InstanceSegmentation$)|(^Mesh$)|(^InstanceSegmentationMask$)|(^GlobalCaption$)
Annotation:
name: Annotation
annotations:
Expand Down
1 change: 1 addition & 0 deletions apiv2/support/enums.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion apiv2/test_infra/factories/annotation_shape.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manasaV3 @uermel I added this _globalcaption.json test file here but not sure if it's necessary.

"captions": [
{
"id": 0,
"text": "A caption for tomogram X."
},
{
"id": 1,
"text": "A 2nd caption for tomogram X."
},
{
"id": 2,
"text": "A 3rd caption for tomogram X."
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
"path": "30001/RUN1/Reconstructions/VoxelSpacing12.300/Annotations/100-foo-1.0_instancesegmask.zarr",
"shape": "InstanceSegmentationMask",
"is_visualization_default": false
},
{
"format": "saber",
"path": "30001/RUN1/Reconstructions/VoxelSpacing12.300/Annotations/100-foo-1.0_globalcaption.json",
"shape": "GlobalCaption",
"is_visualization_default": false
}
],
"method_links": [
Expand Down
Loading