Doppler Segmentations
These codes make up the framework for segmenting the doppler ultrasound scans.
Table of Contents
Installation
- To install as a dependency for your project:
pip install usseg
or
poetry add usseg
Development Environment
To install the development environment follow the following steps.
- Clone this repository and change into the directory.
- Install poetry as per the installation instructions.
- Install tesseract as per the intallation instructions.
- Note that the project has only been tested with tesseract version 5.
- Install the package dependencies with:
poetry install
- Enter into the development shell with:
poetry shell
- You are now in the development environment!
- Copy
config_example.tomltoconfig.tomland change the variables for your local set up (e.g. path to your data etc.). - The main script can now be run in one complete run with
python usseg/main.py. - If debugging in vscode, ensure the python interpreter is set to the virtual environment created poetry. This path can be found using
poetry env info --path
Ultrasound Segmentation Package
The Ultrasound Segmentation Package facilitates two primary blocks of functionality: text extraction from images and ultrasound image segmentation. Each block consists of a sequence of functions designed to work independently yet contribute collectively to the overall process.
Text Extraction Process
- colour_extract_vectorized: Filters the image to highlight a specific target colour of pixel, preparing it for text extraction.
- Text_from_greyscale: Processes the filtered image to extract text, matching lines to specific target words.
- Metric_check: Performs a common-sense check on the extracted measurements using knowledge of their interdependencies and known physiological limits, ensuring data accuracy.
Image Segmentation Process
- Initial_segmentation: Begins with a coarse segmentation of the waveform.
- Define_end_ROIs: Defines regions adjacent to the coarse segmentation.
- Segment_refinement: Refines the segmentation within the coarse boundaries.
- Search_for_ticks: Identifies ticks in the axes ROIs for accurate scaling.
- Search_for_labels: Locates labels within the axes ROIs for data extraction.
- Plot_Digitized_data: Digitizes the extracted data to plot the waveform.
- Plot_correction: (Optional) Adjusts the time axis based on heart rate data.
- Annotate: Visualizes the segmentation steps on the original image.
Each function in these sequences plays a vital role in the overall process, which aims for accurate data extraction. For more in-depth information about each function, please refer to the detailed descriptions in the here section of this documentation.
Usage Examples
Some introduction to examples...
Processing a Single Image
For processing a single image, the data_from_image function is imported and provided with PIL and cv2 versions of the image. This could be done through the following code:
# Module imports
import numpy as np
from PIL import Image
# Local imports
from usseg import data_from_image
img_path = "Path/to/a/ultrasound/image.JPG"
PIL_image = Image.open(img_path)
cv2_image = np.array(PIL_image)
df, (xdata, ydata) = data_from_image(PIL_image, cv2_image)
Batch processing images
python usseg/main.py
Metadata
Release files for usseg 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| usseg-0.7.1.tar.gz | 49.0 kB | Without provenance | Details for usseg-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| usseg-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for usseg-0.7.1-py3-none-any.whl |
Total release size: 99.7 kB
Release files / usseg-0.7.1.tar.gz
| Download URL | usseg-0.7.1.tar.gz |
|---|---|
| Size | 49.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc092bd79a016d857e9f0e3b6d2fd6b21d41b329dbfc24c78b21cd876b087be4
|
|
BLAKE2b-256 checksum How to use checksums |
e3c80801c23c288bcc5b660e6b36709c8bf3a6bc2787d280cad6094ce6613d91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / usseg-0.7.1-py3-none-any.whl
| Download URL | usseg-0.7.1-py3-none-any.whl |
|---|---|
| Size | 50.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
112cd23305c66f2983e43b30a73efac7437aa39a558892676537459397c077ff
|
|
BLAKE2b-256 checksum How to use checksums |
dd4976cec2afc06dfe29f643af6ca8672e8cfff6ced42e9e4c6db7952928df8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for usseg 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.