neuron_morphology.transforms.tilt_correction.compute_tilt_correction

Module Contents

Functions

get_tilt_correction(morphology: Morphology, soma_voxel: List[int], slice_angle_matrix: float, closest_path) Find the tilt angle between the slice plane and the nearest streamline
find_closest_path(soma_voxel: List[int], ccf_path: Union[str, IO], n_sublists: int = 2) Finds closest path to soma_voxel
determine_slice_flip(morphology: Morphology, soma_marker: Dict, slice_image_flip: bool) Determines whether the tilt correction should be positive or negative
read_soma_marker(marker_path: str)
run_tilt_correction(morphology: Morphology, soma_marker: Dict, ccf_soma_location: Dict, slice_transform: aff.AffineTransform, slice_image_flip: bool, ccf_path: Union[str, IO])
main()
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.CCF_SHAPE = [1320, 800, 1140]
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.CCF_RESOLUTION = 10
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.get_tilt_correction(morphology: Morphology, soma_voxel: List[int], slice_angle_matrix: float, closest_path)

Find the tilt angle between the slice plane and the nearest streamline

Parameters:
morphology: Morphology object
soma_voxel: soma voxel in ccf {‘x’: , ‘y’: , ‘z’: }
slice_angle_matrix: 4 x 4 affine matrix of the slice plane

relative to ccf

closest_path: 3 x N array of voxel coordinates in closest streamline,

only first (wm end) and last (pia end) coordinates are used. In future the tilt correction may be refined to use the entire path.

Returns:
tilt angle correction (radians)
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.find_closest_path(soma_voxel: List[int], ccf_path: Union[str, IO], n_sublists: int = 2)

Finds closest path to soma_voxel

Parameters:
soma_voxel: List containing soma voxel ccf coordinates
ccf_path: str, FilePath, or File-like object openable by H5PY
n_sublists: will seperate path_ids into n sublists to load in

at a time. Higher values decrease memory usage but increase processing time. n = 1 uses about 16GB

Returns:
closest_path: array of voxel coordinates of the closest streamline
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.determine_slice_flip(morphology: Morphology, soma_marker: Dict, slice_image_flip: bool)

Determines whether the tilt correction should be positive or negative

Parameters:
morphology: Morphology object
soma_marker: soma marker dictionary from reconstruction marker file
slice_image_flip: indicates whether the image was flipped relative

to the slice (e.g the z axis of the image is opposite to the z axis in the slice)

Returns:
flip_toggle -1 or 1 to be multiplied against tilt correction
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.read_soma_marker(marker_path: str)
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.run_tilt_correction(morphology: Morphology, soma_marker: Dict, ccf_soma_location: Dict, slice_transform: aff.AffineTransform, slice_image_flip: bool, ccf_path: Union[str, IO])
neuron_morphology.transforms.tilt_correction.compute_tilt_correction.main()