Skip to content

Commit

Permalink
fix: statisitcal map centroid calculation resulting in NaN points
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Sep 23, 2024
1 parent dc81378 commit aacb061
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion siibra/volumes/parcellationmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def compute_centroids(self) -> Dict[str, point.Point]:
with QUIET:
mapimg = self.fetch(index=index) # returns a mask of the region
maparr = np.asanyarray(mapimg.dataobj)
centroid_vox = np.mean(np.where(maparr == 1), axis=1)
centroid_vox = np.mean(np.nonzero(maparr), axis=1)
assert regionname not in centroids
centroids[regionname] = point.Point(
np.dot(mapimg.affine, np.r_[centroid_vox, 1])[:3], space=self.space
Expand Down

0 comments on commit aacb061

Please sign in to comment.