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:
2020.5.1
Requirements
Tifffile 2020.2.16 (optional)
Matplotlib 3.1 (optional)
Revisions
- 2020.5.1
Split positions from counters.
- 2020.2.12
Initial release.
Notes
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 bytes 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
Hashes for roifile-2020.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab875991a73b313b2505634904b245e0c1bf8d917c0cf896d5a9dd05a5dabf71 |
|
MD5 | d2bc3436bfbc0766cce62b7843603f44 |
|
BLAKE2b-256 | 69017858ae05b231aabf228626206f0764a7fd6c4156a67204360262450e1c8b |