Download hmc/reference/scripts/mask_s0.py from neurodeskorg/webapps: direct link, hf CLI and curl.
- Browser
- Download file 550 Bytes
-
https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/mask_s0.py
- Command line
-
hf download hf://datasets/neurodeskorg/webapps/hmc/reference/scripts/mask_s0.py
-
curl -L -o mask_s0.py https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/mask_s0.py
550 Bytes
| """Check that the GP work mask equals the input mask minus voxels with bzero < threshold.""" | |
| import sys | |
| import nibabel as nb | |
| import numpy as np | |
| ref = np.asarray(nb.load(sys.argv[1]).dataobj).astype(bool) | |
| work = np.asarray(nb.load(sys.argv[2]).dataobj).astype(bool) | |
| bzero = np.asarray(nb.load(sys.argv[3]).dataobj, dtype=np.float64) | |
| thr = float(sys.argv[4]) | |
| expect = ref & ~(bzero < thr) | |
| print( | |
| "equal", bool(np.array_equal(expect, work)), "removed", int((ref & ~expect).sum()) | |
| ) | |
| print("bzero at removed voxels", np.unique(bzero[ref & ~work])) | |