Skip to content

Commit

Permalink
Merge pull request #23 from EuanPyle/align_z_to_unbinned_px
Browse files Browse the repository at this point in the history
Convert rln input in A to unbinned pixels for Align_Z
  • Loading branch information
EuanPyle authored Jun 10, 2022
2 parents 257a58e + 66d0835 commit ce3a69e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 9 additions & 3 deletions lil_aretomo/aretomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
align_tilt_series_aretomo,
find_binning_factor,
check_aretomo_availability,
thickness_ang2pix,
)

console = Console(record=True)
Expand All @@ -21,7 +22,7 @@ def run_aretomo_alignment(
target_pixel_size: Optional[float] = 10,
nominal_rotation_angle: Optional[float] = None,
n_patches_xy: Optional[Tuple[int, int]] = (5, 4),
thickness_for_alignment: Optional[float] = 800,
thickness_for_alignment: Optional[float] = 1500,
correct_tilt_angle_offset: Optional[bool] = False
):
"""Run aretomo alignment on a single tilt-series
Expand All @@ -40,9 +41,9 @@ def run_aretomo_alignment(
axis. AreTomo does not need this information but it might help.
(optional) n_patches_xy: if local_align is True, AreTomo will carry out patch tracking.
Specify the number of patches in X and Y here as tuple. Default is 5 in X,4 in Y.
(optional) thickness_for_alignment: thickness in Z in unbinned pixels for which AreTomo will use in the alignment.
(optional) thickness_for_alignment: thickness in Z in Ang for which AreTomo will use in the alignment.
This is useful is there is a lot of empty space at the top and bottom of your tomogram.
See AreTomo manual for full explanation: this sets -AlignZ. Default is 800.
See AreTomo manual for full explanation: this sets -AlignZ. Default is 1500.
(optional) correct_tilt_angle_offset: Apply tilt angle offset correction, yes or no.
Default is no. See AreTomo manual for full explanation: yes; adds the -TiltCor 1 argument
"""
Expand All @@ -62,6 +63,11 @@ def run_aretomo_alignment(
target_pixel_size=target_pixel_size
)

thickness_for_alignment = thickness_ang2pix(
pixel_size=pixel_size,
thickness_for_alignment=thickness_for_alignment
)

align_tilt_series_aretomo(
tilt_series_file=tilt_series_file,
output_directory=output_directory,
Expand Down
9 changes: 8 additions & 1 deletion lil_aretomo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def align_tilt_series_aretomo(
nominal_rotation_angle: bool or float,
local_alignments: bool,
n_patches_xy: Tuple[int, int],
thickness_for_alignment: float,
thickness_for_alignment: int,
correct_tilt_angle_offset: bool
):
output_file_name = Path(
Expand Down Expand Up @@ -96,3 +96,10 @@ def force_symlink(src: Path, link_name: Path):
def check_aretomo_availability():
"""Check for an installation of AreTomo on the PATH."""
return shutil.which('AreTomo') is not None

def thickness_ang2pix(
pixel_size: float,
thickness_for_alignment: float
) -> int:
thickness_for_alignment = round(thickness_for_alignment / pixel_size)
return thickness_for_alignment

0 comments on commit ce3a69e

Please sign in to comment.