Skip to content

Commit 1f2d44a

Browse files
committed
fix: GridAttrs initialization and grid.center property getter
1 parent eaa8c06 commit 1f2d44a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/deepali/utils/simpleitk/grid.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def __init__(
5050
if center is None:
5151
origin = (0.0,) * ndim
5252
else:
53-
offset = np.array(0.5 * n if n > 0 else 0 for n in self._int_size(size))
54-
rotation = np.array(self.direction).reshape(ndim, ndim)
53+
offset = np.array([0.5 * n if n > 0 else 0 for n in self._int_size(size)])
54+
rotation = np.array(direction).reshape(ndim, ndim)
5555
scaling = np.diag(spacing)
5656
coords: NDArray = np.asanyarray(center) - np.matmul(rotation @ scaling, offset)
5757
origin = tuple(float(x) for x in coords)
@@ -68,7 +68,7 @@ def __init__(
6868
@property
6969
def center(self) -> Tuple[float, ...]:
7070
r"""Get grid center point coordinates in world space."""
71-
offset = np.array(0.5 * n if n > 0 else 0 for n in self.size)
71+
offset = np.array([0.5 * n if n > 0 else 0 for n in self.size])
7272
coords: NDArray = self.origin + np.matmul(self.transform[:-1, :-1], offset)
7373
return tuple(float(x) for x in coords)
7474

0 commit comments

Comments
 (0)