17
17
18
18
import argparse
19
19
import sys
20
+ from typing import Union
20
21
21
22
import matplotlib .pyplot as plt
22
23
import numpy as np
32
33
}
33
34
34
35
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 ] :
36
37
"""
37
38
Load a Projdata file and convert it to a NumPy array.
38
39
Args:
@@ -53,7 +54,7 @@ def get_projdata_from_file_as_numpy(filename: str) -> np.ndarray | None:
53
54
return None
54
55
55
56
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 ] :
57
58
"""
58
59
Get the projection data from a file or object.
59
60
Args:
@@ -80,7 +81,7 @@ def get_projection_data_as_array(f: str | stir.ProjData) -> np.ndarray | None:
80
81
81
82
def compress_and_extract_1d_from_nd_array (data : np .ndarray ,
82
83
display_axis : int ,
83
- axes_indices : list [int | None ] | None = None
84
+ axes_indices : Union [ list [Union [ int , None ]], None ] = None
84
85
) -> np .ndarray :
85
86
"""
86
87
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,
125
126
return data
126
127
127
128
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 ] ],
129
130
display_axis : int = 3 ,
130
- data_indices : list [int | None ] | None = None ,
131
+ data_indices : Union [ list [Union [ int , None ]], None ] = None ,
131
132
) -> None :
132
133
"""
133
134
Plots the profiles of the projection data.
0 commit comments