Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume subclass BrainStructure #630

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion siibra/core/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def assign(self, other: structure.BrainStructure) -> AnatomicalAssignment:
return None
return self._ASSIGNMENT_CACHE[other, self].invert()

if isinstance(other, location.Location):
if isinstance(other, (location.Location, volume.Volume)):
if self.mapped_in_space(other.space):
regionmap = self.get_regional_mask(other.space)
self._ASSIGNMENT_CACHE[self, other] = regionmap.assign(other)
Expand Down
21 changes: 2 additions & 19 deletions siibra/volumes/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .. import logger
from ..retrieval import requests
from ..core import space as _space, structure
from ..locations import location, point, pointset, boundingbox
from ..locations import point, pointset, boundingbox
from ..commons import resample_img_to_img, siibra_tqdm, affine_scaling, connected_components
from ..exceptions import NoMapAvailableError, SpaceWarpingFailedError

Expand Down Expand Up @@ -92,7 +92,7 @@ def compute_from_image(
return spatial_props


class Volume(location.Location):
class Volume(structure.BrainStructure):
"""
A volume is a specific mesh or 3D array,
which can be accessible via multiple providers in different formats.
Expand Down Expand Up @@ -390,14 +390,6 @@ def _points_inside(
newlabels=None if keep_labels else inside
)

def union(self, other: location.Location):
if isinstance(other, Volume):
return merge([self, other])
else:
raise NotImplementedError(
f"There are no union method for {(self.__class__.__name__, other.__class__.__name__)}"
)

def intersection(self, other: structure.BrainStructure, **fetch_kwargs) -> structure.BrainStructure:
"""
Compute the intersection of a location with this volume. This will
Expand Down Expand Up @@ -436,15 +428,6 @@ def intersection(self, other: structure.BrainStructure, **fetch_kwargs) -> struc
except NoMapAvailableError:
return None

def transform(self, affine: np.ndarray, space=None):
raise NotImplementedError("Volume transformation is not yet implemented.")

def warp(self, space):
if self.space.matches(space):
return self
else:
raise SpaceWarpingFailedError('Warping of full volumes is not yet supported.')

def fetch(
self,
format: str = None,
Expand Down
Loading