Skip to content

Commit aedc7fb

Browse files
committed
Update docstrings
1 parent 97f0b91 commit aedc7fb

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

imageprocessing.py

+18-17
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def applyPhaseScram(image, coherence=0.0, rndphi=None, mask=None, nSegs=1,
293293
--------
294294
Phase scramble image with 0% coherence
295295
296-
>>> im = imageio.imread('imageio:camera.png')
296+
>>> im = imageio.imread('imageio:coffee.png')
297297
>>> scram1 = applyPhaseScram(im)
298298
299299
Scramble with 40% phase coherence
@@ -309,18 +309,17 @@ def applyPhaseScram(image, coherence=0.0, rndphi=None, mask=None, nSegs=1,
309309
Weight rndphi by mask. Here we weight by an inverted horizontal-pass
310310
filter to scramble vertical orientations but preserve horizontals.
311311
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,
316315
... filter_kwargs = {'mu':np.radians(0),
317316
... 'sigma':fwhm2sigma(np.radians(45))}
318317
... )
319318
>>> scram4 = applyPhaseScram(im, mask = filt)
320319
321320
Locally scrambled image within windows of an 8x8 grid
322321
323-
>>> local_scram = applyPhaseScram(im, nSegs = 8)
322+
>>> scram5 = applyPhaseScram(im, nSegs = 8)
324323
"""
325324
# Read in image
326325
im = imread(image)
@@ -548,7 +547,7 @@ def overlayFixation(image=None, lum=255, offset=0, arm_length=12, arm_width=2,
548547
Returns
549548
-------
550549
im : numpy array
551-
Processes image as numpy array
550+
Processed image as numpy array
552551
"""
553552
AL, AW = arm_length, arm_width # for brevity
554553

@@ -768,23 +767,24 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
768767
769768
Low-pass Gaussian filter at FHWM = 30 cycles/image
770769
770+
>>> im = imageio.imread('imageio:coffee.png')
771771
>>> from imageprocessing import fwhm2sigma
772772
>>> lowfilt = makeFourierFilter(
773-
... image, mode='sf', filtertype='gaussian',
773+
... im, mode='sf', filtertype='gaussian',
774774
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(30)}
775775
... )
776776
777777
High-pass Gaussian filter at FWHM = 50 cycles/image
778778
779779
>>> highfilt = makeFourierFilter(
780-
... image, mode='sf', filtertype='gaussian', invert=True,
780+
... im, mode='sf', filtertype='gaussian', invert=True,
781781
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(50)}
782782
... )
783783
784784
Vertical-pass Gaussian filter with at FWHM = 30 degrees
785785
786786
>>> vertfilt = makeFourierFilter(
787-
... image, mode='ori', filtertype='gaussian',
787+
... im, mode='ori', filtertype='gaussian',
788788
... filter_kwargs={'mu':np.radians(90),
789789
... 'sigma':np.radians(fwhm2sigma(30))}
790790
... )
@@ -793,7 +793,7 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
793793
side of centre orientations.
794794
795795
>>> oblqfilt = makeFourierFilter(
796-
... image, mode='ori', filtertype='butterworth',
796+
... im, mode='ori', filtertype='butterworth',
797797
... filter_kwargs=[ {'cutoff':np.radians(15), 'order':2,
798798
... 'mu':np.radians(45)},
799799
... {'cutoff':np.radians(15), 'order':2,
@@ -804,7 +804,7 @@ def makeFourierFilter(image_or_imsize, mode, filtertype, filter_kwargs={},
804804
805805
>>> def ideal(X, cutoff):
806806
... return (X <= cutoff).astype(float)
807-
>>> idealfilt = makeFourierFilter(image, mode='sf', filtertype=ideal,
807+
>>> idealfilt = makeFourierFilter(im, mode='sf', filtertype=ideal,
808808
... filter_kwargs={'cutoff':30})
809809
810810
See also
@@ -903,9 +903,10 @@ def applyFourierFilter(image, filt, **kwargs):
903903
904904
Low-pass Gaussian filter image at FHWM = 30 cycles/image
905905
906+
>>> im = imageio.imread('imageio:coffee.png')
906907
>>> from imageprocessing import fwhm2sigma
907908
>>> lowfilt = makeFourierFilter(
908-
... image, mode='sf', filtertype='gaussian',
909+
... im, mode='sf', filtertype='gaussian',
909910
... filter_kwargs={'mu':0, 'sigma':fwhm2sigma(30)}
910911
... )
911912
>>> filtim = applyFourierFilter(image, filt)
@@ -960,13 +961,15 @@ def makeHybridImage(image1, image2, filter1_params, filter2_params, **kwargs):
960961
below FWHM = 30 cycles/image, and the second image high-pass filtered
961962
above FWHM = 50 cycles/image.
962963
964+
>>> im1 = imageio.imread('imageio:camera.png')
965+
>>> im2 = imageio.imread('imageio:astronaut.png', as_gray=True)
963966
>>> from imageprocessing import fwhm2sigma
964967
>>> filter1_params = {'mode':'sf', 'filtertype':'gaussian', 'invert':False,
965968
... 'filter_kwargs':{'sigma':fwhm2sigma(30)}}
966969
>>> filter2_params = {'mode':'sf', 'filtertype':'gaussian', 'invert':True,
967970
... 'filter_kwargs':{'sigma':fwhm2sigma(50)}}
968971
>>> hybrid = makeHybridImage(
969-
... image1, image2, filter1_params, filter2_params
972+
... im1, im2, filter1_params, filter2_params
970973
... )
971974
"""
972975
# Read images
@@ -1024,7 +1027,7 @@ class SoftWindowImage():
10241027
--------
10251028
Apply a rectangular soft window
10261029
1027-
>>> im = imageio.imread('imageio:camera.png')
1030+
>>> im = imageio.imread('imageio:astronaut.png')
10281031
>>> windower = SoftWindowImage('rect')
10291032
>>> winIm = windower.maskImage(im)
10301033
@@ -1114,12 +1117,10 @@ def maskImage(self, image, bglum='mean', **kwargs):
11141117
**kwargs
11151118
Additional keyword arguments are passed to postproc_im function.
11161119
1117-
11181120
Returns
11191121
-------
11201122
im : numpy array
11211123
Masked image as numpy array with datatype uint8.
1122-
11231124
"""
11241125
# Read image
11251126
im = imread(image)

0 commit comments

Comments
 (0)