Tilt-axis angle optimization for tilt series using common lines in PyTorch
Project description
torch-refine-tilt-axis-angle
Tilt-axis angle optimization for tilt series using common lines.
Overview
torch-refine-tilt-axis-angle provides an implementation for finding the in plane rotation for a tilt-series that aligns the tilt axis with the y-axis. This is done by extracting lines from the 2D Fourier transform of the tilt-series images and minimizing the mean squared error between them, i.e. the common lines. It makes use of the pytorch LBFGS optimizer to find the minimum.
Installation
pip install torch-refine-tilt-axis-angle
Usage
import torch
from torch_refine_tilt_axis_angle import refine_tilt_axis_angle
# Load or create your tilt series
# tilt_series shape: (batch, height, width) - batch is number of tilt images
# Example: tilt_series with shape (61, 512, 512) - 61 tilt images of 512x512 pixels
tilt_series = torch.randn(61, 512, 512)
# Specify an initial guess for the tilt axis angle (the default is 0.0)
# This can be the value from an MDOC file.
initial_tilt_axis_angle = 50.0
# Run tilt axis angle refinement.
new_tilt_axis_angle = refine_tilt_axis_angle(
tilt_series=tilt_series,
tilt_axis_angle=initial_tilt_axis_angle,
# grid_points=1, # optionally increase the spline grid points (default 1)
# return_single_angle=False, # optionally write out an angle for each image
)
Use uv to run an example with simulated data and visualize the results.
uv run examples/simulate_tilt_axis_refinement.py
License
This package is distributed under the BSD 3-Clause License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_refine_tilt_axis_angle-0.5.0.tar.gz.
File metadata
- Download URL: torch_refine_tilt_axis_angle-0.5.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fa97b67b398cdae542779d6e3c284edbeeae00b042fee5227597bc2a812f9ed
|
|
| MD5 |
039c99893754376847d4a53f57c779c5
|
|
| BLAKE2b-256 |
31c0c46455ffedfe4aa715c2086e60ed37945a32ee94927b762a451961bbd28b
|
Provenance
The following attestation bundles were made for torch_refine_tilt_axis_angle-0.5.0.tar.gz:
Publisher:
deploy.yml on teamtomo/teamtomo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_refine_tilt_axis_angle-0.5.0.tar.gz -
Subject digest:
9fa97b67b398cdae542779d6e3c284edbeeae00b042fee5227597bc2a812f9ed - Sigstore transparency entry: 1296489852
- Sigstore integration time:
-
Permalink:
teamtomo/teamtomo@baba0e44c05bb4a1cdb0c41ea31341cba62ce87d -
Branch / Tag:
refs/tags/torch-refine-tilt-axis-angle@v0.5.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@baba0e44c05bb4a1cdb0c41ea31341cba62ce87d -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_refine_tilt_axis_angle-0.5.0-py3-none-any.whl.
File metadata
- Download URL: torch_refine_tilt_axis_angle-0.5.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b63ee2e262a27159804cb592c62452c2b88b9a11d817f9ab6476b0e2043ed00
|
|
| MD5 |
89c0231f42666cef0f8185416706db40
|
|
| BLAKE2b-256 |
5403a24fd87474d3711d89333c4832e568b28227be71bbc3b3769bc0a937a4bc
|
Provenance
The following attestation bundles were made for torch_refine_tilt_axis_angle-0.5.0-py3-none-any.whl:
Publisher:
deploy.yml on teamtomo/teamtomo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_refine_tilt_axis_angle-0.5.0-py3-none-any.whl -
Subject digest:
0b63ee2e262a27159804cb592c62452c2b88b9a11d817f9ab6476b0e2043ed00 - Sigstore transparency entry: 1296489946
- Sigstore integration time:
-
Permalink:
teamtomo/teamtomo@baba0e44c05bb4a1cdb0c41ea31341cba62ce87d -
Branch / Tag:
refs/tags/torch-refine-tilt-axis-angle@v0.5.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@baba0e44c05bb4a1cdb0c41ea31341cba62ce87d -
Trigger Event:
release
-
Statement type: