Metadata-Version: 2.5
Name: imagin
Version: 3.0.0
Summary: Interactive viewer and analyzer for streamed images
Project-URL: Homepage, https://github.com/ASukhanov/imagin
Project-URL: Bug Tracker, https://github.com/ASukhanov/imagin
Author-email: Andrey Sukhanov <sukhanov@bnl.gov>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Requires-Dist: numpy<2
Requires-Dist: pillow>=8
Requires-Dist: pyqt5>=5.15
Requires-Dist: pyqtgraph>=0.14
Requires-Dist: scipy>=1.11.4
Provides-Extra: all
Requires-Dist: caproto; extra == 'all'
Requires-Dist: opencv-python; extra == 'all'
Requires-Dist: p4p; extra == 'all'
Requires-Dist: requests>=2; extra == 'all'
Provides-Extra: epics
Requires-Dist: caproto; extra == 'epics'
Provides-Extra: http
Requires-Dist: requests>=2; extra == 'http'
Provides-Extra: pva
Requires-Dist: p4p; extra == 'pva'
Provides-Extra: usb
Requires-Dist: opencv-python; extra == 'usb'
Description-Content-Type: text/markdown

# Imagin.

Imagin is fast interactive viewer and analyzer for streamed images and image files, built with Python, pyqtgraph, and SciPy.

## Installation

Install the core application with file-based image support:

```bash
pip install imagin
```
## Features

- Input sources:
  - EPICS PVAccess and Channel Access
  - file system
  - HTTP image URLs
  - USB cameras
  
- PNG is the default image format; other formats are also supported.
- Fast, robust characterization of multiple objects using fitted ellipsoids.
- Supports images with 16-bit or higher channel depth.
- Image orientation control and arbitrary rotation.
- Interactive zooming and panning.
- Contrast and color-map control.
- Region of interest (ROI) selection for image analysis.
- ROI partitioning.
- ROI projection plots.
- Optional Gaussian fitting in 1D or 2D for improved precision.
- De-speckling.
- Automatic background elimination using prominence filtering (de-base).
- Background subtraction using reference images.
- Interactive calibration from pixels to millimeters.
- Reference image slots for saving and restoring images.
- Extensible through user-supplied add-ons.
- Fast browsing and cleanup of image directories.

![Imagin screenshot](docs/imagin_screenshot.png)

[Presentation](https://proceedings.jacow.org/icalepcs2019/papers/tucpr06.pdf)

## Examples

```bash
python -m imagin -b http https://cdn.esahubble.org/archives/images/large/heic1523b.jpg -t 100
python -m imagin -b file sample_images/*.jpg -t 100 -m 40
python -m imagin -b file ~/Pictures/*.png
```
### Testing with EPICS PVAccess image simulator epicsdev.imagegen:
```bash
pip install epicsdev
python -m epicsdev.imagegen -c&
python -m imagin -t 100 image0:image -b pva -m9
```

Animate by changing image parameters from a python script:
```python
import time, numpy as np
from p4p.client.thread import Context
iface = Context('pva')

oneTo0 = 1 - np.linspace(0,1,11)
scales = np.append(oneTo0[:-1], np.flip(oneTo0)[2:])
for scale in scales:
    iface.put('image0:gridScaleX',scale)
    time.sleep(.1)
```
### Testing with EPICS Channel Access
The simulated EPICS camera can be run from Docker:

https://hub.docker.com/r/klauer/simioc-docker

```bash
python3 setup_SimDetector.py
python3 -m imagin -b epics sim:det -m 16 -t 80
```
