sphere2dice.py
def _rotate_sphere(xz_turn: tuple, _is_right: bool, _sphere: np.ndarray):
    """
    Return rotated sphere coordinates as rotated in Z-X order,
    taking into account flipping Right Hemispheres over X-axis to match left hemi.
    :param xz_turn: A tuple of length 2 with X and Z rotation respectively
    :param _is_right: A boolean
    :param _sphere: A numpy array containing sphere coordinates
    :return sphere_r: A numpy array containing rotated sphere coordinates
    """
    # Extract and copy variables
    x_turn, z_turn = xz_turn
    rotated_sphere = deepcopy(_sphere)
    # Flip over X-axis if if is a right hemisphere
    if _is_right:
        # Flip axis for right to match left
        rotated_sphere[:, 0] *= -1
        # We found out that we need to correct the right hemisphere for a slight wobble
        _correction_turn = (-4.11, 12.89, -10.56)  # USED CORRECTION FROM GRIDSEARCH
        _correction = R.from_rotvec(np.radians(np.array(_correction_turn)))
        rotated_sphere = _correction.apply(rotated_sphere)
    # Rotate over Z-axis if the turn over Z is not 0
    if z_turn:
        _rotation = R.from_rotvec(np.radians(np.array((0, 0, z_turn))))
        rotated_sphere = _rotation.apply(rotated_sphere)
    # Rotate over X-axis if the turn over X is not zero
    if x_turn:
        _rotation = R.from_rotvec(np.radians(np.array((x_turn, 0, 0))))
        rotated_sphere = _rotation.apply(rotated_sphere)
    return rotated_sphere

    Return rotated sphere coordinates as rotated in Z-X order,
    taking into account flipping Right Hemispheres over X-axis to match left hemi.
    :param xz_turn: A tuple of length 2 with X and Z rotation respectively
    :param _is_right: A boolean
    :param _sphere: A numpy array containing sphere coordinates
    :return sphere_r: A numpy array containing rotated sphere coordinates
    
Return rotated sphere coordinates as rotated in Z-X order,
taking into account flipping Right Hemispheres over X-axis to match left hemi.
Return rotated sphere coordinates as rotated in Z - X order taking into account flipping Right Hemispheres over X - axis to match left hemi .
def _rotate_sphere(xz_turn: tuple, _is_right: bool, _sphere: np.ndarray):
    x_turn, z_turn = xz_turn
    rotated_sphere = deepcopy(_sphere)
    if _is_right:
        rotated_sphere[:, 0] *= -1
        _correction_turn = (-4.11, 12.89, -10.56)  
        _correction = R.from_rotvec(np.radians(np.array(_correction_turn)))
        rotated_sphere = _correction.apply(rotated_sphere)
    if z_turn:
        _rotation = R.from_rotvec(np.radians(np.array((0, 0, z_turn))))
        rotated_sphere = _rotation.apply(rotated_sphere)
    if x_turn:
        _rotation = R.from_rotvec(np.radians(np.array((x_turn, 0, 0))))
        rotated_sphere = _rotation.apply(rotated_sphere)
    return rotated_sphere
def _rotate_sphere ( xz_turn : tuple , _is_right : bool , _sphere : np . ndarray ) : x_turn , z_turn = xz_turn rotated_sphere = deepcopy ( _sphere ) if _is_right : rotated_sphere [ : , 0 ] *= - 1 _correction_turn = ( - 4.11 , 12.89 , - 10.56 ) _correction = R . from_rotvec ( np . radians ( np . array ( _correction_turn ) ) ) rotated_sphere = _correction . apply ( rotated_sphere ) if z_turn : _rotation = R . from_rotvec ( np . radians ( np . array ( ( 0 , 0 , z_turn ) ) ) ) rotated_sphere = _rotation . apply ( rotated_sphere ) if x_turn : _rotation = R . from_rotvec ( np . radians ( np . array ( ( x_turn , 0 , 0 ) ) ) ) rotated_sphere = _rotation . apply ( rotated_sphere ) return rotated_sphere
Return rotated sphere coordinates as rotated in Z-X order,
taking into account flipping Right Hemispheres over X-axis to match left hemi.
Return rotated sphere coordinates as rotated in Z - X order taking into account flipping Right Hemispheres over X - axis to match left hemi .
"""
    Return rotated sphere coordinates as rotated in Z-X order,
    taking into account flipping Right Hemispheres over X-axis to match left hemi.
    :param xz_turn: A tuple of length 2 with X and Z rotation respectively
    :param _is_right: A boolean
    :param _sphere: A numpy array containing sphere coordinates
    :return sphere_r: A numpy array containing rotated sphere coordinates
    """ # Extract and copy variables # Flip over X-axis if if is a right hemisphere # Flip axis for right to match left # We found out that we need to correct the right hemisphere for a slight wobble # USED CORRECTION FROM GRIDSEARCH # Rotate over Z-axis if the turn over Z is not 0 # Rotate over X-axis if the turn over X is not zero
A numpy array containing rotated sphere coordinates
A numpy array containing rotated sphere coordinates
sphere_r
xz_turn
tuple
A tuple of length 2 with X and Z rotation respectively
A tuple of length 2 with X and Z rotation respectively
_is_right
bool
None
_sphere
np.ndarray
A numpy array containing sphere coordinates
A numpy array containing sphere coordinates