Merge pull request #540 from ahojnnes/namespace

RF: Use __all__ in __init__.py files.
This commit is contained in:
Stefan van der Walt
2013-04-28 14:43:49 -07:00
18 changed files with 321 additions and 51 deletions
+85 -1
View File
@@ -1 +1,85 @@
from .colorconv import *
from .colorconv import (convert_colorspace,
rgb2hsv,
hsv2rgb,
rgb2xyz,
xyz2rgb,
rgb2rgbcie,
rgbcie2rgb,
rgb2grey,
rgb2gray,
gray2rgb,
xyz2lab,
lab2xyz,
lab2rgb,
rgb2lab,
rgb2hed,
hed2rgb,
separate_stains,
combine_stains,
rgb_from_hed,
hed_from_rgb,
rgb_from_hdx,
hdx_from_rgb,
rgb_from_fgx,
fgx_from_rgb,
rgb_from_bex,
bex_from_rgb,
rgb_from_rbd,
rbd_from_rgb,
rgb_from_gdx,
gdx_from_rgb,
rgb_from_hax,
hax_from_rgb,
rgb_from_bro,
bro_from_rgb,
rgb_from_bpx,
bpx_from_rgb,
rgb_from_ahx,
ahx_from_rgb,
rgb_from_hpx,
hpx_from_rgb,
is_rgb,
is_gray)
__all__ = ['convert_colorspace',
'rgb2hsv',
'hsv2rgb',
'rgb2xyz',
'xyz2rgb',
'rgb2rgbcie',
'rgbcie2rgb',
'rgb2grey',
'rgb2gray',
'gray2rgb',
'xyz2lab',
'lab2xyz',
'lab2rgb',
'rgb2lab',
'rgb2hed',
'hed2rgb',
'separate_stains',
'combine_stains',
'rgb_from_hed',
'hed_from_rgb',
'rgb_from_hdx',
'hdx_from_rgb',
'rgb_from_fgx',
'fgx_from_rgb',
'rgb_from_bex',
'bex_from_rgb',
'rgb_from_rbd',
'rbd_from_rgb',
'rgb_from_gdx',
'gdx_from_rgb',
'rgb_from_hax',
'hax_from_rgb',
'rgb_from_bro',
'bro_from_rgb',
'rgb_from_bpx',
'bpx_from_rgb',
'rgb_from_ahx',
'ahx_from_rgb',
'rgb_from_hpx',
'hpx_from_rgb',
'is_rgb',
'is_gray']
-14
View File
@@ -43,20 +43,6 @@ References
from __future__ import division
__all__ = ['convert_colorspace', 'rgb2hsv', 'hsv2rgb', 'rgb2xyz', 'xyz2rgb',
'rgb2rgbcie', 'rgbcie2rgb', 'rgb2grey', 'rgb2gray', 'gray2rgb',
'xyz2lab', 'lab2xyz', 'lab2rgb', 'rgb2lab', 'rgb2hed', 'hed2rgb',
'separate_stains', 'combine_stains', 'rgb_from_hed', 'hed_from_rgb',
'rgb_from_hdx', 'hdx_from_rgb', 'rgb_from_fgx', 'fgx_from_rgb',
'rgb_from_bex', 'bex_from_rgb', 'rgb_from_rbd', 'rbd_from_rgb',
'rgb_from_gdx', 'gdx_from_rgb', 'rgb_from_hax', 'hax_from_rgb',
'rgb_from_bro', 'bro_from_rgb', 'rgb_from_bpx', 'bpx_from_rgb',
'rgb_from_ahx', 'ahx_from_rgb', 'rgb_from_hpx', 'hpx_from_rgb',
'is_rgb', 'is_gray'
]
__docformat__ = "restructuredtext en"
import numpy as np
from scipy import linalg
from ..util import dtype
+14
View File
@@ -12,6 +12,20 @@ from ..io import imread
from skimage import data_dir
__all__ = ['load',
'camera',
'lena',
'text',
'checkerboard',
'coins',
'moon',
'page',
'horse',
'clock',
'immunohistochemistry',
'chelsea']
def load(f):
"""Load an image file located in the data directory.
+9
View File
@@ -1,2 +1,11 @@
from ._draw import line, polygon, ellipse, ellipse_perimeter, \
circle, circle_perimeter, set_color, bresenham
__all__ = ['line',
'polygon',
'ellipse',
'ellipse_perimeter',
'circle',
'circle_perimeter',
'set_color',
'bresenham']
+7
View File
@@ -1,3 +1,10 @@
from .exposure import histogram, equalize, equalize_hist, \
rescale_intensity, cumulative_distribution
from ._adapthist import equalize_adapthist
__all__ = ['histogram',
'equalize',
'equalize_hist',
'equalize_adapthist',
'rescale_intensity',
'cumulative_distribution']
+16
View File
@@ -6,3 +6,19 @@ from .corner import (corner_kitchen_rosenfeld, corner_harris, corner_shi_tomasi,
corner_foerstner, corner_subpix, corner_peaks)
from .corner_cy import corner_moravec
from .template import match_template
__all__ = ['daisy',
'hog',
'greycomatrix',
'greycoprops',
'local_binary_pattern',
'peak_local_max',
'corner_kitchen_rosenfeld',
'corner_harris',
'corner_shi_tomasi',
'corner_foerstner',
'corner_subpix',
'corner_peaks',
'corner_moravec',
'match_template']
+29 -1
View File
@@ -1,4 +1,4 @@
from .lpi_filter import *
from .lpi_filter import inverse, wiener, LPIFilter2D
from .ctmf import median_filter
from ._canny import canny
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
@@ -9,3 +9,31 @@ from ._denoise_cy import denoise_bilateral, denoise_tv_bregman
from ._rank_order import rank_order
from ._gabor import gabor_kernel, gabor_filter
from .thresholding import threshold_otsu, threshold_adaptive
__all__ = ['inverse',
'wiener',
'LPIFilter2D',
'median_filter',
'canny',
'sobel',
'hsobel',
'vsobel',
'scharr',
'hscharr',
'vscharr',
'prewitt',
'hprewitt',
'vprewitt',
'roberts',
'roberts_positive_diagonal',
'roberts_negative_diagonal',
'denoise_tv_chambolle',
'tv_denoise',
'denoise_bilateral',
'denoise_tv_bregman',
'rank_order',
'gabor_kernel',
'gabor_filter',
'threshold_otsu',
'threshold_adaptive']
-3
View File
@@ -3,9 +3,6 @@
:license: modified BSD
"""
__all__ = ['inverse', 'wiener', 'LPIFilter2D']
__docformat__ = 'restructuredtext en'
import numpy as np
from scipy.fftpack import ifftshift
+37 -3
View File
@@ -1,3 +1,37 @@
from .rank import *
from .percentile_rank import *
from .bilateral_rank import *
from .rank import (autolevel, bottomhat, equalize, gradient, maximum, mean,
meansubstraction, median, minimum, modal, morph_contr_enh,
pop, threshold, tophat, noise_filter, entropy, otsu)
from .percentile_rank import (percentile_autolevel, percentile_gradient,
percentile_mean, percentile_mean_substraction,
percentile_morph_contr_enh, percentile,
percentile_pop, percentile_threshold)
from .bilateral_rank import bilateral_mean, bilateral_pop
__all__ = ['autolevel',
'bottomhat',
'equalize',
'gradient',
'maximum',
'mean',
'meansubstraction',
'median',
'minimum',
'modal',
'morph_contr_enh',
'pop',
'threshold',
'tophat',
'noise_filter',
'entropy',
'otsu',
'percentile_autolevel',
'percentile_gradient',
'percentile_mean',
'percentile_mean_substraction',
'percentile_morph_contr_enh',
'percentile',
'percentile_pop',
'percentile_threshold',
'bilateral_mean',
'bilateral_pop']
+6 -9
View File
@@ -1,10 +1,7 @@
try:
from .spath import shortest_path
from .mcp import MCP, MCP_Geometric, route_through_array
except ImportError:
print """*** The cython extensions have not been compiled. Run
from .spath import shortest_path
from .mcp import MCP, MCP_Geometric, route_through_array
python setup.py build_ext -i
in the source directory to build in-place. Please refer to INSTALL.txt
for further detail."""
__all__ = ['shortest_path',
'MCP',
'MCP_Geometric',
'route_through_array']
+8 -1
View File
@@ -1,4 +1,11 @@
from .find_contours import find_contours
from ._regionprops import regionprops, perimeter
from ._structural_similarity import structural_similarity
from ._polygon import approximate_polygon, subdivide_polygon
from ._polygon import approximate_polygon, subdivide_polygon
__all__ = ['find_contours',
'regionprops',
'perimeter',
'structural_similarity',
'approximate_polygon',
'subdivide_polygon']
+38 -2
View File
@@ -1,10 +1,46 @@
from .binary import (binary_erosion, binary_dilation, binary_opening,
binary_closing)
from .grey import *
from .selem import *
from .grey import (erosion, dilation, opening, closing, white_tophat,
black_tophat, greyscale_erode, greyscale_dilate,
greyscale_open, greyscale_close, greyscale_white_top_hat,
greyscale_black_top_hat)
from .selem import square, rectangle, diamond, disk, cube, octahedron, ball
from .ccomp import label
from .watershed import watershed, is_local_maximum
from ._skeletonize import skeletonize, medial_axis
from .convex_hull import convex_hull_image
from .greyreconstruct import reconstruction
from .misc import remove_small_objects
__all__ = ['binary_erosion',
'binary_dilation',
'binary_opening',
'binary_closing',
'erosion',
'dilation',
'opening',
'closing',
'white_tophat',
'black_tophat',
'greyscale_erode',
'greyscale_dilate',
'greyscale_open',
'greyscale_close',
'greyscale_white_top_hat',
'greyscale_black_top_hat',
'square',
'rectangle',
'diamond',
'disk',
'cube',
'octahedron',
'ball',
'label',
'watershed',
'is_local_maximum',
'skeletonize',
'medial_axis',
'convex_hull_image',
'reconstruction',
'remove_small_objects']
+9 -5
View File
@@ -8,7 +8,7 @@ from numpy.testing import *
from skimage import data_dir
from skimage.io import *
from skimage import data_dir
from skimage.morphology import *
from skimage.morphology import selem
class TestSElem():
@@ -36,7 +36,7 @@ class TestSElem():
expected_mask = expected_mask[:, np.newaxis]
assert_equal(expected_mask, actual_mask)
k = k + 1
def strel_worker_3d(self, fn, func):
matlab_masks = np.load(os.path.join(data_dir, fn))
k = 0
@@ -48,20 +48,24 @@ class TestSElem():
# Test center slice for each dimension. This gives a good
# indication of validity without the need for a 3D reference
# mask.
c = int(expected_mask.shape[0]/2)
c = int(expected_mask.shape[0]/2)
assert_equal(expected_mask, actual_mask[c,:,:])
assert_equal(expected_mask, actual_mask[:,c,:])
assert_equal(expected_mask, actual_mask[:,:,c])
k = k + 1
def test_selem_disk(self):
self.strel_worker("disk-matlab-output.npz", selem.disk)
def test_selem_diamond(self):
self.strel_worker("diamond-matlab-output.npz", selem.diamond)
def test_selem_ball(self):
self.strel_worker_3d("disk-matlab-output.npz", selem.ball)
def test_selem_octahedron(self):
self.strel_worker_3d("diamond-matlab-output.npz", selem.octahedron)
if __name__ == '__main__':
np.testing.run_module_suite()
+12
View File
@@ -5,3 +5,15 @@ from ._quickshift import quickshift
from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries
from ._clear_border import clear_border
from ._join import join_segmentations, relabel_from_one
__all__ = ['random_walker',
'felzenszwalb',
'slic',
'quickshift',
'find_boundaries',
'visualize_boundaries',
'mark_boundaries',
'clear_border',
'join_segmentations',
'relabel_from_one']
+38 -7
View File
@@ -1,10 +1,10 @@
from ._hough_transform import (hough_circle,
hough_line,
probabilistic_hough_line)
from .hough_transform import *
from .radon_transform import *
from .finite_radon_transform import *
from .integral import *
from ._hough_transform import (hough_circle, hough_line,
probabilistic_hough_line)
from .hough_transform import (hough, probabilistic_hough, hough_peaks,
hough_line_peaks)
from .radon_transform import radon, iradon
from .finite_radon_transform import frt2, ifrt2
from .integral import integral_image, integrate
from ._geometric import (warp, warp_coords, estimate_transform,
SimilarityTransform, AffineTransform,
ProjectiveTransform, PolynomialTransform,
@@ -12,3 +12,34 @@ from ._geometric import (warp, warp_coords, estimate_transform,
from ._warps import swirl, resize, rotate, rescale
from .pyramids import (pyramid_reduce, pyramid_expand,
pyramid_gaussian, pyramid_laplacian)
__all__ = ['hough_circle',
'hough_line',
'probabilistic_hough_line',
'hough',
'probabilistic_hough',
'hough_peaks',
'hough_line_peaks',
'radon',
'iradon',
'frt2',
'ifrt2',
'integral_image',
'integrate',
'warp',
'warp_coords',
'estimate_transform',
'SimilarityTransform',
'AffineTransform',
'ProjectiveTransform',
'PolynomialTransform',
'PiecewiseAffineTransform',
'swirl',
'resize',
'rotate',
'rescale',
'pyramid_reduce',
'pyramid_expand',
'pyramid_gaussian',
'pyramid_laplacian']
@@ -4,7 +4,6 @@
"""
__all__ = ["frt2", "ifrt2"]
__docformat__ = "restructuredtext en"
import numpy as np
from numpy import roll, newaxis
-2
View File
@@ -1,5 +1,3 @@
__all__ = ['hough_line_peaks']
import numpy as np
from scipy import ndimage
from skimage import measure, morphology
+13 -2
View File
@@ -1,2 +1,13 @@
from .dtype import *
from .shape import *
from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,
img_as_bool, dtype_limits)
from .shape import view_as_blocks, view_as_windows
__all__ = ['img_as_float',
'img_as_int',
'img_as_uint',
'img_as_ubyte',
'img_as_bool',
'dtype_limits',
'view_as_blocks',
'view_as_windows']