Orientations#
- class Orientations(translations, rotations, scores, details)[source]#
Bases:
objectHandle template matching orientations and conversion between formats.
- Parameters:
- translations: np.ndarray
Array with translations of each orientations (n, d).
- rotations: np.ndarray
Array with euler angles of each orientation in zxy convention (n, d).
- scores: np.ndarray
Array with the score of each orientation (n, ).
- details: np.ndarray
Array with additional orientation details (n, ).
Examples
The following achieves the minimal definition of an
Orientationsinstance>>> import numpy as np >>> from tme import Orientations >>> translations = np.random.randint(low = 0, high = 100, size = (100,3)) >>> rotations = np.random.rand(100, 3) >>> scores = np.random.rand(100) >>> details = np.full((100,), fill_value = -1) >>> orientations = Orientations( >>> translations = translations, >>> rotations = rotations, >>> scores = scores, >>> details = details, >>> )
The created
orientationsobject can be written to disk in a range of formats. SeeOrientations.to_file()for available formats. The following creates a STAR file>>> orientations.to_file("test.star")
Orientations.from_file()can createOrientationsinstances from a range of formats, to enable conversion between formats>>> orientations_star = Orientations.from_file("test.star") >>> np.all(orientations.translations == orientations_star.translations) True
Attributes
Array with translations of each orientation (n, d).
Array with zyz euler angles of each orientation (n, d).
Array with scores of each orientation (n, ).
Array with additional details of each orientation(n, ).
Methods
Create a copy of the current class instance.
Orientations.from_file(filename[, file_format])Create an instance of
Orientationsfrom a file.Orientations.get_extraction_slices(...[, ...])Calculate slices for extracting regions of interest within a larger array.
Orientations.to_file(filename[, file_format])Save the current class instance to a file in the specified format.