diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 548f37c5..5feb5777 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -64,3 +64,7 @@ - The Scikit Learn team From whom we borrowed the example generation tools. + +- Andreas Mueller + Example data set loader. + diff --git a/doc/Makefile b/doc/Makefile index 2abac1ce..a041f834 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -44,7 +44,7 @@ coveragetable: html: api coveragetable $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DEST)/html - cp source/plots $(DEST)/html -r + cp -r source/plots $(DEST)/html @echo @echo "Build finished. The HTML pages are in build/html." diff --git a/doc/examples/plot_lena_tv_denoise.py b/doc/examples/plot_lena_tv_denoise.py index 55f167e1..a712acee 100644 --- a/doc/examples/plot_lena_tv_denoise.py +++ b/doc/examples/plot_lena_tv_denoise.py @@ -20,9 +20,10 @@ import numpy as np import matplotlib.pyplot as plt from scikits.image import data +from scikits.image import color from scikits.image.filter import tv_denoise -l = data.lena() +l = color.rgb2gray(data.lena()) l = l[230:290, 220:320] noisy = l + 0.4*l.std()*np.random.random(l.shape) diff --git a/doc/source/conf.py b/doc/source/conf.py index d9e20793..2732b37e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -45,11 +45,11 @@ source_suffix = '.txt' #source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'contents' +master_doc = 'index' # General information about the project. project = u'scikits.image' -copyright = u'2009, SciPy Developers' +copyright = u'2011, scikits-image team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/doc/source/themes/agogo/static/agogo.css_t b/doc/source/themes/agogo/static/agogo.css_t index 99d44d62..0a9e12ef 100644 --- a/doc/source/themes/agogo/static/agogo.css_t +++ b/doc/source/themes/agogo/static/agogo.css_t @@ -595,8 +595,23 @@ tt { font-size: 0.95em; } +table { + border-collapse: collapse; + margin-bottom: 1em; + margin-top: 1em; +} + +table, th, td { + border: 1px solid #ccc; +} + +th, td { + padding: 5px; +} + th { - background-color: #ede; + color: #333; + background-color: #eee; } #api-reference ul:first-child { diff --git a/scikits/image/data/__init__.py b/scikits/image/data/__init__.py index c46a2e37..728b20dd 100644 --- a/scikits/image/data/__init__.py +++ b/scikits/image/data/__init__.py @@ -1,4 +1,42 @@ -import scipy.misc as _m +"""Convenience functions to load sample data. -lena = _m.lena +""" +import os as _os + +from ..io import imread +from ...image import data_dir + +def load(f): + """Load an image file located in the data directory. + + Parameters + ---------- + f : string + File name. + + Returns + ------- + img : ndarray + Image loaded from scikits.image.data_dir. + """ + return imread(_os.path.join(data_dir, f)) + +def camera(): + """Gray "camera" image, often used for segmentation + and denoising examples. + + """ + return load("camera.png") + +def lena(): + """Colour "Lena" image. + + """ + return load("lena.png") + +def checkerboard(): + """Checkerboard image. + + """ + return load("chessboard_RGB.png") diff --git a/scikits/image/data/camera.png b/scikits/image/data/camera.png index a196b835..49be869c 100644 Binary files a/scikits/image/data/camera.png and b/scikits/image/data/camera.png differ diff --git a/scikits/image/data/lena.png b/scikits/image/data/lena.png index 6b5473fe..408111c9 100644 Binary files a/scikits/image/data/lena.png and b/scikits/image/data/lena.png differ diff --git a/scikits/image/data/tests/test_data.py b/scikits/image/data/tests/test_data.py new file mode 100644 index 00000000..b31c8851 --- /dev/null +++ b/scikits/image/data/tests/test_data.py @@ -0,0 +1,23 @@ +import scikits.image.data as data +from numpy.testing import assert_equal, assert_array_equal +import numpy as np + +def test_lena(): + """ Test that "Lena" image can be loaded. """ + lena = data.lena() + assert_equal(lena.shape, (512, 512, 3)) + +def test_camera(): + """ Test that "camera" image can be loaded. """ + cameraman = data.camera() + assert_equal(cameraman.ndim, 2) + +def test_checkerboard(): + """ Test that checkerboard image can be loaded. """ + checkerboard = data.checkerboard() + assert_equal(checkerboard.dtype, np.uint8) + +if __name__ == "__main__": + from numpy.testing import run_module_suite + run_module_suite() +