Coverage for crip\_typing.py: 100%
21 statements
« prev ^ index » next coverage.py v7.5.2, created at 2024-07-16 01:15 +0800
« prev ^ index » next coverage.py v7.5.2, created at 2024-07-16 01:15 +0800
1'''
2 Internal typing module of crip.
4 https://github.com/SEU-CT-Recon/crip
5'''
7import numpy as np
8from typing import List, Union, Any, Dict, Callable, Iterable, Tuple, Sequence
10DefaultFloatDType = np.float32 # Default data type for decimal numbers
11DefaultEnergyUnit = 'keV' # Default energy unit
12DefaultMuUnit = 'mm-1' # Default attenuation coefficient unit
13BuiltInAttenEnergyUnit = 'MeV' # Built-in attenuation files' energy unit
15EnergyUnits = ['MeV', 'keV', 'eV'] # Supported energy units
16ConcentrationUnits = ['g/mL', 'mg/mL'] # Supported concentration units
18Or = Union
19UintLike = Or[np.uint8, np.uint16, np.uint32, np.uint64]
20SignedIntLike = Or[int, np.int8, np.int16, np.int32, np.int64]
21IntLike = Or[UintLike, SignedIntLike]
22try:
23 FloatLike = Or[np.float16, np.float32, np.float64, np.float128, float]
24except:
25 FloatLike = Or[np.float16, np.float32, np.float64, float]
27NDArray = np.ndarray
28ListNDArray = List[NDArray] # List of NDArray
29TwoD = NDArray # Two-dimensional array (not strictly)
30ThreeD = Or[NDArray, ListNDArray] # Three-dimensional array (not strictly)
31TwoOrThreeD = Or[TwoD, ThreeD] # Two or three-dimensional array (not strictly)