# Tomni
[![Build Status](https://cytosmart.visualstudio.com/CytoSmartImageAnalysis/_apis/build/status/cytosmart-bv.tomni?branchName=main)](https://cytosmart.visualstudio.com/CytoSmartImageAnalysis/_build/latest?definitionId=384&branchName=main)
[![Downloads](https://pepy.tech/badge/tomni)](https://pepy.tech/project/tomni)
Tomni is a python package that contains a collection of helper functions based on OpenCV and NumPy. It can be used for any python based computer vision or image analysis problem. The package simplifies the code and takes care of edge cages, everything from simplifying code like img_dim to compute optimization like labels2contours or illumination correction image processing. Tomni uses the image coordinates (same as OpenCV).
Tomni is created by [CytoSMART](https://cytosmart.com).
The package was developed in-house to centralize the helper function for computer vision problems. In 2021, CytoSMART engineers turned it to open source, enabling researchers and educators to use it for free.
## Getting Tomni
```cmd
pip install tomni
```
## License
Tomni is free for academic and educational use.
For commercial use please contact [CytoSMART](https://cytosmart.com/contact).
## The name
The name Tomni is a combination of creator (Tom) and other CytoSMART product he was working on, [the Omni](https://cytosmart.com/products/omni). Tomni name was proposed by Denissa Daroţi, a former CytoSMART intern, who won a bet with her mentor by getting a (well deserved) 9/10 for her internship.
## Features
- Bounding box fitting (bbox fitting)
- Center bounding box fit
- Custom location box fit
- Image helpers
- Get image dimensions
- Convert color of an image
- Illumination correction
- Brightfield
- Fluorescence
- Contour operations
- Get center
- Approximate circle by area
- Get roundness
- Get circularity
- CytoSMART data format
- Tba
- Json operation
- Add circularity property
- Scale object
- Translate object
- Make a mask
- Ellipse
- Polygon
- Polygon downsampling
- iterative downsampling
- Shape fitting
- Rect around ellipse
- Transformers of data format
- Contours to json
- Ellipse to json
- Json 2 contours
- Json 2 label
- Json 2 bbox
- Labels 2 contours
- Labels 2 lists of points
- Binary 2 contours
## Examples
### Diameter vs radius
Most geometric operation use functions from OpenCV
Some of these function return diameter and some radius of the circle. This is not consistent.
For example, the function `cv2.minEnclosingCircle` returns the center and radius of the circle. The function `cv2.fitEllipse` returns the center and the major and minor axes of the ellipse.
#### Min enclosing circle example
```python
import cv2
import math
import numpy as np
points = np.array([[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]], dtype=np.float32)
center, radius = cv2.minEnclosingCircle(points)
diameter = math.sqrt(50**2 + 50**2)
print("Center:", center)
print("Major and Minor Axes:", radius)
print("Diameter calculated with Pythagoras formula", diameter)
```
this results in the following output:
```cmd
Center: (50.0, 50.0)
Major and Minor Axes: 70.71077728271484
Diameter calculated with Pythagoras formula 70.71067811865476
```
#### Fit ellipse example
```python
import cv2
import math
import numpy as np
# Generate some example points
points = np.array([[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]], dtype=np.float32)
# Fit an ellipse to the points
ellipse = cv2.fitEllipse(points)
# Extract ellipse parameters
center, axes, angle = ellipse
diameter = math.sqrt(50**2 + 50**2) * 2
print("Center:", center)
print("Major and Minor Axes:", axes)
print("Diameter calculated with Pythagoras formula", diameter)
```
this results in the following output:
```cmd
Center: (50.0, 49.95212173461914)
Major and Minor Axes: (141.43260192871094, 141.5462188720703)
Diameter: 141.4213562373095
```
Example is related to the following functions in the package
## Credits
Sorted alphabetically
- Bram van der Velden
- Coenraad Stijne
- Denisa Daroţi
- Hristo Atanasov
- Jan-Niklas Schneider
- Jelle van Kerkvoorde
- Kirsten Koopman
- Lisa Koolen
- Manon van Erp
- Marina Tzenkova
- Tom de Vries
- Tom Nijhof
Raw data
{
"_id": null,
"home_page": null,
"name": "tomni",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "checker, crlf, lf, line-ending",
"author": "Tom Nijhof, Jelle van Kerkvoorde",
"author_email": "Bram van der Velden <bram.vandervelden@axionbio.com>",
"download_url": "https://files.pythonhosted.org/packages/22/8f/e2f18f2b8b0073333f7ca8c2a19814582d60d1762213f2c2154108929a6d/tomni-2.2.1.tar.gz",
"platform": null,
"description": "# Tomni\n\n[![Build Status](https://cytosmart.visualstudio.com/CytoSmartImageAnalysis/_apis/build/status/cytosmart-bv.tomni?branchName=main)](https://cytosmart.visualstudio.com/CytoSmartImageAnalysis/_build/latest?definitionId=384&branchName=main)\n[![Downloads](https://pepy.tech/badge/tomni)](https://pepy.tech/project/tomni)\n\nTomni is a python package that contains a collection of helper functions based on OpenCV and NumPy. It can be used for any python based computer vision or image analysis problem. The package simplifies the code and takes care of edge cages, everything from simplifying code like img_dim to compute optimization like labels2contours or illumination correction image processing. Tomni uses the image coordinates (same as OpenCV).\n\nTomni is created by [CytoSMART](https://cytosmart.com).\n\nThe package was developed in-house to centralize the helper function for computer vision problems. In 2021, CytoSMART engineers turned it to open source, enabling researchers and educators to use it for free.\n\n## Getting Tomni\n\n```cmd\npip install tomni\n```\n\n## License\n\nTomni is free for academic and educational use.\n\nFor commercial use please contact [CytoSMART](https://cytosmart.com/contact).\n\n## The name\n\nThe name Tomni is a combination of creator (Tom) and other CytoSMART product he was working on, [the Omni](https://cytosmart.com/products/omni). Tomni name was proposed by Denissa Daro\u0163i, a former CytoSMART intern, who won a bet with her mentor by getting a (well deserved) 9/10 for her internship.\n\n## Features\n\n- Bounding box fitting (bbox fitting)\n - Center bounding box fit\n - Custom location box fit\n- Image helpers\n - Get image dimensions\n - Convert color of an image\n- Illumination correction\n - Brightfield\n - Fluorescence\n- Contour operations\n - Get center\n - Approximate circle by area\n - Get roundness\n - Get circularity\n- CytoSMART data format\n - Tba\n- Json operation\n - Add circularity property\n - Scale object\n - Translate object\n- Make a mask\n - Ellipse\n - Polygon\n- Polygon downsampling\n - iterative downsampling\n- Shape fitting\n - Rect around ellipse\n- Transformers of data format\n - Contours to json\n - Ellipse to json\n - Json 2 contours\n - Json 2 label\n - Json 2 bbox\n - Labels 2 contours\n - Labels 2 lists of points\n - Binary 2 contours\n\n\n## Examples\n\n### Diameter vs radius\nMost geometric operation use functions from OpenCV\n\nSome of these function return diameter and some radius of the circle. This is not consistent.\n\nFor example, the function `cv2.minEnclosingCircle` returns the center and radius of the circle. The function `cv2.fitEllipse` returns the center and the major and minor axes of the ellipse.\n\n#### Min enclosing circle example\n```python\nimport cv2\nimport math\nimport numpy as np\n\npoints = np.array([[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]], dtype=np.float32)\n\ncenter, radius = cv2.minEnclosingCircle(points)\ndiameter = math.sqrt(50**2 + 50**2) \n\nprint(\"Center:\", center)\nprint(\"Major and Minor Axes:\", radius)\nprint(\"Diameter calculated with Pythagoras formula\", diameter)\n\n```\n\nthis results in the following output:\n```cmd\nCenter: (50.0, 50.0)\nMajor and Minor Axes: 70.71077728271484\nDiameter calculated with Pythagoras formula 70.71067811865476\n```\n#### Fit ellipse example\n```python\nimport cv2\nimport math\nimport numpy as np\n\n# Generate some example points\npoints = np.array([[0, 0], [100, 0], [100, 100], [0, 100], [0, 0]], dtype=np.float32)\n\n# Fit an ellipse to the points\nellipse = cv2.fitEllipse(points)\n\n# Extract ellipse parameters\ncenter, axes, angle = ellipse\n\ndiameter = math.sqrt(50**2 + 50**2) * 2\n\nprint(\"Center:\", center)\nprint(\"Major and Minor Axes:\", axes)\nprint(\"Diameter calculated with Pythagoras formula\", diameter)\n```\n\nthis results in the following output:\n\n```cmd\nCenter: (50.0, 49.95212173461914)\nMajor and Minor Axes: (141.43260192871094, 141.5462188720703)\nDiameter: 141.4213562373095\n```\nExample is related to the following functions in the package\n\n\n## Credits\n\nSorted alphabetically\n\n- Bram van der Velden\n- Coenraad Stijne\n- Denisa Daro\u0163i\n- Hristo Atanasov\n- Jan-Niklas Schneider\n- Jelle van Kerkvoorde\n- Kirsten Koopman\n- Lisa Koolen\n- Manon van Erp\n- Marina Tzenkova\n- Tom de Vries\n- Tom Nijhof\n",
"bugtrack_url": null,
"license": "Apache License",
"summary": null,
"version": "2.2.1",
"project_urls": {
"Changelog": "https://github.com/cytosmart-bv/tomni/blob/main/HISTORY.rst",
"Documentation": "https://tomni.cytosmart.com/",
"Repository": "https://github.com/cytosmart-bv/tomni"
},
"split_keywords": [
"checker",
" crlf",
" lf",
" line-ending"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "27edc86e06c10e7fa9e14873c1ee238e26070dfc69589c69c5a58e66eddb286d",
"md5": "b845a9fa476fc9b4e60ad9b317967ba4",
"sha256": "6324777ec565287b596cdff04882fa033d0c7b96a5dcdf2c70f10717e3fbd6be"
},
"downloads": -1,
"filename": "tomni-2.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b845a9fa476fc9b4e60ad9b317967ba4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 131014,
"upload_time": "2024-07-24T08:57:26",
"upload_time_iso_8601": "2024-07-24T08:57:26.897903Z",
"url": "https://files.pythonhosted.org/packages/27/ed/c86e06c10e7fa9e14873c1ee238e26070dfc69589c69c5a58e66eddb286d/tomni-2.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "228fe2f18f2b8b0073333f7ca8c2a19814582d60d1762213f2c2154108929a6d",
"md5": "969814538af9150cce2256fafc80d357",
"sha256": "3dadca21c1ff658e4bb8ea686dfad2e26df06d71747afd12661d8f95e3a9081d"
},
"downloads": -1,
"filename": "tomni-2.2.1.tar.gz",
"has_sig": false,
"md5_digest": "969814538af9150cce2256fafc80d357",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 86872,
"upload_time": "2024-07-24T08:57:28",
"upload_time_iso_8601": "2024-07-24T08:57:28.985762Z",
"url": "https://files.pythonhosted.org/packages/22/8f/e2f18f2b8b0073333f7ca8c2a19814582d60d1762213f2c2154108929a6d/tomni-2.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-24 08:57:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cytosmart-bv",
"github_project": "tomni",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "tomni"
}