Skip to content

Commit d250546

Browse files
committed
Prevent the intersection of volumes from different spaces
1 parent eb0a519 commit d250546

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

siibra/volumes/volume.py

+2
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ def intersection(self, other: structure.BrainStructure, **fetch_kwargs) -> struc
400400
elif isinstance(other, boundingbox.BoundingBox):
401401
return self.get_boundingbox(clip=True, background=0.0, **fetch_kwargs).intersection(other)
402402
elif isinstance(other, Volume):
403+
if self.space != other.space:
404+
raise NotImplementedError("Cannot intersect volumes from different spaces. Try comparing their boudning boxes.")
403405
format = fetch_kwargs.pop('format', 'image')
404406
v1 = self.fetch(format=format, **fetch_kwargs)
405407
v2 = other.fetch(format=format, **fetch_kwargs)

0 commit comments

Comments
 (0)