@@ -293,7 +293,7 @@ def applyPhaseScram(image, coherence=0.0, rndphi=None, mask=None, nSegs=1,
293
293
--------
294
294
Phase scramble image with 0% coherence
295
295
296
- >>> im = imageio.imread('imageio:camera .png')
296
+ >>> im = imageio.imread('imageio:coffee .png')
297
297
>>> scram1 = applyPhaseScram(im)
298
298
299
299
Scramble with 40% phase coherence
@@ -309,18 +309,17 @@ def applyPhaseScram(image, coherence=0.0, rndphi=None, mask=None, nSegs=1,
309
309
Weight rndphi by mask. Here we weight by an inverted horizontal-pass
310
310
filter to scramble vertical orientations but preserve horizontals.
311
311
312
- >>> from imageprocessing import FourierFilter
313
- >>> filterer = FourierFilter(im)
314
- >>> filt = filterer.makeFilter(
315
- ... mode='ori', filtertype='gaussian', invert=True,
312
+ >>> from imageprocessing import makeFourierFilter
313
+ >>> filt = makeFourierFilter(
314
+ ... im, mode='ori', filtertype='gaussian', invert=True,
316
315
... filter_kwargs = {'mu':np.radians(0),
317
316
... 'sigma':fwhm2sigma(np.radians(45))}
318
317
... )
319
318
>>> scram4 = applyPhaseScram(im, mask = filt)
320
319
321
320
Locally scrambled image within windows of an 8x8 grid
322
321
323
- >>> local_scram = applyPhaseScram(im, nSegs = 8)
322
+ >>> scram5 = applyPhaseScram(im, nSegs = 8)
324
323
"""
325
324
# Read in image
326
325
im = imread (image )
@@ -548,7 +547,7 @@ def overlayFixation(image=None, lum=255, offset=0, arm_length=12, arm_width=2,
548
547
Returns
549
548
-------
550
549
im : numpy array
551
- Processes image as numpy array
550
+ Processed image as numpy array
552
551
"""
553
552
AL , AW = arm_length , arm_width # for brevity
554
553
@@ -768,23 +767,24 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
768
767
769
768
Low-pass Gaussian filter at FHWM = 30 cycles/image
770
769
770
+ >>> im = imageio.imread('imageio:coffee.png')
771
771
>>> from imageprocessing import fwhm2sigma
772
772
>>> lowfilt = makeFourierFilter(
773
- ... image , mode='sf', filtertype='gaussian',
773
+ ... im , mode='sf', filtertype='gaussian',
774
774
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(30)}
775
775
... )
776
776
777
777
High-pass Gaussian filter at FWHM = 50 cycles/image
778
778
779
779
>>> highfilt = makeFourierFilter(
780
- ... image , mode='sf', filtertype='gaussian', invert=True,
780
+ ... im , mode='sf', filtertype='gaussian', invert=True,
781
781
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(50)}
782
782
... )
783
783
784
784
Vertical-pass Gaussian filter with at FWHM = 30 degrees
785
785
786
786
>>> vertfilt = makeFourierFilter(
787
- ... image , mode='ori', filtertype='gaussian',
787
+ ... im , mode='ori', filtertype='gaussian',
788
788
... filter_kwargs={'mu':np.radians(90),
789
789
... 'sigma':np.radians(fwhm2sigma(30))}
790
790
... )
@@ -793,7 +793,7 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
793
793
side of centre orientations.
794
794
795
795
>>> oblqfilt = makeFourierFilter(
796
- ... image , mode='ori', filtertype='butterworth',
796
+ ... im , mode='ori', filtertype='butterworth',
797
797
... filter_kwargs=[ {'cutoff':np.radians(15), 'order':2,
798
798
... 'mu':np.radians(45)},
799
799
... {'cutoff':np.radians(15), 'order':2,
@@ -804,7 +804,7 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
804
804
805
805
>>> def ideal(X, cutoff):
806
806
... return (X <= cutoff).astype(float)
807
- >>> idealfilt = makeFourierFilter(image , mode='sf', filtertype=ideal,
807
+ >>> idealfilt = makeFourierFilter(im , mode='sf', filtertype=ideal,
808
808
... filter_kwargs={'cutoff':30})
809
809
810
810
See also
@@ -903,9 +903,10 @@ def applyFourierFilter(image, filt, **kwargs):
903
903
904
904
Low-pass Gaussian filter image at FHWM = 30 cycles/image
905
905
906
+ >>> im = imageio.imread('imageio:coffee.png')
906
907
>>> from imageprocessing import fwhm2sigma
907
908
>>> lowfilt = makeFourierFilter(
908
- ... image , mode='sf', filtertype='gaussian',
909
+ ... im , mode='sf', filtertype='gaussian',
909
910
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(30)}
910
911
... )
911
912
>>> filtim = applyFourierFilter(image, filt)
@@ -960,13 +961,15 @@ def makeHybridImage(image1, image2, filter1_params, filter2_params, **kwargs):
960
961
below FWHM = 30 cycles/image, and the second image high-pass filtered
961
962
above FWHM = 50 cycles/image.
962
963
964
+ >>> im1 = imageio.imread('imageio:camera.png')
965
+ >>> im2 = imageio.imread('imageio:astronaut.png', as_gray=True)
963
966
>>> from imageprocessing import fwhm2sigma
964
967
>>> filter1_params = {'mode':'sf', 'filtertype':'gaussian', 'invert':False,
965
968
... 'filter_kwargs':{'sigma':fwhm2sigma(30)}}
966
969
>>> filter2_params = {'mode':'sf', 'filtertype':'gaussian', 'invert':True,
967
970
... 'filter_kwargs':{'sigma':fwhm2sigma(50)}}
968
971
>>> hybrid = makeHybridImage(
969
- ... image1, image2 , filter1_params, filter2_params
972
+ ... im1, im2 , filter1_params, filter2_params
970
973
... )
971
974
"""
972
975
# Read images
@@ -1024,7 +1027,7 @@ class SoftWindowImage():
1024
1027
--------
1025
1028
Apply a rectangular soft window
1026
1029
1027
- >>> im = imageio.imread('imageio:camera .png')
1030
+ >>> im = imageio.imread('imageio:astronaut .png')
1028
1031
>>> windower = SoftWindowImage('rect')
1029
1032
>>> winIm = windower.maskImage(im)
1030
1033
@@ -1114,12 +1117,10 @@ def maskImage(self, image, bglum='mean', **kwargs):
1114
1117
**kwargs
1115
1118
Additional keyword arguments are passed to postproc_im function.
1116
1119
1117
-
1118
1120
Returns
1119
1121
-------
1120
1122
im : numpy array
1121
1123
Masked image as numpy array with datatype uint8.
1122
-
1123
1124
"""
1124
1125
# Read image
1125
1126
im = imread (image )
0 commit comments