
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
cryotypes
Advanced tools
cryotypes defines a set of super-simple, extensible data structures for the fundamental types of cryoEM data and their relevant metadata:
PoseSet: a set of particle poses, compatible with 2D and 3D dataProjectionModel: a set of parameters for a projection model (tilt-series alignments)Tomogram: a 3D imageMicrograph: a 2D imageEach cryotype defines an experiment_id attribute which is intended as a unique identifier for individual experiments. This can be used, for example, to match particles to the correct tilt series and tomogram.
ImageAn Image is a dataclass holding a simple data array and some metadata.
| Field | Semantics |
|---|---|
data | image data (ZYX ordering) |
experiment_id | identifier for micrograph/tilt-series |
pixel_spacing | isotropic pixel/voxel spacing |
source | the source file of this data |
stack | whether the data represent a stack of 2D images |
PoseSetA PoseSet is a dataclass with a few fields describing positions, orientations and so on for a set of particles. It can be used for both 2D and 3D particle poses.
| Field | Semantics |
|---|---|
position | particle positions (x, y, z) in pixels |
shift | particle shifts (x, y, z) in pixels |
orientation | particle orientation |
experiment_id | identifier for micrograph/tilt-series |
pixel_spacing | isotropic pixel/voxel spacing for particle positions |
source | the source file of this data |
Particle positions are coordinates in 2D or 3D images (for 2D, z is simply set to 0).
The center of the first pixel is taken to be the origin (0, 0, 0) and the units of
particle positions are pixels.
Particle shifts are in image pixels and are additive to positions,
such that POSITION + SHIFT is the position of the particle in the tomogram.
Particle orientations are stored as
scipy.spatial.transform.Rotation
objects. These transformations should rotate the basis vectors (ordered xyz) of a reference such
that they are correctly oriented in a tomogram.
Note: this yields rotated basis vectored ordered xyz whilst dimensions in an image are normally zyx!
ProjectionModelA ProjectionModel is a pandas DataFrame with specific column
headings for the parameters of a projection model. Together, this information constitues a 'tilt-series alignment'.
| Heading | Python name | Semantics |
|---|---|---|
rotation_x | ROTATION_X | specimen rotation around x-axis |
rotation_y | ROTATION_Y | specimen rotation around y-axis |
rotation_z | ROTATION_Z | specimen rotation around z-axis |
dx | SHIFT_X | specimen shift in x-dimension of the camera plane |
dy | SHIFT_Y | particle shift in y-dimension of the camera plane |
experiment_id | EXPERIMENT_ID | identifier for micrograph/tilt-series |
pixel_spacing | PIXEL_SPACING | isotropic pixel/voxel spacing for shifts |
source | SOURCE | reference to the file from which data came |
In the microsope reference frame, the z-axis is the beam direction.
Extrinsic rotation of the tomogram around the x-axis, the y-axis, then the z-axis by
rotation_x, rotation_y, rotation_z followed by projection along the z-axis (beam direction)
then shifting the 2D image in the camera plane by dx and dy produces the experimental projection
image.
A utility function is also provided for generating projection matrices from these data. These projection matrices can be used to calculate a 2D position in a tilt-image from a 3D position in the tomogram.
from cryotypes.projectionmodel import projection_model_to_projection_matrices
projection_matrices = projection_model_to_projection_matrices(
df=projection_model, # ProjectionModel dataframe
tilt_image_center=(1919, 1355), # tilt-image rotation center (xy)
tomogram_dimensions=(3838, 3710, 2000) # dimensions of tomogram (xyz)
)
Note: these projection matrices are only valid for positions in a tomogram of the dimensions provided in this function and must be recalculated for different tomogram dimensions.
TomogramA Tomogram is an object that follows a specific
python Protocol
for tomogram data. The protocol specifies the following attributes:
data: an array-like 3D image (numpy, dask, ...)experiment_id: experimental identifierpixel_spacing: isotropic pixel/voxel spacingFAQs
Generalized python types and validators for cryoEM data.
We found that cryotypes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.