[](https://pyidi.readthedocs.io/en/latest/?badge=latest)

# pyidi
Image-based Displacement Identification (IDI) implementation in python.
See the [documentation](https://pyidi.readthedocs.io/en/latest/index.html) for `pyIDI`.
## Now version 1.0!
In version 1.0, **we overhauled the package API**. With growing usage in IDEs other than
jupyter notebooks, we have made the package more user-friendly. The new API allows the
autocompletion and documentation of the package to be more accessible in IDEs like
VSCode, Cursor, PyCharm, etc.
To install the new version, use the following command:
```bash
pip install pyidi
```
or to upgrade (if already installed):
```bash
pip install -U pyidi
```
### Whats different?
For the user, the main difference is that instead of calling the `pyIDI` class where the
method is set, first, the `VideoReader` class is called. Then, this instance is passed
to the specific method class. Here is an example:
```python
from pyidi import VideoReader, SimplifiedOpticalFlow
# Read the video
video = VideoReader('video.cih')
# Pass the video to the selected method class
sof = SimplifiedOpticalFlow(video)
sof.set_points(points=[[0, 1], [1, 1], [2, 1]])
sof.configure(...)
displacements = sof.get_displacements()
```
The methods themselves have not changed, only the way they are called. Unfortunately, this
breaks the backward compatibility with the previous version. We apologize for any
inconvenience this may cause. To keep using the old version, please install the package
with the following command:
```bash
pip install pyidi==0.30.2
```
or use the legacy `pyIDI` class:
```python
from pyidi import pyIDI
```
Note that the legacy `pyIDI` class does not necessarily offer the full functionality of the new version.
The legacy `pyIDI` class is only kept for compatibility with the old version and will not be updated.
# Use Napari UI for quick displacement identification:
<img src="docs/source/quick_start/gifs/napari_full_sof.gif" width="800" />
# BASIC USAGE:
Run GUI by instantiating GUI class (input is VideoReader object):
```python
from pyidi import VideoReader, GUI
# Read the video
video = VideoReader('data/data_synthetic.cih')
# Run GUI
gui = GUI(video)
```
Method class (e.g. `SimplifiedOpticalFlow`) is instantiated during the use of GUI. It is accessible in `gui.method`. To get displacements:
```python
method = gui.method
displacements = method.displacements
```
The `pyIDI` method works with various formats: `.cih`, `.cihx`, `.png`, `.avi` etc. Additionally, it can also work with `numpy.ndarray` as input.
If an array is passed, it must have a shape of: ``(n time points, image height, image width)``.
Set the points where displacements will be determined:
```
p = np.array([[0, 1], [1, 1], [2, 1]]) # example of points
video.set_points(points=p)
```
Or use point selection UI to set individual points or grid inside selected area. For more information about UI see [documentation](https://pyidi.readthedocs.io/en/quick_start/napari.html). Launch viewer with:
# DEVELOPER GUIDELINES:
* Add _name_of_method.py with class that inherits after `IDIMethods`
* This class must have methods:
* `calculate_displacements` with attribute `displacements`
* `get_points` (static method - sets attribute video.points)
* In `pyIDI` add a new method of identification in `avaliable_methods` dictionary.
# Citing
If you are using the `pyIDI` package for your research, consider citing our articles:
- Masmeijer, T., Habtour, E., Zaletelj, K., & Slavič, J. (2024). **Directional DIC method with automatic feature selection**. Mechanical Systems and Signal Processing, 224 . https://doi.org/10.1016/j.ymssp.2024.112080
- Čufar, K., Slavič, J., & Boltežar, M. (2024). **Mode-shape magnification in high-speed camera measurements**. Mechanical Systems and Signal Processing, 213, 111336. https://doi.org/10.1016/J.YMSSP.2024.111336
- Zaletelj, K., Gorjup, D., Slavič, J., & Boltežar, M. (2023). **Multi-level curvature-based parametrization and model updating using a 3D full-field response**. Mechanical Systems and Signal Processing, 187, 109927. https://doi.org/10.1016/j.ymssp.2022.109927
- Zaletelj, K., Slavič, J., & Boltežar, M. (2022). **Full-field DIC-based model updating for localized parameter identification**. Mechanical Systems and Signal Processing, 164. https://doi.org/10.1016/j.ymssp.2021.108287
- Gorjup, D., Slavič, J., & Boltežar, M. (2019). **Frequency domain triangulation for full-field 3D operating-deflection-shape identification**. Mechanical Systems and Signal Processing, 133. https://doi.org/10.1016/j.ymssp.2019.106287
[](https://doi.org/10.5281/zenodo.4017153)
[](https://travis-ci.com/ladisk/pyidi)
Raw data
{
"_id": null,
"home_page": null,
"name": "pyidi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "\"Klemen Zaletelj, Domen Gorjup, Janko Slavi\u010d et al.\" <janko.slavic@fs.uni-lj.si>",
"keywords": "computer vision, dic, displacement identification, gradient-based",
"author": null,
"author_email": "\"Klemen Zaletelj, Domen Gorjup, Janko Slavi\u010d et al.\" <janko.slavic@fs.uni-lj.si>",
"download_url": "https://files.pythonhosted.org/packages/b5/0a/5080cb90248b2442748f6710bd8340c46b77d916d094d948f5b263bafe75/pyidi-1.0.0.tar.gz",
"platform": null,
"description": "[](https://pyidi.readthedocs.io/en/latest/?badge=latest)\n\n\n# pyidi\nImage-based Displacement Identification (IDI) implementation in python.\n\nSee the [documentation](https://pyidi.readthedocs.io/en/latest/index.html) for `pyIDI`.\n\n## Now version 1.0!\n\nIn version 1.0, **we overhauled the package API**. With growing usage in IDEs other than\njupyter notebooks, we have made the package more user-friendly. The new API allows the\nautocompletion and documentation of the package to be more accessible in IDEs like\nVSCode, Cursor, PyCharm, etc.\n\nTo install the new version, use the following command:\n\n```bash\npip install pyidi\n```\nor to upgrade (if already installed):\n```bash\npip install -U pyidi\n```\n\n### Whats different?\n\nFor the user, the main difference is that instead of calling the `pyIDI` class where the\nmethod is set, first, the `VideoReader` class is called. Then, this instance is passed\nto the specific method class. Here is an example:\n\n```python\nfrom pyidi import VideoReader, SimplifiedOpticalFlow\n\n# Read the video\nvideo = VideoReader('video.cih')\n\n# Pass the video to the selected method class\nsof = SimplifiedOpticalFlow(video)\n\nsof.set_points(points=[[0, 1], [1, 1], [2, 1]])\nsof.configure(...)\ndisplacements = sof.get_displacements()\n```\n\nThe methods themselves have not changed, only the way they are called. Unfortunately, this\nbreaks the backward compatibility with the previous version. We apologize for any\ninconvenience this may cause. To keep using the old version, please install the package\nwith the following command:\n\n```bash\npip install pyidi==0.30.2\n```\n\nor use the legacy `pyIDI` class:\n\n```python\nfrom pyidi import pyIDI\n```\n\nNote that the legacy `pyIDI` class does not necessarily offer the full functionality of the new version. \nThe legacy `pyIDI` class is only kept for compatibility with the old version and will not be updated.\n\n\n# Use Napari UI for quick displacement identification:\n<img src=\"docs/source/quick_start/gifs/napari_full_sof.gif\" width=\"800\" />\n\n\n# BASIC USAGE:\nRun GUI by instantiating GUI class (input is VideoReader object):\n```python\nfrom pyidi import VideoReader, GUI\n\n# Read the video\nvideo = VideoReader('data/data_synthetic.cih')\n\n# Run GUI\ngui = GUI(video)\n```\n\nMethod class (e.g. `SimplifiedOpticalFlow`) is instantiated during the use of GUI. It is accessible in `gui.method`. To get displacements:\n\n```python\nmethod = gui.method\ndisplacements = method.displacements\n```\n\nThe `pyIDI` method works with various formats: `.cih`, `.cihx`, `.png`, `.avi` etc. Additionally, it can also work with `numpy.ndarray` as input.\nIf an array is passed, it must have a shape of: ``(n time points, image height, image width)``.\n\nSet the points where displacements will be determined:\n```\np = np.array([[0, 1], [1, 1], [2, 1]]) # example of points\nvideo.set_points(points=p)\n```\nOr use point selection UI to set individual points or grid inside selected area. For more information about UI see [documentation](https://pyidi.readthedocs.io/en/quick_start/napari.html). Launch viewer with:\n\n\n# DEVELOPER GUIDELINES:\n* Add _name_of_method.py with class that inherits after `IDIMethods`\n* This class must have methods:\n\t* `calculate_displacements` with attribute `displacements`\n\t* `get_points` (static method - sets attribute video.points)\n* In `pyIDI` add a new method of identification in `avaliable_methods` dictionary.\n\n# Citing\nIf you are using the `pyIDI` package for your research, consider citing our articles:\n- Masmeijer, T., Habtour, E., Zaletelj, K., & Slavi\u010d, J. (2024). **Directional DIC method with automatic feature selection**. Mechanical Systems and Signal Processing, 224 . https://doi.org/10.1016/j.ymssp.2024.112080\n- \u010cufar, K., Slavi\u010d, J., & Bolte\u017ear, M. (2024). **Mode-shape magnification in high-speed camera measurements**. Mechanical Systems and Signal Processing, 213, 111336. https://doi.org/10.1016/J.YMSSP.2024.111336\n- Zaletelj, K., Gorjup, D., Slavi\u010d, J., & Bolte\u017ear, M. (2023). **Multi-level curvature-based parametrization and model updating using a 3D full-field response**. Mechanical Systems and Signal Processing, 187, 109927. https://doi.org/10.1016/j.ymssp.2022.109927\n- Zaletelj, K., Slavi\u010d, J., & Bolte\u017ear, M. (2022). **Full-field DIC-based model updating for localized parameter identification**. Mechanical Systems and Signal Processing, 164. https://doi.org/10.1016/j.ymssp.2021.108287\n- Gorjup, D., Slavi\u010d, J., & Bolte\u017ear, M. (2019). **Frequency domain triangulation for full-field 3D operating-deflection-shape identification**. Mechanical Systems and Signal Processing, 133. https://doi.org/10.1016/j.ymssp.2019.106287\n\n[](https://doi.org/10.5281/zenodo.4017153)\n[](https://travis-ci.com/ladisk/pyidi)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Python Image Displacement Identification.",
"version": "1.0.0",
"project_urls": {
"documentation": "https://pyidi.readthedocs.io/en/latest/",
"homepage": "https://github.com/ladisk/pyidi",
"source": "https://github.com/ladisk/pyidi"
},
"split_keywords": [
"computer vision",
" dic",
" displacement identification",
" gradient-based"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "857b3d696d7bf75fc910d8f105ceca31f43d39708cb46ed3c199bbf0e68eeb0c",
"md5": "4b5dd79c713bf6854a3cc14a68c61acd",
"sha256": "9a35d259fa20cb5ddb759a0647b6c64594161baf741a8595fd237e93483d6b1c"
},
"downloads": -1,
"filename": "pyidi-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4b5dd79c713bf6854a3cc14a68c61acd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 62753,
"upload_time": "2025-02-03T09:36:22",
"upload_time_iso_8601": "2025-02-03T09:36:22.860034Z",
"url": "https://files.pythonhosted.org/packages/85/7b/3d696d7bf75fc910d8f105ceca31f43d39708cb46ed3c199bbf0e68eeb0c/pyidi-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b50a5080cb90248b2442748f6710bd8340c46b77d916d094d948f5b263bafe75",
"md5": "f5a0ab8568e48e9bd4599ec5a0ee7019",
"sha256": "4c048995af5657d95426424cd9ae981b3786c6b20759611ff899bff2fa7abd68"
},
"downloads": -1,
"filename": "pyidi-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f5a0ab8568e48e9bd4599ec5a0ee7019",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 44106,
"upload_time": "2025-02-03T09:36:24",
"upload_time_iso_8601": "2025-02-03T09:36:24.505685Z",
"url": "https://files.pythonhosted.org/packages/b5/0a/5080cb90248b2442748f6710bd8340c46b77d916d094d948f5b263bafe75/pyidi-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-03 09:36:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ladisk",
"github_project": "pyidi",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "matplotlib",
"specs": [
[
">=",
"3.0.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.15.4"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "pyMRAW",
"specs": [
[
">=",
"0.30"
]
]
},
{
"name": "psutil",
"specs": []
},
{
"name": "tqdm",
"specs": []
},
{
"name": "numba",
"specs": []
},
{
"name": "napari",
"specs": []
},
{
"name": "magicgui",
"specs": []
},
{
"name": "imageio",
"specs": []
},
{
"name": "opencv-python",
"specs": []
},
{
"name": "sphinx",
"specs": []
},
{
"name": "twine",
"specs": []
},
{
"name": "build",
"specs": []
},
{
"name": "pytest",
"specs": []
},
{
"name": "sphinx-book-theme",
"specs": []
},
{
"name": "sphinx-copybutton",
"specs": []
},
{
"name": "nbsphinx",
"specs": []
},
{
"name": "nbsphinx_link",
"specs": []
},
{
"name": "rich",
"specs": []
},
{
"name": "qtpy",
"specs": []
}
],
"lcname": "pyidi"
}