:mod:`neuron_morphology.transforms.tilt_correction.compute_tilt_correction` =========================================================================== .. py:module:: neuron_morphology.transforms.tilt_correction.compute_tilt_correction Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: neuron_morphology.transforms.tilt_correction.compute_tilt_correction.get_tilt_correction neuron_morphology.transforms.tilt_correction.compute_tilt_correction.find_closest_path neuron_morphology.transforms.tilt_correction.compute_tilt_correction.determine_slice_flip neuron_morphology.transforms.tilt_correction.compute_tilt_correction.read_soma_marker neuron_morphology.transforms.tilt_correction.compute_tilt_correction.run_tilt_correction neuron_morphology.transforms.tilt_correction.compute_tilt_correction.main .. data:: CCF_SHAPE :annotation: = [1320, 800, 1140] .. data:: CCF_RESOLUTION :annotation: = 10 .. function:: 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) .. .. !! processed by numpydoc !! .. function:: 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 .. .. !! processed by numpydoc !! .. function:: 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 .. .. !! processed by numpydoc !! .. function:: read_soma_marker(marker_path: str) .. function:: 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]) .. function:: main()