{"id":21457847,"url":"https://github.com/hlgirard/xptools","last_synced_at":"2025-10-07T11:32:22.310Z","repository":{"id":62590135,"uuid":"155417023","full_name":"hlgirard/xptools","owner":"hlgirard","description":"An experimentalist's toolbox to display images, detect particles, bubbles and crystals and analyze their shape, size and distibution.","archived":false,"fork":false,"pushed_at":"2019-03-20T14:47:46.000Z","size":19274,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T11:49:17.020Z","etag":null,"topics":["bubble","crystal","droplet","image-analysis","image-segmentation","video-processing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hlgirard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-30T16:12:40.000Z","updated_at":"2025-02-12T08:52:13.000Z","dependencies_parsed_at":"2022-11-03T17:57:03.022Z","dependency_job_id":null,"html_url":"https://github.com/hlgirard/xptools","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hlgirard/xptools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlgirard%2Fxptools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlgirard%2Fxptools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlgirard%2Fxptools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlgirard%2Fxptools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlgirard","download_url":"https://codeload.github.com/hlgirard/xptools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlgirard%2Fxptools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265385737,"owners_count":23756728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bubble","crystal","droplet","image-analysis","image-segmentation","video-processing"],"created_at":"2024-11-23T06:15:41.538Z","updated_at":"2025-10-07T11:32:17.269Z","avatar_url":"https://github.com/hlgirard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xptools\n\n[![PyPI version](https://badge.fury.io/py/xptools.svg)](https://badge.fury.io/py/xptools)\n\nAnalysis tools for experimental sciences to display images, detect particles (cells, bubbles, crystals), moving fronts and analyze their shape, size and distibution.\n\n## Installation\n\nxptools is on PyPI so you can install it straight from pip with the command\n\n```\npip install xptools\n```\n\nAlternatively, you can clone the repository to your local computer and install from source\n\n```\ngit clone https://github.com/hlgirard/xptools\ncd xptools\npip install .\n```\n\n## Scripts\n\n- analyze_front - This scipt takes a directory containing video files. For each file, it asks the user to select a region of interest\nand processes the selected area with a minimum threshold to find the largest area. It then plots the height of this area as\na function of time.\n\n```\nanalyze_front --plotly --scale 60 --framerate 30 moviedirectory/\n```\n\n![screenshot](docs/screenshots/analyze_front_ex-01.jpg)\n\n- analyze_bubbles - This script takes a movie (or directory of movies) showing bubbles on a surface (bright on dark). It uses a watershed segmentation algorithm to identify the bubbles and characterize their size. It then plots the bubble density and mean size as a function of time.\n\n```\nanalyze_bubbles --plotly --scale 60 bubble_movie.avi\n```\n\n![screenshot](docs/screenshots/analyze_bubbles_ex-01.jpg)\n\n- analyze_crystals - This script takes a directory containing pictures of droplets containing crystals (under cross polarization). It uses a thresholding algorithm to segment the crystals, count them and measure their size.\n\n```\nanalyze_crystals --plotly --key funct_key.txt imagedirectory/\n```\n\n![screenshot](docs/screenshots/analyze_crystals_ex-01.jpg)\n\n- display_image_matrix - Arranges all the images in a directory as a matrix and saves the resulting image\n\n```\ndisplay_image_matrix --lines 10 --compress imagedirectory/\n```\n\n## Utilities\n\nSeveral utilities are included in the submodule utils including:\n\n- select_roi:select_rectangle - Prompts the user to make a rectangular selection on the passed image and returns the coordinates of the selection.\n\n- videotools:open_video - Opens a video file as a list of np.arrays each containing one frame of the video.\n\n- videotools:determine_threshold - Determines the threshold to use for a video based on the minimum threshold algorithm.\n\n- videotools:obtain_cropping_boxes - Prompts the user to select the region of interest for each video file. Returns a dataframe containing the coordinates of the selected area for each file.\n\n- imagetools:open_all_images - Opens all the images in a folder and returns a list of cv2 images.\n\n### Example usage\n\n```python\nimport pandas as pd\nfrom xptools.utils import videotools\n\nvideo_list = ['Film1.avi','Film2.avi']\n\ndict_crop = videotools.obtain_cropping_boxes(video_list)\n\nfor key, val in dict_crop:\n    stack = videotools.open_video(key)\n    (minRow, minCol, maxRow, maxCol) = val\n    stack = [img[minRow:maxRow,minCol:maxCol] for img in stack]\n    process(stack)\n```\n\n## Notebooks\n\n- SegmentationBroadSpectrum.ipynb - Tests different image segmentation techniques to determine which is most appropriate\n- SegmentationFocused.ipynb - Implements a specific analysis and plots the resulting size and number distributions for the particles\n- Watershed_Segmentation.ipynb - Implements Watershed segmentation.\n\n## Credits\n\nCode for display_image_matrix adapted from https://gist.github.com/pgorczak/95230f53d3f140e4939c#file-imgmatrix-py\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlgirard%2Fxptools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlgirard%2Fxptools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlgirard%2Fxptools/lists"}