1717
1818import argparse
1919import sys
20+ from typing import Union
2021
2122import matplotlib .pyplot as plt
2223import numpy as np
3233}
3334
3435
35- def get_projdata_from_file_as_numpy (filename : str ) -> np .ndarray | None :
36+ def get_projdata_from_file_as_numpy (filename : str ) -> Union [ np .ndarray , None ] :
3637 """
3738 Load a Projdata file and convert it to a NumPy array.
3839 Args:
@@ -53,7 +54,7 @@ def get_projdata_from_file_as_numpy(filename: str) -> np.ndarray | None:
5354 return None
5455
5556
56- def get_projection_data_as_array (f : str | stir .ProjData ) -> np .ndarray | None :
57+ def get_projection_data_as_array (f : Union [ str , stir .ProjData ] ) -> Union [ np .ndarray , None ] :
5758 """
5859 Get the projection data from a file or object.
5960 Args:
@@ -80,7 +81,7 @@ def get_projection_data_as_array(f: str | stir.ProjData) -> np.ndarray | None:
8081
8182def compress_and_extract_1d_from_nd_array (data : np .ndarray ,
8283 display_axis : int ,
83- axes_indices : list [int | None ] | None = None
84+ axes_indices : Union [ list [Union [ int , None ]], None ] = None
8485 ) -> np .ndarray :
8586 """
8687 Generate a 1D array from an n-dimensional NumPy array based on specified parameters.
@@ -125,9 +126,9 @@ def compress_and_extract_1d_from_nd_array(data: np.ndarray,
125126 return data
126127
127128
128- def plot_projdata_profiles (projection_data_list : list [stir .ProjData ] | list [str ],
129+ def plot_projdata_profiles (projection_data_list : Union [ list [stir .ProjData ], list [str ] ],
129130 display_axis : int = 3 ,
130- data_indices : list [int | None ] | None = None ,
131+ data_indices : Union [ list [Union [ int , None ]], None ] = None ,
131132 ) -> None :
132133 """
133134 Plots the profiles of the projection data.
0 commit comments