By: Yaroslav Halchenko
It seems that some labels defined in SRI24-tzo116plus.txt are not defined
in tzo116plus.nii.gz and vise versa. how come?
here is the output of a little python snippet listed below
(array([83, 84]), array([98, 98]), array([55, 55]), array([0, 0]))
Labels present in the map but not in the labels file: set([422, 424, 426, 428, 430, 432, 434, 476, 478])
Labels present in the labels file but not in the map: set([227, 201, 203, 205, 413, 219, 221])
import nibabel as nib;
import numpy as np
atl_tzo116 = "/usr/share/data/sri24-atlas/tzo116plus.nii.gz"
atl_tzo116_labelsfile = '/usr/share/data/sri24-atlas/SRI24-tzo116plus.txt'
atl_tzo116_labels = np.loadtxt(atl_tzo116_labelsfile, dtype=str)
atl_tzo116_labels = dict([(int(i), l) for i,l in atl_tzo116_labels[:, :2]])
ni = nib.load(atl_tzo116)
m = ni.get_data()
mset = set(np.unique(m))
lset = set(np.unique(atl_tzo116_labels.keys()))
print np.where(m == 432)
# so we have voxels labels as 432 which is not present in the labels file
print "Labels present in the map but not in the labels file: ", mset -
lset
print "Labels present in the labels file but not in the map: ", lset -
mset