prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  regionsprops_table is not mentioned in the doc
  We should use it in an existing example, or add a new example.
  
  </issue>
  <code>
  [start of doc/examples/segmentation/plot_regionprops.py]
  1 """
  2 =========================
  3 Measure region properties
  4 =========================
  5 
  6 This example shows how to measure properties of labelled image regions.
  7 
  8 """
  9 import math
  10 import matplotlib.pyplot as plt
  11 import numpy as np
  12 
  13 from skimage.draw import ellipse
  14 from skimage.measure import label, regionprops
  15 from skimage.transform import rotate
  16 
  17 
  18 image = np.zeros((600, 600))
  19 
  20 rr, cc = ellipse(300, 350, 100, 220)
  21 image[rr, cc] = 1
  22 
  23 image = rotate(image, angle=15, order=0)
  24 
  25 label_img = label(image)
  26 regions = regionprops(label_img)
  27 
  28 fig, ax = plt.subplots()
  29 ax.imshow(image, cmap=plt.cm.gray)
  30 
  31 for props in regions:
  32     y0, x0 = props.centroid
  33     orientation = props.orientation
  34     x1 = x0 + math.cos(orientation) * 0.5 * props.major_axis_length
  35     y1 = y0 - math.sin(orientation) * 0.5 * props.major_axis_length
  36     x2 = x0 - math.sin(orientation) * 0.5 * props.minor_axis_length
  37     y2 = y0 - math.cos(orientation) * 0.5 * props.minor_axis_length
  38 
  39     ax.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)
  40     ax.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)
  41     ax.plot(x0, y0, '.g', markersize=15)
  42 
  43     minr, minc, maxr, maxc = props.bbox
  44     bx = (minc, maxc, maxc, minc, minc)
  45     by = (minr, minr, maxr, maxr, minr)
  46     ax.plot(bx, by, '-b', linewidth=2.5)
  47 
  48 ax.axis((0, 600, 600, 0))
  49 plt.show()
  50
  [end of doc/examples/segmentation/plot_regionprops.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/doc/examples/segmentation/plot_regionprops.py b/doc/examples/segmentation/plot_regionprops.py
  --- a/doc/examples/segmentation/plot_regionprops.py
  +++ b/doc/examples/segmentation/plot_regionprops.py
  @@ -3,15 +3,17 @@
   Measure region properties
   =========================
   
  -This example shows how to measure properties of labelled image regions.
  +This example shows how to measure properties of labelled image regions. We
  +analyze an image with two ellipses.
   
   """
   import math
   import matplotlib.pyplot as plt
   import numpy as np
  +import pandas as pd
   
   from skimage.draw import ellipse
  -from skimage.measure import label, regionprops
  +from skimage.measure import label, regionprops, regionprops_table
   from skimage.transform import rotate
   
   
  @@ -22,19 +24,27 @@
   
   image = rotate(image, angle=15, order=0)
   
  +rr, cc = ellipse(100, 100, 60, 50)
  +image[rr, cc] = 1
  +
   label_img = label(image)
   regions = regionprops(label_img)
   
  +#####################################################################
  +# We use the :py:func:`skimage.measure.regionprops` result to draw certain
  +# properties on each region. For example, in red, we plot the major and minor
  +# axes of each ellipse.
  +
   fig, ax = plt.subplots()
   ax.imshow(image, cmap=plt.cm.gray)
   
   for props in regions:
       y0, x0 = props.centroid
       orientation = props.orientation
  -    x1 = x0 + math.cos(orientation) * 0.5 * props.major_axis_length
  -    y1 = y0 - math.sin(orientation) * 0.5 * props.major_axis_length
  -    x2 = x0 - math.sin(orientation) * 0.5 * props.minor_axis_length
  -    y2 = y0 - math.cos(orientation) * 0.5 * props.minor_axis_length
  +    x1 = x0 + math.cos(orientation) * 0.5 * props.minor_axis_length
  +    y1 = y0 - math.sin(orientation) * 0.5 * props.minor_axis_length
  +    x2 = x0 - math.sin(orientation) * 0.5 * props.major_axis_length
  +    y2 = y0 - math.cos(orientation) * 0.5 * props.major_axis_length
   
       ax.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)
       ax.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)
  @@ -47,3 +57,22 @@
   
   ax.axis((0, 600, 600, 0))
   plt.show()
  +
  +#####################################################################
  +# We use the :py:func:`skimage.measure.regionprops_table` to compute
  +# (selected) properties for each region. Note that
  +# ``skimage.measure.regionprops_table`` actually computes the properties,
  +# whereas ``skimage.measure.regionprops`` computes them when they come in use
  +# (lazy evaluation).
  +
  +props = regionprops_table(label_img, properties=('centroid',
  +                                                 'orientation',
  +                                                 'major_axis_length',
  +                                                 'minor_axis_length'))
  +
  +#####################################################################
  +# We now display a table of these selected properties (one region per row),
  +# the ``skimage.measure.regionprops_table`` result being a pandas-compatible
  +# dict.
  +
  +pd.DataFrame(props)
  
verification_info: {"golden_diff": "diff --git a/doc/examples/segmentation/plot_regionprops.py b/doc/examples/segmentation/plot_regionprops.py\n--- a/doc/examples/segmentation/plot_regionprops.py\n+++ b/doc/examples/segmentation/plot_regionprops.py\n@@ -3,15 +3,17 @@\n Measure region properties\n =========================\n \n-This example shows how to measure properties of labelled image regions.\n+This example shows how to measure properties of labelled image regions. We\n+analyze an image with two ellipses.\n \n \"\"\"\n import math\n import matplotlib.pyplot as plt\n import numpy as np\n+import pandas as pd\n \n from skimage.draw import ellipse\n-from skimage.measure import label, regionprops\n+from skimage.measure import label, regionprops, regionprops_table\n from skimage.transform import rotate\n \n \n@@ -22,19 +24,27 @@\n \n image = rotate(image, angle=15, order=0)\n \n+rr, cc = ellipse(100, 100, 60, 50)\n+image[rr, cc] = 1\n+\n label_img = label(image)\n regions = regionprops(label_img)\n \n+#####################################################################\n+# We use the :py:func:`skimage.measure.regionprops` result to draw certain\n+# properties on each region. For example, in red, we plot the major and minor\n+# axes of each ellipse.\n+\n fig, ax = plt.subplots()\n ax.imshow(image, cmap=plt.cm.gray)\n \n for props in regions:\n     y0, x0 = props.centroid\n     orientation = props.orientation\n-    x1 = x0 + math.cos(orientation) * 0.5 * props.major_axis_length\n-    y1 = y0 - math.sin(orientation) * 0.5 * props.major_axis_length\n-    x2 = x0 - math.sin(orientation) * 0.5 * props.minor_axis_length\n-    y2 = y0 - math.cos(orientation) * 0.5 * props.minor_axis_length\n+    x1 = x0 + math.cos(orientation) * 0.5 * props.minor_axis_length\n+    y1 = y0 - math.sin(orientation) * 0.5 * props.minor_axis_length\n+    x2 = x0 - math.sin(orientation) * 0.5 * props.major_axis_length\n+    y2 = y0 - math.cos(orientation) * 0.5 * props.major_axis_length\n \n     ax.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)\n     ax.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)\n@@ -47,3 +57,22 @@\n \n ax.axis((0, 600, 600, 0))\n plt.show()\n+\n+#####################################################################\n+# We use the :py:func:`skimage.measure.regionprops_table` to compute\n+# (selected) properties for each region. Note that\n+# ``skimage.measure.regionprops_table`` actually computes the properties,\n+# whereas ``skimage.measure.regionprops`` computes them when they come in use\n+# (lazy evaluation).\n+\n+props = regionprops_table(label_img, properties=('centroid',\n+                                                 'orientation',\n+                                                 'major_axis_length',\n+                                                 'minor_axis_length'))\n+\n+#####################################################################\n+# We now display a table of these selected properties (one region per row),\n+# the ``skimage.measure.regionprops_table`` result being a pandas-compatible\n+# dict.\n+\n+pd.DataFrame(props)\n", "issue": "regionsprops_table is not mentioned in the doc\nWe should use it in an existing example, or add a new example.\n", "before_files": [{"content": "\"\"\"\n=========================\nMeasure region properties\n=========================\n\nThis example shows how to measure properties of labelled image regions.\n\n\"\"\"\nimport math\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom skimage.draw import ellipse\nfrom skimage.measure import label, regionprops\nfrom skimage.transform import rotate\n\n\nimage = np.zeros((600, 600))\n\nrr, cc = ellipse(300, 350, 100, 220)\nimage[rr, cc] = 1\n\nimage = rotate(image, angle=15, order=0)\n\nlabel_img = label(image)\nregions = regionprops(label_img)\n\nfig, ax = plt.subplots()\nax.imshow(image, cmap=plt.cm.gray)\n\nfor props in regions:\n    y0, x0 = props.centroid\n    orientation = props.orientation\n    x1 = x0 + math.cos(orientation) * 0.5 * props.major_axis_length\n    y1 = y0 - math.sin(orientation) * 0.5 * props.major_axis_length\n    x2 = x0 - math.sin(orientation) * 0.5 * props.minor_axis_length\n    y2 = y0 - math.cos(orientation) * 0.5 * props.minor_axis_length\n\n    ax.plot((x0, x1), (y0, y1), '-r', linewidth=2.5)\n    ax.plot((x0, x2), (y0, y2), '-r', linewidth=2.5)\n    ax.plot(x0, y0, '.g', markersize=15)\n\n    minr, minc, maxr, maxc = props.bbox\n    bx = (minc, maxc, maxc, minc, minc)\n    by = (minr, minr, maxr, maxr, minr)\n    ax.plot(bx, by, '-b', linewidth=2.5)\n\nax.axis((0, 600, 600, 0))\nplt.show()\n", "path": "doc/examples/segmentation/plot_regionprops.py"}]}