mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 20:48:10 +08:00
@@ -60,4 +60,3 @@ for ax in axes:
|
||||
ax.axis('off')
|
||||
plt.subplots_adjust(hspace=0.01, wspace=0.01, top=1, bottom=0, left=0, right=1)
|
||||
plt.show()
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ voxel spacing is not equal for every spatial dimension, through use of the
|
||||
"""
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
|
||||
|
||||
from skimage import measure
|
||||
|
||||
@@ -91,6 +91,7 @@ test_verbose.__doc__ = test.__doc__
|
||||
class _Log(Warning):
|
||||
pass
|
||||
|
||||
|
||||
class _FakeLog(object):
|
||||
def __init__(self, name):
|
||||
"""
|
||||
|
||||
@@ -200,4 +200,3 @@ def coffee():
|
||||
|
||||
"""
|
||||
return load("coffee.png")
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ def adjust_log(image, gain=1, inv=False):
|
||||
inv : float
|
||||
If True, it performs inverse logarithmic correction,
|
||||
else correction will be logarithmic. Defaults to False.
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
|
||||
@@ -3,7 +3,7 @@ from .ctmf import median_filter
|
||||
from ._gaussian import gaussian_filter
|
||||
from ._canny import canny
|
||||
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
|
||||
hprewitt, vprewitt, roberts , roberts_positive_diagonal,
|
||||
hprewitt, vprewitt, roberts, roberts_positive_diagonal,
|
||||
roberts_negative_diagonal)
|
||||
from ._denoise import denoise_tv_chambolle, tv_denoise
|
||||
from ._denoise_cy import denoise_bilateral, denoise_tv_bregman
|
||||
|
||||
@@ -250,7 +250,7 @@ def denoise_tv_chambolle(im, weight=50, eps=2.e-4, n_iter_max=200,
|
||||
out = np.zeros_like(im)
|
||||
for c in range(im.shape[2]):
|
||||
out[..., c] = _denoise_tv_chambolle_2d(im[..., c], weight, eps,
|
||||
n_iter_max)
|
||||
n_iter_max)
|
||||
else:
|
||||
out = _denoise_tv_chambolle_3d(im, weight, eps, n_iter_max)
|
||||
else:
|
||||
|
||||
@@ -8,7 +8,7 @@ Copyright (c) 2009-2011 Broad Institute
|
||||
All rights reserved.
|
||||
Original author: Lee Kamentstky
|
||||
"""
|
||||
import numpy
|
||||
import numpy as np
|
||||
|
||||
|
||||
def rank_order(image):
|
||||
@@ -47,14 +47,14 @@ def rank_order(image):
|
||||
(array([0, 1, 2, 1], dtype=uint32), array([-1. , 2.5, 3.1]))
|
||||
"""
|
||||
flat_image = image.ravel()
|
||||
sort_order = flat_image.argsort().astype(numpy.uint32)
|
||||
sort_order = flat_image.argsort().astype(np.uint32)
|
||||
flat_image = flat_image[sort_order]
|
||||
sort_rank = numpy.zeros_like(sort_order)
|
||||
sort_rank = np.zeros_like(sort_order)
|
||||
is_different = flat_image[:-1] != flat_image[1:]
|
||||
numpy.cumsum(is_different, out=sort_rank[1:])
|
||||
original_values = numpy.zeros((sort_rank[-1] + 1,), image.dtype)
|
||||
np.cumsum(is_different, out=sort_rank[1:])
|
||||
original_values = np.zeros((sort_rank[-1] + 1,), image.dtype)
|
||||
original_values[0] = flat_image[0]
|
||||
original_values[1:] = flat_image[1:][is_different]
|
||||
int_image = numpy.zeros_like(sort_order)
|
||||
int_image = np.zeros_like(sort_order)
|
||||
int_image[sort_order] = sort_rank
|
||||
return (int_image.reshape(image.shape), original_values)
|
||||
|
||||
@@ -31,8 +31,8 @@ HPREWITT_WEIGHTS = np.array([[ 1, 1, 1],
|
||||
[-1,-1,-1]]) / 3.0
|
||||
VPREWITT_WEIGHTS = HPREWITT_WEIGHTS.T
|
||||
|
||||
ROBERTS_PD_WEIGHTS = np.array([[ 1, 0],
|
||||
[ 0, -1]], dtype=np.double)
|
||||
ROBERTS_PD_WEIGHTS = np.array([[1, 0],
|
||||
[0, -1]], dtype=np.double)
|
||||
ROBERTS_ND_WEIGHTS = np.array([[0, 1],
|
||||
[-1, 0]], dtype=np.double)
|
||||
|
||||
@@ -346,7 +346,7 @@ def roberts(image, mask=None):
|
||||
"""Find the edge magnitude using Roberts' cross operator.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
|
||||
@@ -77,9 +77,9 @@ def marching_cubes(volume, level, spacing=(1., 1., 1.)):
|
||||
>>> from mayavi import mlab
|
||||
>>> verts, tris = marching_cubes(myvolume, 0.0, (1., 1., 2.))
|
||||
>>> mlab.triangular_mesh([vert[0] for vert in verts],
|
||||
[vert[1] for vert in verts],
|
||||
[vert[2] for vert in verts],
|
||||
tris)
|
||||
... [vert[1] for vert in verts],
|
||||
... [vert[2] for vert in verts],
|
||||
... tris)
|
||||
>>> mlab.show()
|
||||
|
||||
References
|
||||
|
||||
@@ -44,7 +44,7 @@ def convex_hull_image(image):
|
||||
(-0.5, 0.5, 0, 0))):
|
||||
coords_corners[i * N:(i + 1) * N] = coords + [x_offset, y_offset]
|
||||
|
||||
# repeated coordinates can *sometimes* cause problems in
|
||||
# repeated coordinates can *sometimes* cause problems in
|
||||
# scipy.spatial.Delaunay, so we remove them.
|
||||
coords = unique_rows(coords_corners)
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ def relabel_sequential(label_field, offset=1):
|
||||
Examples
|
||||
--------
|
||||
>>> from skimage.segmentation import relabel_sequential
|
||||
>>> label_field = array([1, 1, 5, 5, 8, 99, 42])
|
||||
>>> label_field = np.array([1, 1, 5, 5, 8, 99, 42])
|
||||
>>> relab, fw, inv = relabel_sequential(label_field)
|
||||
>>> relab
|
||||
array([1, 1, 2, 2, 3, 5, 4])
|
||||
@@ -117,7 +117,7 @@ def relabel_sequential(label_field, offset=1):
|
||||
labels = np.unique(label_field)
|
||||
labels0 = labels[labels != 0]
|
||||
m = labels.max()
|
||||
if m == len(labels0): # nothing to do, already 1...n labels
|
||||
if m == len(labels0): # nothing to do, already 1...n labels
|
||||
return label_field, labels, labels
|
||||
forward_map = np.zeros(m+1, int)
|
||||
forward_map[labels0] = np.arange(offset, offset + len(labels0) + 1)
|
||||
@@ -127,4 +127,3 @@ def relabel_sequential(label_field, offset=1):
|
||||
inverse_map[(offset - 1):] = labels
|
||||
relabeled = forward_map[label_field]
|
||||
return relabeled, forward_map, inverse_map
|
||||
|
||||
|
||||
@@ -233,9 +233,7 @@ def view_as_windows(arr_in, window_shape, step=1):
|
||||
tuple(window_shape)
|
||||
|
||||
arr_strides = np.array(arr_in.strides)
|
||||
new_strides = np.concatenate(
|
||||
(arr_strides * step, arr_strides)
|
||||
)
|
||||
new_strides = np.concatenate((arr_strides * step, arr_strides))
|
||||
|
||||
arr_out = as_strided(arr_in, shape=new_shape, strides=new_strides)
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ def unique_rows(ar):
|
||||
Examples
|
||||
--------
|
||||
>>> ar = np.array([[1, 0, 1],
|
||||
[0, 1, 0],
|
||||
[1, 0, 1]], np.uint8)
|
||||
>>> aru = unique_rows(ar)
|
||||
... [0, 1, 0],
|
||||
... [1, 0, 1]], np.uint8)
|
||||
>>> unique_rows(ar)
|
||||
array([[0, 1, 0],
|
||||
[1, 0, 1]], dtype=uint8)
|
||||
"""
|
||||
|
||||
@@ -7,6 +7,7 @@ from skimage.viewer import ImageViewer
|
||||
from skimage.viewer.widgets import history
|
||||
from skimage.viewer.plugins.labelplugin import LabelPainter
|
||||
|
||||
|
||||
class OKCancelButtons(history.OKCancelButtons):
|
||||
|
||||
def update_original_image(self):
|
||||
|
||||
Reference in New Issue
Block a user