mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 17:57:28 +08:00
Added simple 3d centroid test
This commit is contained in:
@@ -24,7 +24,7 @@ INTENSITY_SAMPLE[1, 9:11] = 2
|
||||
|
||||
SAMPLE_3D = np.zeros((6, 6, 6), dtype=np.uint8)
|
||||
SAMPLE_3D[1:3, 1:3, 1:3] = 1
|
||||
SAMPLE_3D[3, 2, 2] = 1
|
||||
SAMPLE_3D[3, 2, 2] = 1
|
||||
INTENSITY_SAMPLE_3D = SAMPLE_3D.copy()
|
||||
|
||||
def test_all_props():
|
||||
@@ -97,6 +97,12 @@ def test_centroid():
|
||||
assert_array_almost_equal(centroid, (5.66666666666666, 9.444444444444444))
|
||||
|
||||
|
||||
def test_centroid_3d():
|
||||
centroid = regionprops(SAMPLE_3D)[0].centroid
|
||||
# determined by mean along axis 1 of SAMPLE_3D.nonzero()
|
||||
assert_array_almost_equal(centroid, (1.66666667, 1.55555556, 1.55555556))
|
||||
|
||||
|
||||
def test_convex_area():
|
||||
area = regionprops(SAMPLE)[0].convex_area
|
||||
# determined with MATLAB
|
||||
|
||||
Reference in New Issue
Block a user