{ "info": { "author": "William Meng", "author_email": "wlmeng11@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# rtl_ultrasound\n-----\nTODO: logo next to title\n\nTODO: get badges\n\n* build passing (Travis)\n* build passing (appveyor)\n* coverage x% (coveralls.io)\n* docs passing (readthedocs.io)\n* code quality (codacy)\n* PyPI (badge.fury.io)\n* license\n* gitter.im\n* DOI (zenodo)\n\n\n\n## Latest results\n\nSee the [Aug 21, 2018 writeup](experiments/20180821/README.md) for more details.\n\n_Piezoelectric transducer is swept by servo motor_\n![gif](experiments/20180821/DSCN7889.gif)\n\n_Hardware setup with [SimpleRick v1.1](https://github.com/wlmeng11/SimpleRick/), 12.5 MHz low pass filter, and RTL-SDR_\n![setup](experiments/20180821/DSCN7892.JPG)\n\n![summary](experiments/20180821/ControlAnd2Weights.png)\n\n## Introduction\n\n### Why SDR?\nThe analog signal produced by a B-mode ultrasound (ie. 2D imaging)\nis essentially an Amplitude Modulated (AM) signal. The signal's envelope (ie. amplitude) corresponds to boundary information in the physical media, and the signal's carrier frequency is equal to the resonant frequency of the transducer.\n\nMost ultrasound systems take one of two approaches for data acquistion:\n\n1. **Direct sampling of the ultrasound signal:**\nThis method preserves the original signal in the time domain , accomadates any transducer frequency, and offers the best flexibility for post-processing and analysis. Both amplitude and phase information can be extracted the signal, so it is useful for both B-mode and Doppler mode imaging.\nHowever, this method requires a high sample rate ADC, as well as high bandwidth and storage for the digital data. \n2. **Envelope detection with analog hardware:** Perform Amplitude Demodulation (typically with a diode-based rectifier and low pass filter) to yield an envelope signal, then acquire the envelope signal at a lower sample rate.\nThis method reduces the bandwidth and storage requirements for the digital data, but there are a number of drawbacks: \n\t* Unless the low pass filter is adjustable, this method cannot accommodate different transducer frequencies.\n\t* The non-linearity of the diode may produce harmonic distortion.\n\t* All phase information in the signal is lost, rendering it useless for Doppler mode imaging.\n\nIt has been [demonstrated by Peyton et al](https://biomedical-engineering-online.biomedcentral.com/articles/10.1186/s12938-018-0512-6) that quadrature sampling can be used to reduce bandwidth requirements in an ultrasound imaging system.\n\nIt turns out that quadrature modulation is essential to Software Defined Radio (SDR) because any type of amplitude modulation, frequency modulation, phase modulation, or combination of these can be expressed as a special case of quadrature modulation. Therefore, many of the software and hardware techniques used in SDR can be applied to ultrasound imaging.\n\n\n### Why RTL-SDR?\nThe RTL2832U chip in the RTL-SDR takes a hybrid approach for data acquisition. It employs a high sample rate ADC (28.8 Msps), followed by a software-configurable Digital Down Converter (DDC) that produces IQ data at a lower sample rate (up to 2.56 Msps), thus reducing bandwidth and storage requirements. We can then perform envelope detection *in software*.\n\nPlus, the RTL-SDR is really cheap (under $25 on Amazon in the United States)!\nAs such, there is a lot of software support and a large community for the RTL-SDR.\n\nWith a few software tweaks, it should be possible to substitute the RTL-SDR with a more expensive SDR (eg. AirSpy HF+, LimeSDR) for use cases that require better ADC resolution and SNR.\n\nTODO: total system cost\n\n## Installation\n### System Dependencies\nInstall the system dependencies:\n\n* Python 3 with pip\n* librtlsdr\n\n#### Mac OSX\n`brew install python3 librtlsdr`\n\n*Warning*: If you previously installed software that bundles an out-of-date version of librtlsdr,\nyou may have to remove it, or overwrite the symlinks for librtlsdr: `brew link --overwrite librtlsdr`\n\n### Automatic installation\nInstall rtl_ultrasound: \n`pip3 install rtl_ultrasound`\n\n### Manual installation\nClone the development repo: \n`git clone git@github.com:wlmeng11/rtl_ultrasound.git`\n\nInstall the python package dependencies: \n`pip3 install -r requirements.txt`\n\nRun the install script: \n`pip3 install .`\n\n## Usage\n### Hardware Setup\nThis software is designed to be used with the [RTL-SDR v3](https://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/)\nin conjunction with the [SimpleRick](https://github.com/wlmeng11/SimpleRick) hardware.\n\nTODO: block diagram\n\nHowever, this software can be also used with any ultrasound hardware which\nprovides an analog signal output that can be fed to the input of the RTL-SDR.\n\n### Capturing images\nTo capture approximately 1 second of data from the RTL-SDR and save it to a .npz file, run: \n`rtl_to_npz -v -n 5120000`\n\nNext, generate an image from the .npz file: \n`B_mode -v --data (data file name).npz`\n\nIn the future, this process will be streamlined into a single script and possibly a GUI.\n\n## Documentation\nA fairly comprehensive overview of the entire process from data acquisition to rendered image\ncan be found in the [Aug 13, 2018 experiment](experiments/20180813/rtl_ultrasound_test.ipynb).\n\nEssentially, it boils down to these steps:\n\n* acquire IQ samples from RTL-SDR\n* upsample\n* extract envelope\n* split signal into scan lines\n* stack scan lines into image\n* perform polar to cartesian image transformation\n\nTODO: these steps will be parallelized with multithreading in order to\nprovide a fast image update rate with pipelining\n\n## DISCLAIMER\nThis software is NOT meant to be used for any medical or diagnostic purposes.\n\nAbsolutely no warranty is provided, express or implied.\n\n## License\nThe software contained in this repository makes use of the pyrtlsdr module, and is therefore a derivative work of pyrtlsdr. As such, this work respects the GPL v3 license of pyrtlsdr and is similarly distributed under GPL v3.\n\nThe full text of the license can be found in the [COPYING](COPYING) file.\n\n[pyrtlsdr](https://github.com/roger-/pyrtlsdr) is Copyright (C) 2013 by Roger https://github.com/roger-\n\n[rtl_ultrasound](https://github.com/wlmeng11/rtl_ultrasound/) is Copyright (C) 2018 William Meng\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wlmeng11/rtl_ultrasound", "keywords": "", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "rtl-ultrasound", "package_url": "https://pypi.org/project/rtl-ultrasound/", "platform": "", "project_url": "https://pypi.org/project/rtl-ultrasound/", "project_urls": { "Homepage": "https://github.com/wlmeng11/rtl_ultrasound" }, "release_url": "https://pypi.org/project/rtl-ultrasound/0.1.0/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "Ultrasound imaging with RTL-SDR", "version": "0.1.0" }, "last_serial": 4217382, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "32adce5b144225114ec586a7054a0aca", "sha256": "62d2ff1d893ae9a9226158fb2b92673a9ade454dde2591af06e609d498b9650a" }, "downloads": -1, "filename": "rtl_ultrasound-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "32adce5b144225114ec586a7054a0aca", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 10978, "upload_time": "2018-08-29T03:18:12", "url": "https://files.pythonhosted.org/packages/db/b0/40f7e81e0303eb0e4a0ebd7184e2bf2d2b58f9877309cf68e6c635ef0301/rtl_ultrasound-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a82a90d4a745d58d82029df925314ca", "sha256": "b7e18e909668b92ed56fe20f5954bb6ab623789eef239f7ed69e77525cf03d6f" }, "downloads": -1, "filename": "rtl_ultrasound-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4a82a90d4a745d58d82029df925314ca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 10242, "upload_time": "2018-08-29T03:18:14", "url": "https://files.pythonhosted.org/packages/64/75/953c2976547c053bbbe8b40216d96c618b2a5c0ca762f6903e72c6023202/rtl_ultrasound-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "32adce5b144225114ec586a7054a0aca", "sha256": "62d2ff1d893ae9a9226158fb2b92673a9ade454dde2591af06e609d498b9650a" }, "downloads": -1, "filename": "rtl_ultrasound-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "32adce5b144225114ec586a7054a0aca", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 10978, "upload_time": "2018-08-29T03:18:12", "url": "https://files.pythonhosted.org/packages/db/b0/40f7e81e0303eb0e4a0ebd7184e2bf2d2b58f9877309cf68e6c635ef0301/rtl_ultrasound-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a82a90d4a745d58d82029df925314ca", "sha256": "b7e18e909668b92ed56fe20f5954bb6ab623789eef239f7ed69e77525cf03d6f" }, "downloads": -1, "filename": "rtl_ultrasound-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4a82a90d4a745d58d82029df925314ca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 10242, "upload_time": "2018-08-29T03:18:14", "url": "https://files.pythonhosted.org/packages/64/75/953c2976547c053bbbe8b40216d96c618b2a5c0ca762f6903e72c6023202/rtl_ultrasound-0.1.0.tar.gz" } ] }