Skip to main content

Microbe segmentation in dense colonies

Project description

MiSiC

Microbe segmentation in dense colonies.

Installation

Requires version python version 3.6/7

pip install misic

MiSiC as napari plugin

A napari plugin is up and running at the moment with a few glitches!

Here are the steps for installation:

  1. You can download napari at the bottom of the page at https://github.com/napari/napari/releases
  2. After you install napari, in the plugins tab > Install plugin > misic-napari
  3. Restart napari
  4. Drag and drop an image
  5. Go to segment More information is at https://pypi.org/project/misic-napari/

The plugin is still underdevelopment so there might be a few bugs that will be incrementally updated.

Usage

use package

from misic.misic import *
from misic.extras import *
from skimage.io import imsave,imread
from skimage.transform import resize,rescale

filename = 'awesome_image.tif'

# read image using your favorite package
im = imread(filename)
sr,sc = im.shape

# Parameters that need to be changed
## Ideally, use a single image to fine tune two parameters : mean_width and noise_variance (optional)

#input the approximate mean width of microbe under consideration
standard_width = 9.7

# the approximate width of cells to be segmented
mean_width = 9.7

# If image is phase contrast light_background = True
light_background = True

# compute scaling factor
scale = (standard_width/mean_width)

# Initialize MiSiC
mseg = MiSiC()

# preprocess using inbuit function or if you are feeling lucky use your own preprocessing
# recomended preprcessing
# im = adjust_gamma(im,0.25)
# im = unsharp_mask(im,2.2,0.6)

# for fluorescence images
# im = gaussian(laplace(im),2.2)
# im = add_noise(im,0.1)
# OR
# im = random_noise(im,mode = 'gaussian',var = 0.1/100.0)

im = rescale(im,scale,preserve_range = True)

# add local noise
img = add_noise(im,sensitivity = 0.13,invert = light_background)

# segment
yp = mseg.segment(img,invert = light_background)
yp = resize(yp,(sr,sc))

# watershed based post processing (optional)
# yp = postprocess_ws(img,yp)
yp = postprocessing(im if light_background else -im,yp)[:,:,0]  

# save 8-bit segmented image and use it as you like
imsave('segmented.tif', ((yp > 0)*255).astype(np.uint8))
''''

### In case of gpu error, one might need to disabple gpu before importing MiSiC [ os.environ["CUDA_VISIBLE_DEVICES"]="-1" ]

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

misic-1.1.3.tar.gz (6.8 MB view details)

Uploaded Source

Built Distribution

misic-1.1.3-py3-none-any.whl (6.8 MB view details)

Uploaded Python 3

File details

Details for the file misic-1.1.3.tar.gz.

File metadata

  • Download URL: misic-1.1.3.tar.gz
  • Upload date:
  • Size: 6.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for misic-1.1.3.tar.gz
Algorithm Hash digest
SHA256 114ab6ce4c43799b211be0513b06505ed57c8c00e3ef3b321535061c68654325
MD5 5472a5057a9b097e603abeeb48bbcb92
BLAKE2b-256 554d8114ae4d08facd722f189cfdb43930c8efb919f14ef71a7e353dc21b0862

See more details on using hashes here.

File details

Details for the file misic-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: misic-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for misic-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c488e21194a129e700635dba343b034e012010b094ee3d7edb22bf36f090172
MD5 7715dfdc52f0cf6f552243dd26de75c6
BLAKE2b-256 37008fce43140c843c9299239f02fd881cf2cfbcb6a4a19fe54bdf5c9e8b3f69

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