mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-10 12:35:06 +08:00
BUG: More Python3 fixes by Christoph Gohlke.
This commit is contained in:
@@ -12,7 +12,7 @@ Original author: Lee Kamentsky
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import _ctmf
|
from . import _ctmf
|
||||||
from rank_order import rank_order
|
from rank_order import rank_order
|
||||||
|
|
||||||
def median_filter(data, mask=None, radius=1, percent=50):
|
def median_filter(data, mask=None, radius=1, percent=50):
|
||||||
@@ -59,7 +59,7 @@ def median_filter(data, mask=None, radius=1, percent=50):
|
|||||||
if max_ranked_data == 0:
|
if max_ranked_data == 0:
|
||||||
return data
|
return data
|
||||||
if max_ranked_data > 255:
|
if max_ranked_data > 255:
|
||||||
ranked_data = ranked_data * 255 / max_ranked_data
|
ranked_data = ranked_data * 255 // max_ranked_data
|
||||||
was_ranked = True
|
was_ranked = True
|
||||||
else:
|
else:
|
||||||
ranked_data = data[mask]
|
ranked_data = data[mask]
|
||||||
@@ -78,7 +78,7 @@ def median_filter(data, mask=None, radius=1, percent=50):
|
|||||||
# use the translation to look up the original value in the data.
|
# use the translation to look up the original value in the data.
|
||||||
#
|
#
|
||||||
if max_ranked_data > 255:
|
if max_ranked_data > 255:
|
||||||
result = translation[output.astype(np.uint32) * max_ranked_data / 255]
|
result = translation[output.astype(np.uint32) * max_ranked_data // 255]
|
||||||
else:
|
else:
|
||||||
result = translation[output]
|
result = translation[output]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from _mcp import MCP, MCP_Geometric, make_offsets
|
from ._mcp import MCP, MCP_Geometric, make_offsets
|
||||||
|
|
||||||
def route_through_array(array, start, end, fully_connected=True, geometric=True):
|
def route_through_array(array, start, end, fully_connected=True, geometric=True):
|
||||||
"""Simple example of how to use the MCP and MCP_Geometric classes.
|
"""Simple example of how to use the MCP and MCP_Geometric classes.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import _spath
|
from . import _spath
|
||||||
|
|
||||||
def shortest_path(arr, reach=1, axis=-1, output_indexlist=False):
|
def shortest_path(arr, reach=1, axis=-1, output_indexlist=False):
|
||||||
"""Find the shortest path through an n-d array from one side to another.
|
"""Find the shortest path through an n-d array from one side to another.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import _colormixer
|
from . import _colormixer
|
||||||
import _histograms
|
from . import _histograms
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
# utilities to make life easier for plugin writers.
|
# utilities to make life easier for plugin writers.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -7,6 +8,10 @@ from scikits.image import data_dir
|
|||||||
from scikits.image.io import ImageCollection, MultiImage
|
from scikits.image.io import ImageCollection, MultiImage
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info[0] > 2:
|
||||||
|
basestring = str
|
||||||
|
|
||||||
|
|
||||||
class TestImageCollection():
|
class TestImageCollection():
|
||||||
pattern = [os.path.join(data_dir, pic) for pic in ['camera.png',
|
pattern = [os.path.join(data_dir, pic) for pic in ['camera.png',
|
||||||
'color.png']]
|
'color.png']]
|
||||||
|
|||||||
@@ -3,13 +3,18 @@
|
|||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.testing import *
|
from numpy.testing import *
|
||||||
|
|
||||||
from scikits.image import data_dir
|
from scikits.image import data_dir
|
||||||
import cPickle
|
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
import cPickle
|
||||||
|
else:
|
||||||
|
import pickle as cPickle
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
|
|||||||
Reference in New Issue
Block a user