Skip to content

Commit

Permalink
MAINT: Provide domain property for images.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Oct 31, 2023
1 parent 6401fd1 commit 71bf9bc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/darsia/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,27 @@ def subregion(

return type(self)(img=img, **metadata)

@property
def domain(self) -> tuple:
"""Physical domain.
Returns:
tuple: collection of coordinates in matrix indexing defining domain
"""
if self.space_dim == 1:
return (self.origin[0], self.opposite_corner[0])
elif self.space_dim == 2:
# 1. Row interval, 2. column interval
return (
self.origin[0],
self.opposite_corner[0],
self.opposite_corner[1],
self.origin[1],
)
elif self.space_dim == 3:
raise NotImplementedError

# ! ---- Arithmetics

def __add__(self, other: Image) -> Image:
Expand Down

0 comments on commit 71bf9bc

Please sign in to comment.