Skip to content

Commit

Permalink
Add tiltcor
Browse files Browse the repository at this point in the history
  • Loading branch information
EuanPyle committed Jun 1, 2022
1 parent df37969 commit c96800d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lil_aretomo/aretomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ 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] = 800,
correct_tilt_angle_offset: Optional[bool] = False
):
"""Run aretomo alignment on a single tilt-series
Expand All @@ -42,6 +43,8 @@ def run_aretomo_alignment(
(optional) thickness_for_alignment: thickness in Z in unbinned pixels 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.
(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
"""
if check_aretomo_availability() is False:
e = 'AreTomo is not available for use. Load AreTomo so it can be called from the terminal via: AreTomo.'
Expand All @@ -67,5 +70,6 @@ def run_aretomo_alignment(
nominal_rotation_angle=nominal_rotation_angle,
local_alignments=local_align,
n_patches_xy=n_patches_xy,
thickness_for_alignment=thickness_for_alignment
thickness_for_alignment=thickness_for_alignment,
correct_tilt_angle_offset=correct_tilt_angle_offset
)
7 changes: 6 additions & 1 deletion lil_aretomo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ 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: float,
correct_tilt_angle_offset: bool
):
output_file_name = Path(
f'{output_directory}/{tilt_series_file.stem}_aln{tilt_series_file.suffix}')
Expand All @@ -60,6 +61,10 @@ def align_tilt_series_aretomo(
command.append(f'{n_patches_xy[0]}')
command.append(f'{n_patches_xy[1]}')

if correct_tilt_angle_offset:
command.append('-TiltCor')
command.append('1')

subprocess.run(command)

# Rename .tlt
Expand Down

0 comments on commit c96800d

Please sign in to comment.