{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function can be applied to N-dimensional images, by passing "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "start"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "end"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "extent"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as tuples of length N."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "coords",
              "annotation": "array of int, shape (Ndim, Npoints)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The coordinates of all pixels in the rectangle."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Generate coordinates of pixels within a rectangle."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "start",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Origin point of the rectangle, e.g., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "([plane,] row, column)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "end",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "End point of the rectangle "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "([plane,] row, column)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". For a 2D matrix, the slice defined by the rectangle is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "[start:(end+1)]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Either "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "end"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "extent"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " must be specified."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extent",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The extent (size) of the drawn rectangle.  E.g., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "([num_planes,] num_rows, num_cols)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Either "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "end"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "extent"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " must be specified. A negative extent is valid, and will result in a rectangle going along the opposite direction. If extent is negative, the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "start"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " point is not included."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "shape",
              "annotation": "tuple, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Image shape used to determine the maximum bounds of the output coordinates. This is useful for clipping rectangles that exceed the image size. By default, no clipping is done."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Returns",
    "Yields",
    "Receives",
    "Raises",
    "Warns",
    "Other Parameters",
    "Attributes",
    "Methods",
    "Notes",
    "Warnings"
  ],
  "item_file": "/dev/scikit-image/src/skimage/draw/draw.py",
  "item_line": 774,
  "item_type": "function",
  "aliases": [
    "skimage.draw.rectangle"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom skimage.draw import rectangle\nimg = np.zeros((5, 5), dtype=np.uint8)\nstart = (1, 1)\nextent = (3, 3)\nrr, cc = rectangle(start, extent=extent, shape=img.shape)\nimg[rr, cc] = 1\nimg\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "img = np.zeros((5, 5), dtype=np.uint8)\nstart = (0, 1)\nend = (3, 3)\nrr, cc = rectangle(start, end=end, shape=img.shape)\nimg[rr, cc] = 1\nimg\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom skimage.draw import rectangle\nimg = np.zeros((6, 6), dtype=np.uint8)\nstart = (3, 3)\nrr, cc = rectangle(start, extent=(2, 2))\nimg[rr, cc] = 1\nrr, cc = rectangle(start, extent=(-2, 2))\nimg[rr, cc] = 2\nrr, cc = rectangle(start, extent=(-2, -2))\nimg[rr, cc] = 3\nrr, cc = rectangle(start, extent=(2, -2))\nimg[rr, cc] = 4\nprint(img)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "start",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "end",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "extent",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "shape",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "rectangle"
  },
  "references": null,
  "qa": "skimage.draw.draw:rectangle",
  "arbitrary": [],
  "local_refs": [
    "coords",
    "end",
    "extent",
    "shape",
    "start"
  ]
}