Download hmc/reference/scripts/mask_eq.py from neurodeskorg/webapps: direct link, hf CLI and curl.
- Browser
- Download file 676 Bytes
-
https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/mask_eq.py
- Command line
-
hf download hf://datasets/neurodeskorg/webapps/hmc/reference/scripts/mask_eq.py
-
curl -L -o mask_eq.py https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/mask_eq.py
676 Bytes
| """Compare the NiFreeze work brainmasks with the MindGrab mask (data, affine, dtype).""" | |
| import sys | |
| import nibabel as nb | |
| import numpy as np | |
| ref = nb.load(sys.argv[1]) | |
| rd = np.asarray(ref.dataobj) | |
| for p in sys.argv[2:]: | |
| im = nb.load(p) | |
| d = np.asarray(im.dataobj) | |
| print( | |
| p, | |
| im.get_data_dtype(), | |
| "data_equal(bool)", | |
| bool(np.array_equal(d.astype(bool), rd.astype(bool))), | |
| "affine_maxdiff", | |
| float(np.abs(im.affine - ref.affine).max()), | |
| "header_diff", | |
| { | |
| k | |
| for k in im.header | |
| if not np.array_equal(np.asarray(im.header[k]), np.asarray(ref.header[k])) | |
| }, | |
| ) | |