mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-08 06:11:19 +08:00
Merge pull request #1199 from blink1073/use-pypi-tifffile
Use PyPI tifffile or fall back on local version
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ source = skimage
|
||||
include = */skimage/*
|
||||
omit =
|
||||
*/setup.py
|
||||
*/skimage/io/_plugins/tifffile.py
|
||||
*/skimage/external/*
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
|
||||
+11
-1
@@ -15,13 +15,23 @@ python:
|
||||
- 3.4
|
||||
|
||||
before_install:
|
||||
- tools/travis_setup.sh
|
||||
- export DISPLAY=:99.0
|
||||
- export PYTHONWARNINGS="all"
|
||||
- export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/"
|
||||
- travis_retry tools/travis_setup.sh
|
||||
|
||||
install:
|
||||
- python setup.py build_ext --inplace
|
||||
- python setup.py install
|
||||
|
||||
script:
|
||||
- tools/header.py "Run all tests with minimum dependencies"
|
||||
- nosetests --exe -v skimage
|
||||
|
||||
- tools/header.py "Pep8 and Flake tests"
|
||||
- flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
||||
|
||||
- travis_retry tools/travis_install_optional.sh
|
||||
- tools/travis_test.sh
|
||||
|
||||
after_success:
|
||||
|
||||
+2
-2
@@ -157,9 +157,9 @@ Library:
|
||||
Extension: skimage.graph._ncut_cy
|
||||
Sources:
|
||||
skimage/graph/_ncut_cy.pyx
|
||||
Extension: skimage.io._plugins._tifffile
|
||||
Extension: skimage.external.tifffile._tifffile
|
||||
Sources:
|
||||
skimage/io/_plugins/tifffile.c
|
||||
skimage/external/tifffile/_tifffile.c
|
||||
|
||||
Executable: skivi
|
||||
Module: skimage.scripts.skivi
|
||||
|
||||
@@ -141,12 +141,9 @@ if __name__ == "__main__":
|
||||
],
|
||||
|
||||
configuration=configuration,
|
||||
install_requires=[
|
||||
"six>=%s" % '.'.join(str(d) for d in DEPENDENCIES['six'])
|
||||
],
|
||||
packages=setuptools.find_packages(exclude=['doc']),
|
||||
include_package_data=True,
|
||||
zip_safe=False, # the package can run out of an .egg file
|
||||
zip_safe=False, # the package can run out of an .egg file
|
||||
|
||||
entry_points={
|
||||
'console_scripts': ['skivi = skimage.scripts.skivi:main'],
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
_plugins.tifffile.py
|
||||
tifffile
|
||||
|
||||
Copyright (c) 2008-2014, Christoph Gohlke
|
||||
Copyright (c) 2008-2014, The Regents of the University of California
|
||||
Vendored
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os.path
|
||||
|
||||
base_path = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def configuration(parent_package='', top_path=None):
|
||||
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
|
||||
|
||||
config = Configuration('external', parent_package, top_path)
|
||||
|
||||
config.add_extension('tifffile._tifffile',
|
||||
sources=['tifffile/tifffile.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
return config
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy.distutils.core import setup
|
||||
setup(maintainer='scikit-image Developers',
|
||||
maintainer_email='scikit-image@googlegroups.com',
|
||||
description='External Libaries',
|
||||
url='https://github.com/scikit-image/scikit-image',
|
||||
license='Modified BSD',
|
||||
**(configuration(top_path='').todict())
|
||||
)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
try:
|
||||
from tifffile import imread, imsave, TiffFile
|
||||
except ImportError:
|
||||
from .tifffile_local import imread, imsave, TiffFile
|
||||
+16
-22
@@ -151,15 +151,9 @@ from xml.etree import cElementTree as etree
|
||||
|
||||
import numpy
|
||||
|
||||
try:
|
||||
from . import _tifffile
|
||||
except ImportError:
|
||||
warnings.warn(
|
||||
"failed to import the optional _tifffile C extension module.\n"
|
||||
"Loading of some compressed images will be slow.\n"
|
||||
"Tifffile.c can be obtained at http://www.lfd.uci.edu/~gohlke/")
|
||||
from . import _tifffile
|
||||
|
||||
__version__ = '2014.08.24'
|
||||
__version__ = '0.3.3'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
__all__ = ('imsave', 'imread', 'imshow', 'TiffFile', 'TiffWriter',
|
||||
'TiffSequence')
|
||||
@@ -187,7 +181,7 @@ def imsave(filename, data, **kwargs):
|
||||
Examples
|
||||
--------
|
||||
>>> data = numpy.random.rand(2, 5, 3, 301, 219)
|
||||
>>> description = u'{"shape": %s}' % str(list(data.shape))
|
||||
>>> description = '{"shape": %s}' % str(list(data.shape))
|
||||
>>> imsave('temp.tif', data, compress=6,
|
||||
... extratags=[(270, 's', 0, description, True)])
|
||||
|
||||
@@ -669,12 +663,12 @@ def imread(files, **kwargs):
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> im = imread('test.tif', key=0)
|
||||
>>> im = imread('temp.tif', key=0)
|
||||
>>> im.shape
|
||||
(256, 256, 4)
|
||||
>>> ims = imread(['test.tif', 'test.tif'])
|
||||
(3, 301, 219)
|
||||
>>> ims = imread(['temp.tif', 'temp.tif'])
|
||||
>>> ims.shape
|
||||
(2, 256, 256, 4)
|
||||
(2, 10, 3, 301, 219)
|
||||
|
||||
"""
|
||||
kwargs_file = {}
|
||||
@@ -739,10 +733,10 @@ class TiffFile(object):
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> with TiffFile('test.tif') as tif:
|
||||
>>> with TiffFile('temp.tif') as tif:
|
||||
... data = tif.asarray()
|
||||
... data.shape
|
||||
(256, 256, 4)
|
||||
(5, 301, 219)
|
||||
|
||||
"""
|
||||
def __init__(self, arg, name=None, offset=None, size=None,
|
||||
@@ -2221,11 +2215,11 @@ class TiffSequence(object):
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> tifs = TiffSequence("test.oif.files/*.tif")
|
||||
>>> tifs.shape, tifs.axes
|
||||
>>> tifs = TiffSequence("test.oif.files/*.tif") # doctest: +SKIP
|
||||
>>> tifs.shape, tifs.axes # doctest: +SKIP
|
||||
((2, 100), 'CT')
|
||||
>>> data = tifs.asarray()
|
||||
>>> data.shape
|
||||
>>> data = tifs.asarray() # doctest: +SKIP
|
||||
>>> data.shape # doctest: +SKIP
|
||||
(2, 100, 256, 256)
|
||||
|
||||
"""
|
||||
@@ -3454,7 +3448,7 @@ def stripnull(string):
|
||||
|
||||
Clean NULL terminated C strings.
|
||||
|
||||
>>> stripnull(b'string\\x00')
|
||||
>>> stripnull(b'string\\x00') # doctest: +SKIP
|
||||
b'string'
|
||||
|
||||
"""
|
||||
@@ -3467,9 +3461,9 @@ def stripascii(string):
|
||||
|
||||
Clean NULL separated and terminated TIFF strings.
|
||||
|
||||
>>> stripascii(b'string\\x00string\\n\\x01\\x00')
|
||||
>>> stripascii(b'string\\x00string\\n\\x01\\x00') # doctest: +SKIP
|
||||
b'string\\x00string\\n'
|
||||
>>> stripascii(b'\\x00')
|
||||
>>> stripascii(b'\\x00') # doctest: +SKIP
|
||||
b''
|
||||
|
||||
"""
|
||||
@@ -14,7 +14,7 @@ except ImportError:
|
||||
from skimage.util import img_as_ubyte, img_as_uint
|
||||
|
||||
from six import string_types
|
||||
from .tifffile import imread as tif_imread, imsave as tif_imsave
|
||||
from skimage.external.tifffile import imread as tif_imread, imsave as tif_imsave
|
||||
|
||||
|
||||
def imread(fname, dtype=None):
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
try:
|
||||
from .tifffile import imread, imsave
|
||||
except ImportError:
|
||||
raise ImportError("The tifffile module could not be found.\n"
|
||||
"It can be obtained at "
|
||||
"<http://www.lfd.uci.edu/~gohlke/code/tifffile.py>\n")
|
||||
from skimage.external.tifffile import imread, imsave
|
||||
|
||||
@@ -27,10 +27,6 @@ def configuration(parent_package='', top_path=None):
|
||||
sources=['_plugins/_histograms.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
|
||||
config.add_extension('_plugins._tifffile',
|
||||
sources=['_plugins/tifffile.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
|
||||
return config
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -21,6 +21,7 @@ def configuration(parent_package='', top_path=None):
|
||||
config.add_subpackage('transform')
|
||||
config.add_subpackage('util')
|
||||
config.add_subpackage('segmentation')
|
||||
config.add_subpackage('external')
|
||||
|
||||
def add_test_directories(arg, dirname, fnames):
|
||||
if dirname.split(os.path.sep)[-1] == 'tests':
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
tools/header.py "Install optional dependencies"
|
||||
|
||||
# Install Qt and then update the Matplotlib settings
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sudo apt-get install -q python-qt4
|
||||
|
||||
else
|
||||
sudo apt-get install -q libqt4-dev
|
||||
pip install PySide $WHEELHOUSE
|
||||
python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install
|
||||
fi
|
||||
|
||||
# imread does NOT support py3.2
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
|
||||
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
||||
pip install imread
|
||||
fi
|
||||
|
||||
# TODO: update when SimpleITK become available on py34 or hopefully pip
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then
|
||||
easy_install SimpleITK
|
||||
fi
|
||||
|
||||
sudo apt-get install libfreeimage3
|
||||
pip install astropy
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
||||
pip install pyamg
|
||||
fi
|
||||
|
||||
pip install tifffile
|
||||
@@ -4,8 +4,6 @@ set -ex
|
||||
sh -e /etc/init.d/xvfb start
|
||||
sudo apt-get update
|
||||
|
||||
WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/"
|
||||
|
||||
pip install wheel flake8 coveralls nose
|
||||
pip uninstall -y numpy
|
||||
|
||||
|
||||
+3
-39
@@ -1,52 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
export DISPLAY=:99.0
|
||||
export PYTHONWARNINGS="all"
|
||||
WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/"
|
||||
|
||||
tools/header.py "Run all tests with minimum dependencies"
|
||||
nosetests --exe -v skimage
|
||||
|
||||
tools/header.py "Pep8 and Flake tests"
|
||||
flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
||||
|
||||
tools/header.py "Install optional dependencies"
|
||||
|
||||
# Install Qt and then update the Matplotlib settings
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sudo apt-get install -q python-qt4
|
||||
MPL_QT_API=PyQt4
|
||||
MPL_DIR=$HOME/.matplotlib
|
||||
export QT_API=pyqt
|
||||
|
||||
else
|
||||
sudo apt-get install -q libqt4-dev
|
||||
pip install PySide $WHEELHOUSE
|
||||
python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install
|
||||
MPL_QT_API=PySide
|
||||
MPL_DIR=$HOME/.config/matplotlib
|
||||
export QT_API=pyside
|
||||
fi
|
||||
|
||||
# imread does NOT support py3.2
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
|
||||
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
||||
pip install imread
|
||||
fi
|
||||
|
||||
# TODO: update when SimpleITK become available on py34 or hopefully pip
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then
|
||||
easy_install SimpleITK
|
||||
fi
|
||||
|
||||
sudo apt-get install libfreeimage3
|
||||
pip install astropy
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
||||
pip install pyamg
|
||||
fi
|
||||
|
||||
# Matplotlib settings - do not show figures during doc examples
|
||||
mkdir -p $MPL_DIR
|
||||
touch $MPL_DIR/matplotlibrc
|
||||
@@ -75,10 +40,9 @@ echo 'backend.qt4 : '$MPL_QT_API >> $MPL_DIR/matplotlibrc
|
||||
|
||||
tools/header.py "Run tests with all dependencies"
|
||||
# run tests again with optional dependencies to get more coverage
|
||||
TEST_ARGS='--exe -v --with-doctest'
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then
|
||||
export TEST_ARGS="--with-cov --cover-package skimage"
|
||||
else
|
||||
export TEST_ARGS=""
|
||||
TEST_ARGS="$TEST_ARGS --with-cov --cover-package skimage"
|
||||
fi
|
||||
nosetests --exe -v --with-doctest $TEST_ARGS
|
||||
nosetests $TEST_ARGS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user