TST: skel3d: redo 3D test images
Remove ad-hoc images from morphology/tests/data folder. Add a FIJI generated image to skimage/data. The image was generated via >>> img = binary_blobs(32, 0.05, n_dim=3, seed=1234) >>> img = img.astype(np.uint8)*255 >>> img = img[:-2, ...] then saved as a sequence of png frames, read into FIJI as an image sequence, and skeletonized via Plugins -> Skeletonize (2D/3D).
|
Before Width: | Height: | Size: 251 B |
|
Before Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 178 B |
|
Before Width: | Height: | Size: 178 B |
|
Before Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 137 B |
|
Before Width: | Height: | Size: 137 B |
@@ -11,7 +11,7 @@ import scipy.ndimage as ndi
|
||||
|
||||
import skimage
|
||||
from skimage import io, draw, data_dir
|
||||
#from skimage import draw
|
||||
from skimage.data import binary_blobs
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
from skimage.morphology import skeletonize_3d
|
||||
@@ -162,30 +162,15 @@ def test_two_hole_image():
|
||||
assert_equal(res, img_f)
|
||||
|
||||
|
||||
# trivial 3D images
|
||||
def test_simple_3d():
|
||||
for fname in ['3/stack', '4/stack']:
|
||||
yield check_skel_3d, fname
|
||||
|
||||
|
||||
# 'slow' test: Bat Cochlea from FIJI collections.
|
||||
def test_large():
|
||||
for fname in ['bat/bat-cochlea-volume']:
|
||||
yield check_skel_3d, fname
|
||||
|
||||
|
||||
def get_data_path():
|
||||
# XXX this is a bad temp hack
|
||||
return os.path.join(os.path.split(skimage.__file__)[0],
|
||||
'morphology',
|
||||
'tests',
|
||||
'data')
|
||||
|
||||
def check_skel_3d(fname):
|
||||
img = io.imread(os.path.join(get_data_path(), fname + '.tif'))
|
||||
img_f = io.imread(os.path.join(get_data_path(), fname + '_fiji.tif'))
|
||||
def test_3d_vs_fiji():
|
||||
# generate an image with blobs and compate its skeleton to
|
||||
# the skeleton generated by FIJI
|
||||
img = binary_blobs(32, 0.05, n_dim=3, seed=1234)
|
||||
img = img[:-2, ...]
|
||||
img = img.astype(np.uint8)*255
|
||||
|
||||
img_s = skeletonize_3d(img)
|
||||
img_f = io.imread(os.path.join(data_dir, "_blobs_3d_fiji_skeleton.tif"))
|
||||
assert_equal(img_s, img_f)
|
||||
|
||||
|
||||
|
||||