Skip to content

Commit c3ba28d

Browse files
committed
FIX: to_mask() implementation
1 parent f55c286 commit c3ba28d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nibabel/pointset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ def from_mask(cls, mask: SpatialImage) -> Self:
224224

225225
def to_mask(self, shape=None) -> SpatialImage:
226226
if shape is None:
227-
shape = tuple(np.max(self.coordinates, axis=1)[: self.dim])
227+
shape = tuple(np.max(self.coordinates, axis=0)[: self.dim] + 1)
228228
mask_arr = np.zeros(shape, dtype='bool')
229-
mask_arr[np.asanyarray(self.coordinates)[:, : self.dim]] = True
229+
mask_arr[tuple(np.asanyarray(self.coordinates)[:, : self.dim].T)] = True
230230
return SpatialImage(mask_arr, self.affine)
231231

232232

0 commit comments

Comments
 (0)