From 9c770dbdf2fe55ac2c06f37611468b81632f0b1a Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 31 Dec 2014 15:16:00 +1100 Subject: [PATCH] Prefer row/col to r/c when talking about circles --- doc/source/user_guide/numpy_images.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/source/user_guide/numpy_images.txt b/doc/source/user_guide/numpy_images.txt index e11616d8..d494ccdc 100644 --- a/doc/source/user_guide/numpy_images.txt +++ b/doc/source/user_guide/numpy_images.txt @@ -74,9 +74,11 @@ of same shape as the image (or a shape broadcastable to the image shape). This can be useful to define a region of interest, such as a disk: :: - >>> l_r, l_c = camera.shape - >>> R, C = np.ogrid[:l_r, :l_c] - >>> outer_disk_mask = (R - l_r / 2)**2 + (C - l_c / 2)**2 < (l_r / 2)**2 + >>> nrows, ncols = camera.shape + >>> row, col = np.ogrid[:nrows, :ncols] + >>> cnt_row, cnt_col = nrows / 2, ncols / 2 + >>> outer_disk_mask = ((row - cnt_row)**2 + (col - cnt_col)**2 < + ... (nrows / 2)**2) >>> camera[outer_disk_mask] = 0 .. image:: ../../_images/plot_camera_numpy_1.png @@ -85,7 +87,7 @@ disk: :: Boolean arithmetic can be used to define more complex masks: :: - >>> lower_half = R > l_r / 2 + >>> lower_half = row > cnt_row >>> lower_half_disk = np.logical_and(lower_half, outer_disk_mask) >>> camera = data.camera() >>> camera[lower_half_disk] = 0