pytomography.utils.cardiac_spect#
Module Contents#
Functions#
|
Shift the 3D volume based on the given translation parameters. |
|
Rotates the volume around the transaxial and transsagittal slices. |
|
Segment the object based on the given thresholds. |
|
Calculate the shift values for the given object based on the center of mass. |
|
Get the angle of the best line passing through the center of the image. |
|
Draws an arrow from the center of the image based on the given angle and displays a polar plot around it. |
|
Create a circular mask. |
|
Apply a circular mask to the object in all three views. |
- pytomography.utils.cardiac_spect.shift_object(object, tx, ty, tz)[source]#
Shift the 3D volume based on the given translation parameters.
- Parameters:
object (torch.Tensor) – Input 3D volume to be shifted (torch.Tensor[Lx, Ly, Lz]).
tx (float) – Translation in x direction (voxels).
ty (float) – Translation in y direction (voxels).
tz (float) – Translation in z direction (voxels).
- Returns:
The shifted object (torch.Tensor[Lx, Ly, Lz]).
- Return type:
Shifted 3D volume
- pytomography.utils.cardiac_spect.rotate_object(object, transaxial_angle, transsagittal_angle)[source]#
Rotates the volume around the transaxial and transsagittal slices.
- Parameters:
object (torch.Tensor) – The 3D volume to be rotated (torch.Tensor[Lx, Ly, Lz]).
angle_transaxial (float) – The angle to rotate around the transaxial slice (z-axis).
angle_transsagittal (float) – The angle to rotate around the transsagittal slice (y-axis).
transaxial_angle (float) –
transsagittal_angle (float) –
- Returns:
The reoriented object (torch.Tensor[Lx, Ly, Lz]).
- Return type:
torch.Tensor
- pytomography.utils.cardiac_spect.get_mask(object, lowerThreshold, upperThreshold)[source]#
Segment the object based on the given thresholds.
- Parameters:
object (torch.Tensor) – torch.Tensor[Lx, Ly, Lz]
lowerThreshold (float) – Lower threshold for the binary mask
upperThreshold (float) – Upper threshold for the binary mask
- Return type:
torch.Tensor
- pytomography.utils.cardiac_spect.get_shift_values(slice)[source]#
Calculate the shift values for the given object based on the center of mass.
- Parameters:
slice (torch.Tensor) – torch.Tensor[Lx, Ly] representing the slice.
- Returns:
The shifted image. shift_values (torch.Tensor): The shift values in x and y directions.
- Return type:
shifted_image (torch.Tensor)
- pytomography.utils.cardiac_spect.get_angle(slice, angle_range_degrees)[source]#
Get the angle of the best line passing through the center of the image.
- Parameters:
slice (torch.Tensor) – torch.Tensor[Lx, Ly] representing the slice.
angle_range_degrees (torch.Tensor) – torch.Tensor[N] with angles in degrees.
- Returns:
The best angle in degrees.
- Return type:
best_angle_degree
- pytomography.utils.cardiac_spect.plot_arrow(image, angle_degrees, fontsize=10)[source]#
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.