{ "info": { "author": "Joerg Doepfert", "author_email": "joerg.doepfert@gmx.net", "bugtrack_url": null, "classifiers": [], "description": "[[file:https://travis-ci.org/jdoepfert/roipoly.py.svg?branch=master]]\n\n* roipoly.py\n\nSmall python module to select a polygonal region of interest (ROI) in\nan image that is stored as a numpy array. The usage is similar to the\n[[https://mathworks.com/help/images/ref/roipoly.html][roipoly]] \nfunction present in the image processing toolbox from MATLAB.\n\n[[file:/img/ROIs.PNG]]\n\n** Installation\nEither from PyPi: ~pip install roipoly~\n\nOr get the latest version from github: ~pip install git+https://github.com/jdoepfert/roipoly.py~\n\n** Running the examples\n\nBasic usage:\n#+begin_SRC shell\npython examples/basic_example.py\n#+end_SRC\n\nDrawing multiple ROIs:\n#+begin_SRC shell\npython examples/multi_roi_example.py\n#+end_SRC\n\n** Usage\n*** Creating a ROI\nIn your python code, import the roipoly module using\n#+begin_SRC python \nfrom roipoly import RoiPoly\n#+end_SRC\nTo draw a ROI within an image present as a numpy array, show it first\nusing e.g. pylabs's =imshow=:\n#+begin_SRC python \nfrom matplotlib import pyplot as plt\nplt.imshow(image)\n#+end_SRC\nThen let the user draw a polygonal ROI within that image:\n#+begin_SRC python \nmy_roi = RoiPoly(color='r') # draw new ROI in red color\n#+end_SRC\nThis lets the user interactively draw a polygon within the image by clicking\nwith the left mouse button to select the vertices of the polygon. To\nclose the polygon, click with the right mouse button. After finishing\nthe ROI, the current figure is closed so that the execution of the code\ncan continue. \n\n\n*** Displaying a ROI\nTo display a created ROI within an image, first display the image as\ndescribed above using e.g. =imshow=. Then, \n #+begin_SRC python \nmy_roi.display_roi()\n#+end_SRC\nshows the created ROI on top of this image. \n\nDisplay multiple ROIs like so:\n#+begin_SRC python \nfor r in [my_roi1, my_roi2, my_roi3]\n r.display_roi()\n#+end_SRC\n\nTo additionally show the mean pixel grey value inside a ROI in the\nimage, type\n#+begin_SRC python \nmy_roi.display_mean(image)\n#+end_SRC\n\n*** Extracting a binary mask image\nThe function =get_mask(image)= creates a binary mask for a certain ROI\ninstance, that is, a 2D numpy array of the size of the image array,\nwhose elements are =True= if they lie inside the ROI polygon,\nand =False= otherwise.\n#+begin_SRC python \nmask = my_roi.get_mask(image)\nplt.imshow(mask) # show the binary signal mask\n#+end_SRC\n\nThis mask image can be used to e.g. calculate the mean pixel intensity\nin an image over that ROI:\n#+begin_SRC python \nmean = plt.mean(image[mask])\n#+end_SRC\n\n*** Drawing multiple ROIs\nSee =examples/multi_roi_example.py=\n\n** Credits\nBased on a code snippet originally posted [[http://matplotlib.1069221.n5.nabble.com/How-to-draw-a-region-of-interest-td4972.html][here]] by Daniel Kornhauser.", "description_content_type": "text/plain", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jdoepfert/roipoly.py", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "roipoly", "package_url": "https://pypi.org/project/roipoly/", "platform": "", "project_url": "https://pypi.org/project/roipoly/", "project_urls": { "Homepage": "https://github.com/jdoepfert/roipoly.py" }, "release_url": "https://pypi.org/project/roipoly/0.5.2/", "requires_dist": null, "requires_python": ">=2.7", "summary": "Tool to draw regions of interest (ROIs)", "version": "0.5.2" }, "last_serial": 5902113, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "20733a99196109ed28bc322995a412b3", "sha256": "a54f82e43a446563493207b39b826109f941d0c99d3617f4445368811aceb18b" }, "downloads": -1, "filename": "roipoly-0.5.0.tar.gz", "has_sig": false, "md5_digest": "20733a99196109ed28bc322995a412b3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 9257, "upload_time": "2019-03-17T17:31:53", "url": "https://files.pythonhosted.org/packages/ad/ee/8127c25e74469c146d39ef3971ad59b37f627e842f6d4258a479e792969c/roipoly-0.5.0.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "e097ade217f5bd2763a56eb00153e51d", "sha256": "7a7273eaa28012baca2f4ef32c953a00d80b04685780e8953b386a7859e0e63d" }, "downloads": -1, "filename": "roipoly-0.5.2.tar.gz", "has_sig": false, "md5_digest": "e097ade217f5bd2763a56eb00153e51d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 9411, "upload_time": "2019-09-29T08:31:24", "url": "https://files.pythonhosted.org/packages/d8/62/4dec8ae6e40dff64a7872fb930a0004864770f919978615f1488f14ecf48/roipoly-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e097ade217f5bd2763a56eb00153e51d", "sha256": "7a7273eaa28012baca2f4ef32c953a00d80b04685780e8953b386a7859e0e63d" }, "downloads": -1, "filename": "roipoly-0.5.2.tar.gz", "has_sig": false, "md5_digest": "e097ade217f5bd2763a56eb00153e51d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 9411, "upload_time": "2019-09-29T08:31:24", "url": "https://files.pythonhosted.org/packages/d8/62/4dec8ae6e40dff64a7872fb930a0004864770f919978615f1488f14ecf48/roipoly-0.5.2.tar.gz" } ] }