nimare.utils
.unique_rows
- unique_rows(ar)[source]
Remove repeated rows from a 2D array.
In particular, if given an array of coordinates of shape (Npoints, Ndim), it will remove repeated points.
- Parameters
ar (2-D ndarray) – The input array.
- Returns
ar_out – A copy of the input array with repeated rows removed.
- Return type
2-D ndarray
:raises ValueError : if ar is not two-dimensional.:
Notes
The function will generate a copy of ar if it is not C-contiguous, which will negatively affect performance for large input arrays.
This is taken from skimage. See
skimage.util.unique_rows()
.Examples
>>> ar = np.array([[1, 0, 1], ... [0, 1, 0], ... [1, 0, 1]], np.uint8) >>> unique_rows(ar) array([[0, 1, 0], [1, 0, 1]], dtype=uint8)
Copyright (C) 2019, the scikit-image team All rights reserved.