Read and write ImageJ ROI format
Project description
Roifile is a Python library to read, write, create, and plot ImageJ ROIs, an undocumented and ImageJ application specific format to store regions of interest, geometric shapes, paths, text, and whatnot for image overlays.
- Author:
- Organization:
Laboratory for Fluorescence Dynamics, University of California, Irvine
- License:
BSD 3-Clause
- Version:
2021.6.6
Requirements
This release has been tested with the following requirements and dependencies (other versions may work):
Tifffile 2021.4.8 (optional)
Matplotlib 3.4.2 (optional)
Revisions
- 2021.6.6
Add enums for point types and sizes.
- 2020.11.28
Support group attribute. Add roiread and roiwrite functions (#3). Use UUID as default name of ROI in ImagejRoi.frompoints (#2).
- 2020.8.13
Support writing to ZIP file. Support os.PathLike file names.
- 2020.5.28
Fix int32 to hex color conversion. Fix coordinates of closing path. Fix reading TIFF files with no overlays.
- 2020.5.1
Split positions from counters.
- 2020.2.12
Initial release.
Notes
The ImageJ ROI format cannot store integer coordinate values outside the range of -32768 to 32767 (16-bit signed).
Other Python packages handling ImageJ ROIs:
Examples
Create a new ImagejRoi instance from an array of x, y coordinates:
>>> roi = ImagejRoi.frompoints([[1.1, 2.2], [3.3, 4.4], [5.4, 6.6]])
>>> roi.coordinates()
array([[1.1, 2.2],
[3.3, 4.4],
[5.4, 6.6]], dtype=float32)
>>> roi.left, roi.left, roi.right, roi.bottom
(1, 1, 5, 6)
Export the instance to an ImageJ ROI formatted byte string or file:
>>> out = roi.tobytes()
>>> out[:4]
b'Iout'
>>> roi.tofile('_test.roi')
Read the ImageJ ROI from the file:
>>> roi2 = ImagejRoi.fromfile('_test.roi')
>>> roi2 == roi
True
Plot the ROI using matplotlib:
>>> roi.plot()
To view the overlays stored in a ROI, ZIP, or TIFF file from a command line, run python -m roifile _test.roi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roifile-2021.6.6.tar.gz.
File metadata
- Download URL: roifile-2021.6.6.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4302510df818f0f857b4cd87037c2d1ed8f53ec2e6d9a7beae1750a70a435042
|
|
| MD5 |
cd47dcf5f1e943d6b716307e0942992d
|
|
| BLAKE2b-256 |
b0d937b87a228664a573b50f8cc945628f4718794d538fb70eebc8c44613bd67
|
File details
Details for the file roifile-2021.6.6-py3-none-any.whl.
File metadata
- Download URL: roifile-2021.6.6-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c8878d63b660aaa80176b19d3fb451f6c403802e916e93fd1be171a0d402c3
|
|
| MD5 |
59a9fd401d958cafeb8d740759eea6df
|
|
| BLAKE2b-256 |
8767fc55adb049a2697fbcd4b9091ab11f4dba28bb8ce94a1445782e0813e448
|