Skip to content

Commit ed5fb64

Browse files
Read tilt axis from mdoc and send to tomographic alignment (#505)
The tilt axis is present in the mdoc files. While it isn't required for tomogram alignment, AreTomo seems less prone to predicting wrong axes when one is provided --------- Co-authored-by: Eu Pin Tien <[email protected]>
1 parent 625ca1f commit ed5fb64

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

src/murfey/client/contexts/tomo.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class TomographyContext(Context):
7979
ProcessingParameter("pixel_size_on_image", "Pixel Size"),
8080
ProcessingParameter("motion_corr_binning", "Motion Correction Binning"),
8181
ProcessingParameter("frame_count", "Number of image frames"),
82+
ProcessingParameter("tilt_axis", "Stage rotation angle"),
8283
ProcessingParameter("num_eer_frames", "Number of EER Frames"),
8384
]
8485

@@ -339,6 +340,9 @@ def _add_tilt(
339340
"frame_count": environment.data_collection_parameters.get(
340341
"frame_count", 0
341342
),
343+
"tilt_axis": environment.data_collection_parameters.get(
344+
"tilt_axis", 85
345+
),
342346
"mc_binning": environment.data_collection_parameters.get(
343347
"motion_corr_binning", 1
344348
),
@@ -570,6 +574,7 @@ def gather_metadata(
570574
mdoc_metadata["experiment_type"] = "tomography"
571575
mdoc_metadata["voltage"] = float(mdoc_data["Voltage"])
572576
mdoc_metadata["frame_count"] = int(mdoc_data_block["NumSubFrames"])
577+
mdoc_metadata["tilt_axis"] = float(mdoc_data_block["RotationAngle"])
573578
mdoc_metadata["image_size_x"] = int(mdoc_data["ImageSize"][0])
574579
mdoc_metadata["image_size_y"] = int(mdoc_data["ImageSize"][1])
575580
mdoc_metadata["magnification"] = int(mdoc_data_block["Magnification"])

src/murfey/server/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,7 @@ def feedback_callback(header: dict, message: dict) -> None:
24712471
"dose_per_frame": preproc_params.dose_per_frame,
24722472
"frame_count": preproc_params.frame_count,
24732473
"kv": preproc_params.voltage,
2474+
"tilt_axis": preproc_params.tilt_axis,
24742475
"pixel_size": preproc_params.pixel_size,
24752476
"manual_tilt_offset": -tilt_offset,
24762477
"node_creator_queue": machine_config.node_creator_queue,
@@ -2841,6 +2842,7 @@ def feedback_callback(header: dict, message: dict) -> None:
28412842
voltage=message["voltage"],
28422843
dose_per_frame=message["dose_per_frame"],
28432844
frame_count=message["frame_count"],
2845+
tilt_axis=message["tilt_axis"],
28442846
motion_corr_binning=message["motion_corr_binning"],
28452847
gain_ref=message["gain_ref"],
28462848
eer_fractionation_file=message["eer_fractionation_file"],

src/murfey/server/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ def register_completed_tilt_series(
735735
"dose_per_frame": preproc_params.dose_per_frame,
736736
"frame_count": preproc_params.frame_count,
737737
"kv": preproc_params.voltage,
738+
"tilt_axis": preproc_params.tilt_axis,
738739
"pixel_size": preproc_params.pixel_size,
739740
"manual_tilt_offset": -tilt_offset,
740741
"node_creator_queue": machine_config.node_creator_queue,

src/murfey/util/db.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ class TomographyPreprocessingParameters(SQLModel, table=True): # type: ignore
459459
pixel_size: float
460460
dose_per_frame: float
461461
frame_count: int
462+
tilt_axis: float
462463
voltage: int
463464
eer_fractionation_file: Optional[str] = None
464465
motion_corr_binning: int = 1

src/murfey/util/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ class ProcessFile(BaseModel): # Rename to TomoProcessFile
316316
pixel_size: float
317317
dose_per_frame: float
318318
frame_count: int
319+
tilt_axis: Optional[float]
319320
mc_uuid: Optional[int] = None
320321
voltage: float = 300
321322
mc_binning: int = 1
@@ -351,6 +352,7 @@ class CompletedTiltSeries(BaseModel):
351352
class PreprocessingParametersTomo(BaseModel):
352353
dose_per_frame: float
353354
frame_count: int
355+
tilt_axis: float
354356
gain_ref: Optional[str]
355357
experiment_type: str
356358
voltage: float

0 commit comments

Comments
 (0)