Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
    def unique_coords(self):
        """
        The unique spatial coordinates of all the fibers in the FiberGroup.

        """
        return ozu.unique_rows(self.coords.T).T
Exemple #6
0
 def fg_idx_unique(self):
     """
     The *unique* voxel indices
     """
     return ozu.unique_rows(self.fg_idx.T).T
Exemple #7
0
 def fg_idx_unique(self):
     """
     The *unique* voxel indices
     """
     return ozu.unique_rows(self.fg_idx.T).T
Exemple #8
0
    def unique_coords(self):
        """
        The unique spatial coordinates of all the fibers in the FiberGroup.

        """
        return ozu.unique_rows(self.coords.T).T