Utilities#

Functions that are used in exhaustive and non-exhaustive template matching or are specific to template matching in general are grouped in the utilities module.

Masks#

box_mask(shape, center, height)

Creates a box mask centered around the provided center point.

create_mask(mask_type[, sigma_decay])

Creates a mask of the specified type.

tube_mask(shape, symmetry_axis, base_center, ...)

Creates a tube mask.

elliptical_mask(shape, radius, center)

Creates an ellipsoidal mask.

Rotations#

get_rotation_matrices(angular_sampling[, ...])

Returns rotation matrices with desired angular_sampling rate.

euler_to_rotationmatrix(angles[, convention])

Convert Euler angles to a rotation matrix.

rotation_aligning_vectors(initial_vector[, ...])

Compute the rotation matrix or Euler angles required to align an initial vector with a target vector.

euler_from_rotationmatrix(rotation_matrix[, ...])

Convert a rotation matrix to euler angles.

load_quaternions_by_angle(angular_sampling)

Get orientations and weights proportional to the given angular_sampling.

get_rotations_around_vector(cone_angle, ...)

Generate rotations describing the possible placements of a vector in a cone.

quaternion_to_rotation_matrix(quaternions)

Convert quaternions to rotation matrices.

Subsetting#

centered(arr, new_shape)

Extract the centered portion of an array based on a new shape.

split_shape(shape, splits[, equal_shape])

Splits shape into equally sized and potentially overlapping subsets.

centered_mask(arr, new_shape)

Mask the centered portion of an array based on a new shape.

apply_convolution_mode(arr, ...[, ...])

Applies convolution_mode to arr.

compute_full_convolution_index(outer_shape, ...)

Computes the position of the convolution of pieces in the full convolution.

compute_parallelization_schedule(shape1, ...)

Computes a parallelization schedule for a given computation.

Serialization#

load_pickle(filename)

Load and deserialize data written by write_pickle().

write_pickle(data, filename)

Serialize and write data to a file invalidating the input data.

Utilities#

scramble_phases(arr[, noise_proportion, ...])

Perform random phase scrambling of arr.

rigid_transform(coordinates, ...[, ...])

Apply a rigid transformation (rotation and translation) to given coordinates.

array_to_memmap(arr[, filename])

Converts a obj:numpy.ndarray to a obj:numpy.memmap.

memmap_to_array(arr)

Convert a obj:numpy.memmap to a obj:numpy.ndarray and delete the memmap.

normalize_template(template, mask, ...)

Standardizes template to zero mean and unit standard deviation in mask.

conditional_execute(func, execute_operation)

Return the given function or a no-op function based on execute_operation.

minimum_enclosing_box(coordinates[, margin, ...])

Computes the minimal enclosing box around coordinates with margin.

generate_tempfile_name([suffix])

Returns the path to a temporary file with given suffix.