We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f55c286 commit c3ba28dCopy full SHA for c3ba28d
nibabel/pointset.py
@@ -224,9 +224,9 @@ def from_mask(cls, mask: SpatialImage) -> Self:
224
225
def to_mask(self, shape=None) -> SpatialImage:
226
if shape is None:
227
- shape = tuple(np.max(self.coordinates, axis=1)[: self.dim])
+ shape = tuple(np.max(self.coordinates, axis=0)[: self.dim] + 1)
228
mask_arr = np.zeros(shape, dtype='bool')
229
- mask_arr[np.asanyarray(self.coordinates)[:, : self.dim]] = True
+ mask_arr[tuple(np.asanyarray(self.coordinates)[:, : self.dim].T)] = True
230
return SpatialImage(mask_arr, self.affine)
231
232
0 commit comments