Skip to content

Commit

Permalink
fix: consider both scan rotation and stage rotation for tfs metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcleeve2 committed Mar 1, 2024
1 parent 018cab4 commit b1d918b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/odemis/dataio/test/tiff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2369,14 +2369,15 @@ def test_convert_thermo_fisher_to_odemis_metadata(self):
model.MD_PIXEL_SIZE: (2.69792e-07, 2.69792e-07),
model.MD_DWELL_TIME: 1e-6,
model.MD_POS: (0.000133417, -0.000717625),
model.MD_ROTATION: 0.0,
model.MD_ROTATION: 0.0,
model.MD_EBEAM_VOLTAGE: 2000.0,
model.MD_EBEAM_CURRENT: 1.41708e-11,
model.MD_EBEAM_SPOT_DIAM: 5.181,
model.MD_ACQ_TYPE: model.MD_AT_EM,
model.MD_DET_TYPE: model.MD_DT_NORMAL,
model.MD_DESCRIPTION: os.path.basename(TFS_FILENAME).replace(".tif", ""),
}
# TODO: add a test with scan rotation + stage rotation

for key in md.keys():
self.assertIn(key, data.content[0].metadata)
Expand Down
4 changes: 3 additions & 1 deletion src/odemis/dataio/tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2743,7 +2743,9 @@ def _convert_thermo_fisher_to_odemis_metadata(metadata: str) -> dict:
try:
# beam metadata
beam_type = tfs_md["Beam"]["beam"]
md[model.MD_ROTATION] = float(tfs_md[beam_type]["scanrotation"])
# add stage rotation to scan rotation, as odemis does not have stage rotation metadata
stage_rotation = float(tfs_md["Stage"].get("rotation", 0))
md[model.MD_ROTATION] = float(tfs_md[beam_type]["scanrotation"]) + stage_rotation
md[model.MD_EBEAM_VOLTAGE] = float(tfs_md[beam_type]["hv"])
md[model.MD_EBEAM_CURRENT] = float(tfs_md[beam_type]["beamcurrent"])

Expand Down

0 comments on commit b1d918b

Please sign in to comment.