:py:mod:`pytomography.utils.cardiac_spect` ========================================== .. py:module:: pytomography.utils.cardiac_spect Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: pytomography.utils.cardiac_spect.shift_object pytomography.utils.cardiac_spect.rotate_object pytomography.utils.cardiac_spect.get_mask pytomography.utils.cardiac_spect.get_shift_values pytomography.utils.cardiac_spect.get_angle pytomography.utils.cardiac_spect.plot_arrow pytomography.utils.cardiac_spect.create_circular_mask pytomography.utils.cardiac_spect.masking .. py:function:: shift_object(object, tx, ty, tz) Shift the 3D volume based on the given translation parameters. :param object: Input 3D volume to be shifted (torch.Tensor[Lx, Ly, Lz]). :param tx: Translation in x direction (voxels). :type tx: float :param ty: Translation in y direction (voxels). :type ty: float :param tz: Translation in z direction (voxels). :type tz: float :returns: The shifted object (torch.Tensor[Lx, Ly, Lz]). :rtype: Shifted 3D volume .. py:function:: rotate_object(object, transaxial_angle, transsagittal_angle) Rotates the volume around the transaxial and transsagittal slices. :param object: The 3D volume to be rotated (torch.Tensor[Lx, Ly, Lz]). :param angle_transaxial: The angle to rotate around the transaxial slice (z-axis). :type angle_transaxial: float :param angle_transsagittal: The angle to rotate around the transsagittal slice (y-axis). :type angle_transsagittal: float :returns: The reoriented object (torch.Tensor[Lx, Ly, Lz]). .. py:function:: get_mask(object, lowerThreshold, upperThreshold) Segment the object based on the given thresholds. :param object: torch.Tensor[Lx, Ly, Lz] :param lowerThreshold: Lower threshold for the binary mask :param upperThreshold: Upper threshold for the binary mask .. py:function:: get_shift_values(slice) Calculate the shift values for the given object based on the center of mass. :param slice: torch.Tensor[Lx, Ly] representing the slice. :type slice: torch.Tensor :returns: The shifted image. shift_values (torch.Tensor): The shift values in x and y directions. :rtype: shifted_image (torch.Tensor) .. py:function:: get_angle(slice, angle_range_degrees) Get the angle of the best line passing through the center of the image. :param slice: torch.Tensor[Lx, Ly] representing the slice. :type slice: torch.Tensor :param angle_range_degrees: torch.Tensor[N] with angles in degrees. :type angle_range_degrees: torch.Tensor :returns: The best angle in degrees. :rtype: best_angle_degree .. py:function:: plot_arrow(image, angle_degrees, fontsize=10) Draws an arrow from the center of the image based on the given angle and displays a polar plot around it. The angle is also displayed inside the plot. Parameters: image (np.ndarray): 2D numpy array representing the image. angle_degrees (float): Angle of the arrow with respect to the vertical, measured clockwise. .. py:function:: create_circular_mask(height, width, radius) Create a circular mask. .. py:function:: masking(object, radius) Apply a circular mask to the object in all three views.