Skip to main content

Viewer for Python IMage Sequence (PIMS).

Project description

# pimsviewer
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/pimsviewer/badges/version.svg)](https://anaconda.org/conda-forge/pimsviewer)

A graphical user interface (GUI) for PIMS (screenshot below)

This viewer was based on `skimage.viewer.CollectionViewer` ([docs](http://scikit-image.org/docs/dev/user_guide/viewer.html))
and is able to work with N-dimensional image files that are opened by PIMS.

Also, it exposes a matplotlib plotting area on which images can be (dynamically)
annotated, making use of the `Plugin` infrastructure.

## Installation

Pimsviewer can be installed using conda:

```
conda install -c conda-forge pimsviewer
```

Alternatively, it can also be installed using pip:

```
pip install pimsviewer
```

## Starting the viewer

After installing the viewer, an executable `pimsviewer` is available. Simply run the command via your terminal/command line interface.
It is also possible to specify a reader. `pimsviewer --help` will list all installed readers, for example:

```
$ pimsviewer --help
Usage: pimsviewer [OPTIONS] [FILE]

Options:
--reader-class [ImageSequenceND|NorpixSeq|SpeStack|TiffStack_pil|MoviePyReader|ImageReaderND|ReaderSequence|ImageIOReader|ImageSequence|TiffStack_tifffile|TiffSeries|TiffStack_libtiff|BioformatsReader|PyAVReaderTimed|PyAVReaderIndexed|MM_TiffStack|ImageReader|FramesSequenceND|Cine]
Reader with which to open the file.
--help Show this message and exit.
```

## Using the viewer from Python
You can use the viewer in a Python script as follows:

```
from pimsviewer import Viewer
viewer = Viewer()
viewer.show()
```
Optionally you may include a reader:

```
import pims
from pimsviewer import Viewer
viewer = Viewer(pims.open('path/to/file'))
viewer.show()
```

## Example: evaluating the effect of a processing function
This example adds a processing function that adds an adjustable amount of noise
to an image. The amount of noise is tunable with a slider, which is displayed
on the right of the image window.

```
import numpy as np
import pims
from pimsviewer import Viewer, ProcessPlugin, Slider

reader = pims.open('path/to/file')

def add_noise(img, noise_level):
return img + np.random.random(img.shape) * noise_level / 100 * img.max()

AddNoise = ProcessPlugin(add_noise, 'Add noise', dock='right')
AddNoise += Slider('noise_level', low=0, high=100, value=10,
orientation='vertical')
viewer = Viewer(reader) + AddNoise
viewer.show()
```

## Example: annotating features on a video
This example annotates features that were obtained via trackpy onto a video.

```
import trackpy as tp
from pimsviewer import Viewer, AnnotatePlugin
reader = pims.open('path/to/file')
f = tp.batch(reader, diameter=15)
(Viewer(reader) + AnnotatePlugin(f)).show()
```

## Example: selecting features on a video
This example annotates features on a video, allows to hide and move
features, and returns the adapted dataframe.

```
import trackpy as tp
from pimsviewer import Viewer, SelectionPlugin
reader = pims.open('path/to/file')
f = tp.batch(reader, diameter=15)
f = tp.link_df(f, search_range=10)
viewer = Viewer(reader) + SelectionPlugin(f)
f_result = viewer.show()
```

## Example: designing a custom plotting function
This dynamically shows the effect of `tp.locate`.

```
import trackpy as tp
from pimsviewer import Viewer, Slider, PlottingPlugin

def locate_and_plot(image, radius, minmass, separation, ax):
f = tp.locate(image, diameter=radius * 2 + 1, minmass=minmass,
separation=separation)
if len(f) == 0:
return
return ax.plot(f['x'], f['y'], markersize=15, markeredgewidth=2,
markerfacecolor='none', markeredgecolor='r',
marker='o', linestyle='none')

reader = pims.open('path/to/file')
Locate = PlottingPlugin(locate_and_plot, 'Locate', dock='right')
Locate += Slider('radius', 2, 20, 7, value_type='int', orientation='vertical')
Locate += Slider('separation', 1, 100, 7, value_type='float', orientation='vertical')
Locate += Slider('minmass', 1, 10000, 100, value_type='int', orientation='vertical')
viewer = Viewer(reader) + Locate
viewer.show()
```

## Screenshot

![Screenshot](/screenshot.png?raw=true)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pimsviewer-1.1.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

pimsviewer-1.1-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file pimsviewer-1.1.tar.gz.

File metadata

  • Download URL: pimsviewer-1.1.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pimsviewer-1.1.tar.gz
Algorithm Hash digest
SHA256 7f9f41ed1c4e54fbe531aeda412a5b5f96c198faff24149088b1402507aee6ff
MD5 4f2c1998fc62b9a1dcd8d367d74b10be
BLAKE2b-256 eba36383f0c4525cfb8e19267121213489d86bab69a38b08b93699d4d7ed0c4a

See more details on using hashes here.

File details

Details for the file pimsviewer-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pimsviewer-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 deae4b2ae29f302e02104f11b999c494d686d1d2b887e6650e8303028f79e998
MD5 7bdff7a90176c0a4a5994de3c74fd5af
BLAKE2b-256 970e3f3655d3ccdd90720cd5c201f4292fdc345758da55e1166a56b04a8adf95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page