Skip to content

Commit

Permalink
fix: Updating alignment dimensions and offsets to Angstrom (#323)
Browse files Browse the repository at this point in the history
* Updating alignment dimensions and offsets to Angstrom

* Updating dimensions to image size
  • Loading branch information
manasaV3 authored Oct 16, 2024
1 parent 5fac83e commit e4a74a2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
4 changes: 3 additions & 1 deletion ingestion_tools/scripts/importers/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ 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()
return tomogram.get_source_volume_info().get_dimensions()
voxel_size = round(tomogram.get_source_volume_info().voxel_size, 3)
dim = tomogram.get_source_volume_info().get_dimensions()
return {d: voxel_size * dim[d] for d in "xyz"}

def is_default_alignment(self) -> bool:
return "default" in self.file_paths
Expand Down
6 changes: 3 additions & 3 deletions ingestion_tools/scripts/tests/s3_import/test_alignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_alignment_import_item(
"tilt_offset": -0.3,
"tilt_path": f"{prefix}/{id_prefix}/TS_run1.tlt",
"tiltx_path": f"{prefix}/{id_prefix}/TS_run1.xtilt",
"volume_dimension": {"x": 6, "y": 8, "z": 10},
"volume_dimension": {"x": 13.48 * 6, "y": 13.48 * 8, "z": 13.48 * 10},
"volume_offset": {"x": -1, "y": 2, "z": -3},
"x_rotation_offset": -2.3,
}
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_alignment_import_item_aretomo(
"tilt_offset": -0.3,
"tilt_path": None,
"tiltx_path": None,
"volume_dimension": {"x": 6, "y": 8, "z": 10},
"volume_dimension": {"x": 13.48 * 6, "y": 13.48 * 8, "z": 13.48 * 10},
"volume_offset": {"x": -1, "y": 2, "z": -3},
"x_rotation_offset": -2.3,
}
Expand Down Expand Up @@ -281,7 +281,7 @@ def test_default_alignment_import_with_tomograms(
"tilt_offset": 0,
"tilt_path": None,
"tiltx_path": None,
"volume_dimension": {"x": 6, "y": 8, "z": 10},
"volume_dimension": {"x": 13.48 * 6, "y": 13.48 * 8, "z": 13.48 * 10},
"volume_offset": {"x": 0, "y": 0, "z": 0},
"x_rotation_offset": 0,
}
Expand Down
66 changes: 33 additions & 33 deletions schema/core/v2.0.0/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -752,65 +752,65 @@ classes:
attributes:
x:
any_of:
- range: integer
- range: IntegerFormattedString
- range: float
- range: FloatFormattedString
required: true
description: Number of pixels in the 3D data fast axis
description: X dimension of the reconstruction volume in angstrom
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å
y:
any_of:
- range: integer
- range: IntegerFormattedString
- range: float
- range: FloatFormattedString
required: true
description: Number of pixels in the 3D data medium axis
description: Y dimension of the reconstruction volume in angstrom
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å
z:
any_of:
- range: integer
- range: IntegerFormattedString
- range: float
- range: FloatFormattedString
required: true
description: Number of pixels in the 3D data slow axis. This is the image projection direction at zero stage tilt
description: Z dimension of the reconstruction volume in angstrom
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å

AlignmentOffset:
description: &desc_alignment_offset The offset of a alignment in voxels in each dimension relative to the canonical tomogram.
attributes:
x:
any_of:
- range: integer
- range: cdp-common:IntegerFormattedString
- range: float
- range: cdp-common:FloatFormattedString
required: true
description: x offset relative to the canonical tomogram in pixels
ifabsent: "int(0)"
description: X shift of the reconstruction volume in angstrom
ifabsent: "float(0)"
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å
y:
any_of:
- range: integer
- range: cdp-common:IntegerFormattedString
- range: float
- range: cdp-common:FloatFormattedString
required: true
description: y offset relative to the canonical tomogram in pixels
ifabsent: "int(0)"
description: Y shift of the reconstruction volume in angstrom
ifabsent: "float(0)"
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å
z:
any_of:
- range: integer
- range: cdp-common:IntegerFormattedString
- range: float
- range: cdp-common:FloatFormattedString
required: true
ifabsent: "int(0)"
description: z offset relative to the canonical tomogram in pixels
description: Z shift of the reconstruction volume in angstrom
ifabsent: "float(0)"
unit:
descriptive_name: pixels
symbol: px
descriptive_name: Angstrom
symbol: Å


Alignment:
Expand Down

0 comments on commit e4a74a2

Please sign in to comment.