diff --git a/skimage/filter/rank/.gitignore b/skimage/filter/rank/.gitignore new file mode 100644 index 00000000..08a24d5c --- /dev/null +++ b/skimage/filter/rank/.gitignore @@ -0,0 +1 @@ +demo/ \ No newline at end of file diff --git a/skimage/filter/rank/demo/demo_all.py b/skimage/filter/rank/demo/demo_all.py deleted file mode 100644 index 038c749b..00000000 --- a/skimage/filter/rank/demo/demo_all.py +++ /dev/null @@ -1,77 +0,0 @@ -import matplotlib.pyplot as plt -from pprint import pprint - -from skimage import data -from skimage.morphology.selem import disk -import skimage.filter.rank as rank - -def plot_all(): - a8 = data.camera() - a16 = a8.astype('uint16')*16 - selem = disk(5) - - name_list = sorted([n for n in dir(rank) if n[0] is not '_']) - print name_list - - for n in name_list: - if n.rfind('bilateral')==0: - print n - method = eval('rank.%s'%n) - if type(method) == type(rank.maximum): - print method - f8 = method(a8,selem = selem,s0=10,s1=10) - f16 = method(a16,selem = selem,s0=10,s1=10) - plt.figure() - plt.subplot(2,2,1) - plt.imshow(a8) - plt.colorbar() - plt.subplot(2,2,2) - plt.imshow(f8) - plt.colorbar() - plt.subplot(2,2,3) - plt.imshow(f16) - plt.colorbar() - plt.title(method) - for n in name_list: - if n.rfind('percentile')==0: - print n - method = eval('rank.%s'%n) - if type(method) == type(rank.maximum): - print method - f8 = method(a8,selem = selem,p0=.1,p1=.9) - f16 = method(a16,selem = selem,p0=.1,p1=.9) - plt.figure() - plt.subplot(2,2,1) - plt.imshow(a8) - plt.colorbar() - plt.subplot(2,2,2) - plt.imshow(f8) - plt.colorbar() - plt.subplot(2,2,3) - plt.imshow(f16) - plt.colorbar() - plt.title(method) - for n in name_list: - if n.find('percentile')==-1 and n.find('bilateral')==-1: - print n - method = eval('rank.%s'%n) - if type(method) == type(rank.maximum): - print method - f8 = method(a8,selem = selem) - f16 = method(a16,selem = selem) - plt.figure() - plt.subplot(2,2,1) - plt.imshow(a8) - plt.colorbar() - plt.subplot(2,2,2) - plt.imshow(f8) - plt.colorbar() - plt.subplot(2,2,3) - plt.imshow(f16) - plt.colorbar() - plt.title(method) - plt.show() - -if __name__ == '__main__': - plot_all() - pprint(dir(rank)) \ No newline at end of file diff --git a/skimage/filter/rank/demo/demo_single.py b/skimage/filter/rank/demo/demo_single.py deleted file mode 100644 index 053f7328..00000000 --- a/skimage/filter/rank/demo/demo_single.py +++ /dev/null @@ -1,39 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -from skimage import data -from skimage.morphology.selem import disk -import skimage.filter.rank as rank -from skimage.filter import threshold_otsu - -if __name__ == '__main__': - p8 = data.page() - - radius = 10 - selem = disk(radius) - - loc_otsu = rank.otsu(p8,selem) - t_glob_otsu = threshold_otsu(p8) - glob_otsu = p8>=t_glob_otsu - - - plt.figure() - plt.subplot(2,2,1) - plt.imshow(p8,cmap=plt.cm.gray) - plt.xlabel('original') - plt.colorbar() - plt.subplot(2,2,2) - plt.imshow(loc_otsu,cmap=plt.cm.gray) - plt.xlabel('local Otsu ($radius=%d$)'%radius) - plt.colorbar() - plt.subplot(2,2,3) - plt.imshow(p8>=loc_otsu,cmap=plt.cm.gray) - plt.xlabel('original>=local Otsu'%t_glob_otsu) - plt.subplot(2,2,4) - plt.imshow(glob_otsu,cmap=plt.cm.gray) - plt.xlabel('global Otsu ($t=%d$)'%t_glob_otsu) - plt.show() - - - - diff --git a/skimage/filter/rank/demo/iko_pan_Ja1.tif b/skimage/filter/rank/demo/iko_pan_Ja1.tif deleted file mode 100644 index 47201695..00000000 Binary files a/skimage/filter/rank/demo/iko_pan_Ja1.tif and /dev/null differ diff --git a/skimage/filter/rank/demo/test_morph_contr_enh.py b/skimage/filter/rank/demo/test_morph_contr_enh.py deleted file mode 100644 index f2f0f7c9..00000000 --- a/skimage/filter/rank/demo/test_morph_contr_enh.py +++ /dev/null @@ -1,28 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt -import gdal - -from skimage.morphology import disk -import skimage.filter.rank as rank - -filename = 'iko_pan_Ja1.tif' -im16 = gdal.Open(filename).ReadAsArray().astype(np.uint16) - -plt.figure() -plt.imshow(im16,cmap=plt.cm.gray) -plt.colorbar() - -f0 = rank.median(im16,disk(1)) -f1 = rank.bilateral_mean(im16,disk(20),s0=200,s1=200) -f2 = rank.equalize(f1,disk(10)) -f3 = rank.bottomhat(f1,disk(1)) - -plt.figure() -plt.imshow(f2,cmap=plt.cm.gray,interpolation='nearest') -plt.colorbar() - -plt.show() - - - - diff --git a/skimage/filter/rank/demo/test_rank.py b/skimage/filter/rank/demo/test_rank.py deleted file mode 100644 index 09cfdcd5..00000000 --- a/skimage/filter/rank/demo/test_rank.py +++ /dev/null @@ -1,42 +0,0 @@ -import numpy as np -import matplotlib.pyplot as plt - -from skimage import data -from skimage.morphology.selem import disk -import skimage.filter.rank as rank - -print dir(rank) - -print rank.mean -print rank.percentile_mean -print rank.bilateral_mean - -a8 = data.camera() -a16 = a8.astype('uint16')*16 -selem = disk(10) - -f8 = rank.mean(a8,selem) -f16 = rank.mean(a16,selem) - -plt.figure() -plt.imshow(np.hstack((a8,f8))) -plt.colorbar() -plt.figure() -plt.imshow(np.hstack((a16,f16))) -plt.colorbar() - -f8 = rank.percentile_mean(a8,selem,p0=.1,p1=.9) -f16 = rank.percentile_mean(a16,selem,p0=.1,p1=.9) - -plt.figure() -plt.imshow(np.hstack((a8,f8))) -plt.colorbar() -plt.figure() -plt.imshow(np.hstack((a16,f16))) -plt.colorbar() - -plt.show() - - - -