I added the CCFv3 annotations to my version of ClearMap2 by specifying annotation_file = [the-CCFv3-annotation.tif] for the various functions like label_points which would need it. However in running
I get these errors,
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 462, in label_points label[valid] = convert_label(label[valid], key='id', value=key, level=level); File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 493, in convert_label return annotation.convert_label(label, key=key, value=value, level=level, method=method); File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 335, in convert_label return np.vectorize(d.__getitem__, otypes=[type(d[list(d.keys())[0]])])(label); File "/home/ams133/miniconda2/envs/clearmap/lib/python3.6/site-packages/numpy/lib/function_base.py", line 2091, in __call__ return self._vectorize_call(func=func, args=vargs) File "/home/ams133/miniconda2/envs/clearmap/lib/python3.6/site-packages/numpy/lib/function_base.py", line 2167, in _vectorize_call outputs = ufunc(*inputs) KeyError: 484682464
After digging a while, I found it was due to values from the new annotations file that weren't in the json file. This can be fixed by directly adding these missing values to the Annotation.py where it creates the variable "default_extra_label".
I half-attempted to provide a parent ID (the 2nd number in the set of 4 for each tuple) so they are mostly right but not very specific ("midbrain", "cerebellum", etc...)
Posting this in case others have the same issue so that my solution is available.
Leaving this here:
I added the CCFv3 annotations to my version of ClearMap2 by specifying annotation_file = [the-CCFv3-annotation.tif] for the various functions like label_points which would need it. However in running
"label = ano.label_points(coordinates_transformed, annotation_file = annotation_file, key='order');"
I get these errors,
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 462, in label_points label[valid] = convert_label(label[valid], key='id', value=key, level=level); File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 493, in convert_label return annotation.convert_label(label, key=key, value=value, level=level, method=method); File "/n/data1/bwh/genetics/pourquie/andrew/python/ClearMap2/ClearMap/Alignment/Annotation.py", line 335, in convert_label return np.vectorize(d.__getitem__, otypes=[type(d[list(d.keys())[0]])])(label); File "/home/ams133/miniconda2/envs/clearmap/lib/python3.6/site-packages/numpy/lib/function_base.py", line 2091, in __call__ return self._vectorize_call(func=func, args=vargs) File "/home/ams133/miniconda2/envs/clearmap/lib/python3.6/site-packages/numpy/lib/function_base.py", line 2167, in _vectorize_call outputs = ufunc(*inputs) KeyError: 484682464
After digging a while, I found it was due to values from the new annotations file that weren't in the json file. This can be fixed by directly adding these missing values to the Annotation.py where it creates the variable "default_extra_label".
these values are: (484682464, 822, 'No label', 'NoL'), (599626944, 313, 'No label', 'NoL'), (560581568, 549, 'No label', 'NoL'), (549009216, 1065, 'No label', 'NoL'), (563807414, 1065, 'No label', 'NoL'), (563807424, 1065, 'No label', 'NoL'), (614454272, 1065, 'No label', 'NoL'), (606826688, 1065, 'No label', 'NoL'), (589508480, 512, 'No label', 'NoL'), (607344832, 1065, 'No label', 'NoL'), (576073728, 1097, 'No label', 'NoL'), (589508416, 822, 'No label', 'NoL'), (606826624, 997, 'No label', 'NoL')];
I half-attempted to provide a parent ID (the 2nd number in the set of 4 for each tuple) so they are mostly right but not very specific ("midbrain", "cerebellum", etc...)
Posting this in case others have the same issue so that my solution is available.