From 1307e6c8a0e54bb934385ffe1a68c979c7a67643 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Mon, 9 Dec 2024 12:40:45 -0800 Subject: [PATCH 1/4] fix: Update alignment volume_dim voxel source --- ingestion_tools/scripts/importers/alignment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingestion_tools/scripts/importers/alignment.py b/ingestion_tools/scripts/importers/alignment.py index c1972e1ec..cbd225405 100644 --- a/ingestion_tools/scripts/importers/alignment.py +++ b/ingestion_tools/scripts/importers/alignment.py @@ -120,7 +120,7 @@ def get_tomogram_volume_dimension(self) -> dict: if not tomogram: # If no source tomogram is found don't create a default alignment metadata file. raise TomogramNotFoundError() - voxel_size = round(tomogram.get_source_volume_info().voxel_size, 3) + voxel_size = round(tomogram.get_voxel_spacing().as_float(), 3) dim = tomogram.get_source_volume_info().get_dimensions() return {d: voxel_size * dim[d] for d in "xyz"} From 337d190b3b3b8b7fb87c7418c0f5ab74a9a05b10 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Mon, 9 Dec 2024 12:47:52 -0800 Subject: [PATCH 2/4] Update tests --- ingestion_tools/scripts/tests/s3_import/test_alignments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingestion_tools/scripts/tests/s3_import/test_alignments.py b/ingestion_tools/scripts/tests/s3_import/test_alignments.py index 73e04a1d2..b22cf00ba 100644 --- a/ingestion_tools/scripts/tests/s3_import/test_alignments.py +++ b/ingestion_tools/scripts/tests/s3_import/test_alignments.py @@ -281,7 +281,7 @@ def test_default_alignment_import_with_tomograms( "tilt_offset": 0, "tilt_path": None, "tiltx_path": None, - "volume_dimension": {"x": 13.48 * 6, "y": 13.48 * 8, "z": 13.48 * 10}, + "volume_dimension": {"x": 4.123 * 6, "y": 4.123 * 8, "z": 4.123 * 10}, "volume_offset": {"x": 0, "y": 0, "z": 0}, "x_rotation_offset": 0, } From 7e0603efc848fc3ef5d0d95f31d23c316268ecc7 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Mon, 9 Dec 2024 13:21:07 -0800 Subject: [PATCH 3/4] Fixing tests --- ingestion_tools/scripts/tests/s3_import/test_annotations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ingestion_tools/scripts/tests/s3_import/test_annotations.py b/ingestion_tools/scripts/tests/s3_import/test_annotations.py index 895bc382e..ca38163d2 100644 --- a/ingestion_tools/scripts/tests/s3_import/test_annotations.py +++ b/ingestion_tools/scripts/tests/s3_import/test_annotations.py @@ -106,7 +106,7 @@ def voxel_spacing_importer_factory(deposition_config: DepositionImportConfig) -> vs = VoxelSpacingImporter( config=deposition_config, metadata={}, - name="14.08", + name="1.1234", path="vs1", parents={**run.parents, **{"run": run}}, ) @@ -1499,7 +1499,7 @@ def test_ingest_triangular_mesh( # Assert # verify local_metadata - path = "dataset1/run1/Reconstructions/VoxelSpacing14.080/Annotations/100/some_protein-1.0_triangularmesh.glb" + path = "dataset1/run1/Reconstructions/VoxelSpacing1.123/Annotations/100/some_protein-1.0_triangularmesh.glb" expected_local_metadata = { "object_count": 1, "alignment_metadata_path": "foo", @@ -1568,7 +1568,7 @@ def test_ingest_triangular_mesh_hff( anno.import_metadata() # Assert # verify local_metadata - path = "dataset1/run1/Reconstructions/VoxelSpacing14.080/Annotations/100/some_protein-1.0_triangularmesh.glb" + path = "dataset1/run1/Reconstructions/VoxelSpacing1.123/Annotations/100/some_protein-1.0_triangularmesh.glb" expected_local_metadata = { "object_count": 1, "alignment_metadata_path": "foo", From a22f02189ade3c93f92ad3e4b8f38388b9b87cb1 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Mon, 9 Dec 2024 13:32:12 -0800 Subject: [PATCH 4/4] Adding comments to provide more context --- ingestion_tools/scripts/tests/s3_import/test_annotations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingestion_tools/scripts/tests/s3_import/test_annotations.py b/ingestion_tools/scripts/tests/s3_import/test_annotations.py index ca38163d2..8e9a83871 100644 --- a/ingestion_tools/scripts/tests/s3_import/test_annotations.py +++ b/ingestion_tools/scripts/tests/s3_import/test_annotations.py @@ -106,7 +106,7 @@ def voxel_spacing_importer_factory(deposition_config: DepositionImportConfig) -> vs = VoxelSpacingImporter( config=deposition_config, metadata={}, - name="1.1234", + name="1.1234", # Hardcoding this to match the value in fixtures/annotations/anno_config.yaml path="vs1", parents={**run.parents, **{"run": run}}, )