I am writing some Python code built on itk and other packages. Many of the methods take itk images as arguments.
What is the best way add type annotations for itk images? In most cases I don’t care about the pixel type of the image, but do care about the dimension.
- Is there a corresponding base type in Python for 2D images, or 3D images?
- Or should I use typing.Union and list all the image types I except to receive, like:
def do_something(img: Union[itk.Image[itk.UC,2], itk.Image[itk.F,2]], a:int, b:float):