Download envs/kitoverlay/skimage/io/_image_stack.py from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/envs/kitoverlay/skimage/io/_image_stack.py
- Command line
-
hf download hf://datasets/AVSim/simulation-package/envs/kitoverlay/skimage/io/_image_stack.py
-
curl -L -o _image_stack.py https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/envs/kitoverlay/skimage/io/_image_stack.py
570 Bytes
| import numpy as np | |
| __all__ = ['image_stack', 'push', 'pop'] | |
| # Shared image queue | |
| image_stack = [] | |
| def push(img): | |
| """Push an image onto the shared image stack. | |
| Parameters | |
| ---------- | |
| img : ndarray | |
| Image to push. | |
| """ | |
| if not isinstance(img, np.ndarray): | |
| raise ValueError("Can only push ndarrays to the image stack.") | |
| image_stack.append(img) | |
| def pop(): | |
| """Pop an image from the shared image stack. | |
| Returns | |
| ------- | |
| img : ndarray | |
| Image popped from the stack. | |
| """ | |
| return image_stack.pop() | |