Skip to main content

Python package for virus plaque analysis based on Plaque2.0

Project description

PyPlaque

Python package for virus plaque analysis based on Plaque2.0

Installation

See project's PyPi page https://pypi.org/project/PyPlaque/

pip install PyPlaque

Local devloper installation

  • Clone repo
  • run pip install -e .

Usage

from PyPlaque.specimen import PlaquesImageGray
from PyPlaque.phenotypes import Plaque

Here's a test example of how to analyze plaques in an image using PyPlaque. First let's load an example image:

from skimage.io import imsave, imread, imshow

img_url = 'https://raw.github.com/plaque2/matlab/master/Sample_B01_s1_w2.tif'
img = imread(img_url)
imshow(img)

image

Now let's detect plaques in this flourescence microscopy image and print out all their coordinmates:

plq_img = PlaquesImageGray('Sample_B01_s1_w2',img, threshold=0.25)
for plq in plq_img.get_plaques():
    print(plq.centroid)

This will output following measurements:

(435.85833333333335, 1785.8416666666667)
(653.1464788732394, 1209.9647887323943)
(708.058912386707, 1251.6835347432025)
(728.976492712741, 1599.9073812881993)
(712.3316195372751, 1312.491002570694)
(747.0576576576576, 1174.0234234234233)
(752.5772277227722, 1119.0891089108911)
(782.8965517241379, 1151.510344827586)

...

Each Plaque object containes a crop of individual virological plaque, as well as, measurements:

imshow(plq.mask)
print(plq.area)

image


Classes structure concept

Classes structure concept

Specific classes

Sepcimen


PlaquesMask class designed to hold binary mask of multiple plaque phenotypes.

Arguments:

name - (str, required) string, image sample name for identification

plaques_mask - (np.array, required) numpy array containing binary mask of all virological plaque objects.

get_palques method returns a list of individual plaques stored as binary numpy arrays.

Arguments:

min_are - (int, optional, default = 100) a cut-off value for plaque area in px.


PlaqueImageGray class designed to hold grayscale image data containing multiple plaque phenotypes with a respective binary mask. The class inherits from PlaquesMask.

Additonal arguments:

name - (str, required) string, image sample name for identification

image - (np.array, required) numpy array containing 2D grayscale image of a virological plaque object, respective to the mask. Used, in case of measuring properties of fluorescent plaque image.

plaques_mask - (np.array, optional, default None) numpy array containing binary mask of all virological plaque objects.

threshold - (float between 0 and 1, optional, default None) fixed threshold value for creating the binary mask.

sigma - (int, optional, default = 5) guassian blur sigma in pixels used by the fixed thresholding approach.

Either mask or fixed threshold must be provided


PlaquesImageRGB class designed to hold RGB image data containing multiple plaque phenotypes with a respective binary mask.The class inherits from PlaquesMask.

Additonal arguments:

name - (str, required) image sample name for identification

image - (np.array, required) 3D (red, green, blue) numpy array containing image of a virological plaque object, respective to the mask. Used, e.g. in case of measuring properties of crystal violet plaque image.

plaques_mask - (np.array, required) numpy array containing binary mask of all virological plaque objects.


Class PlaquesWell is aimed to contain a full well of a multititre plate.

Arguments:

row - (int or str, required) row id of the well.

column - (int or str, required) column id of the well.

well_image - (np.array, required) numpy array containing image of the well.

well_mask - (np.array, required) numpy array containing binary mask of the well.


PlateImage Class is aimed to contain a full multititre plate image and it's respective binary mask.

Arguments:

n_rows - (int, required) number of rows in the plate (usually lower than the number of rows).

n_columns - (int, required) number of columns in the plate (usually higher than the number of rows).

plate_image - (np.array, required) an image of individual wells of the plate.

plate_mask - (np.array, required) a binary mask outlining individual wells of the plate.

get_wells method returns a list of individual wells of the plate stored as binary numpy arrays.


Phenotypes


Plaque class is designed to hold a single virological plaque phenotype as an object.

Arguments:

mask - (required, 2D numpy array) containing binary mask of a single virological plaque object.

centroid - (float tuple, optional) contains x and y of the centroid of the plaque object

bbox - (float tuple, optional) contains minr, minc, maxr, maxc of the plaque object


FluorescencePlaque conains plaque obtained from fluorescence image. Class inherits from Plaque class and is also designed to hold a single virological plaque phenotype.

Additonal arguments:

image - (required) numpy array containing grayscale image of a single virological plaque object.


CrystalVioletPlaque plaque obtained from crystal violet image. Class inherits from Plaque class and is also designed to hold a single virological plaque phenotype.

Additonal arguments:

image - (required) numpy array containing RGB or a graysacle image of a single virological plaque object.

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

PyPlaque-0.1.0.tar.gz (22.0 kB view hashes)

Uploaded Source

Built Distribution

PyPlaque-0.1.0-py3-none-any.whl (23.6 kB view hashes)

Uploaded Python 3

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