def unique_coords(self): """ What are the unique spatial coordinates in the fiber Parameters ---------- res: array-like with 3 items for the resolution in the x/y/z directions. """ return ozu.unique_rows(self.coords.T).T
def test_unique_coords(): """ Testing the function unique_coords """ arr = np.array([[1, 2, 3], [1, 2, 3], [2, 3, 4], [3, 4, 5]]) arr_w_unique = np.array([[1, 2, 3], [2, 3, 4], [3, 4, 5]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique) # Should preserve order: arr = np.array([[2, 3, 4], [1, 2, 3], [1, 2, 3], [3, 4, 5]]) arr_w_unique = np.array([[2, 3, 4], [1, 2, 3], [3, 4, 5]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique) # Should work even with longer arrays: arr = np.array([[2, 3, 4], [1, 2, 3], [1, 2, 3], [3, 4, 5], [6, 7, 8], [0, 1, 0], [1, 0, 1]]) arr_w_unique = np.array([[2, 3, 4], [1, 2, 3], [3, 4, 5], [6, 7, 8], [0, 1, 0], [1, 0, 1]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique)
def test_unique_coords(): """ Testing the function unique_coords """ arr = np.array([[1,2,3],[1,2,3],[2,3,4],[3,4,5]]) arr_w_unique = np.array([[1,2,3],[2,3,4],[3,4,5]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique) # Should preserve order: arr = np.array([[2,3,4],[1,2,3],[1,2,3],[3,4,5]]) arr_w_unique = np.array([[2,3,4],[1,2,3],[3,4,5]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique) # Should work even with longer arrays: arr = np.array([[2,3,4],[1,2,3],[1,2,3],[3,4,5], [6,7,8],[0,1,0],[1,0,1]]) arr_w_unique = np.array([[2,3,4],[1,2,3],[3,4,5], [6,7,8],[0,1,0],[1,0,1]]) npt.assert_equal(ozu.unique_rows(arr), arr_w_unique)
def unique_coords(self): """ The unique spatial coordinates of all the fibers in the FiberGroup. """ return ozu.unique_rows(self.coords.T).T
def fg_idx_unique(self): """ The *unique* voxel indices """ return ozu.unique_rows(self.fg_idx.T).T