Skip to main content

A package based on traditional segmentation algorithms used to segment a fly retina images.

Project description

CS410_FlyEM

This repository hosts the segmentation pipeline to segment fly retina images using traditional segmentation algorithms.

Authors

Package Installation

Install this python package by executing the following command.

  pip install flyem_segmentation_pipeline

If the above command throws any error, please run the following command and install the dependency packages individually.

pip install flyem_segmentation_pipeling --no-deps

Required Python packages

All the above-mentioned packages are required to use this package, but due to the version issues with numpy and mahotas, during installation only matplotlib and scikit-image are installed; numpy and mahotas has to be installed separately.

Package Description

Anyone can use this package to perform various computer vision algorithms to segment the fly retina images.

The package followed MVC(Model-View-Controller) design pattern.

All the functionalities can be used by importing them using the following command.

from segmentationMVC.controller import ImageController

Functions

ImageController.read(): reads an image from the given path.

ImageController.normalize(): returns an normalized image of the input image to [0, 255].

ImageController.center_crop(): crops an image to a default size of (512, 512).

ImageController.smooth(): smoothens the image using Gaussian filter.

ImageController.threshold(): applies thresholding of an input image.

ImageController.binary_mask(): creates an binary mask of the image.

ImageController.display(): display the image.

Sample Usage

The below sample code reads an image from the input path.

from segmentationMVC.controller import ImageController
image_data = ImageController.read("..")

Output:

input image

The below sample code normalized the input image.

from segmentationMVC.controller import ImageController
normalized_data = ImageController.normalize(image_data)

Output:

normalized image

The below sample code crops the input image.

from segmentationMVC.controller import ImageController
crop_data = ImageController.normalize(normalized_data)

Output:

crop image

The below sample code smoothens the input image.

from segmentationMVC.controller import ImageController
smoothed_data = ImageController.smooth(crop_data)

Output:

smoothens image

To get the complete segmented image, the following will serve as an example.

from segmentationMVC.controller import ImageController

image_data = ImageController.read("..")

normalized_data = ImageController.normalize(image_data)

crop_data = ImageController.normalize(normalized_data)

smoothed_data = ImageController.smooth(crop_data)

threshold_data = ImageController.threshold(smoothed_data, threshold_value=73)
labeled_data, nr_count = ImageController.label(threshold_data)
selected_labeled_data = ImageController.select_regions(labeled_data, region_size=1500)
binary_mask_data = ImageController.binary_mask(selected_labeled_data)
closed_binary_mask_data = ImageController.close_binary_mask(binary_mask_data)
segmented_image = ImageController.binary_image(closed_binary_mask_data)

The variable segmented_image in the above sample code stores the result of the segmented image.

Output:

output image

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

flyem_segmentation_pipeline-1.3.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file flyem_segmentation_pipeline-1.3.1.tar.gz.

File metadata

File hashes

Hashes for flyem_segmentation_pipeline-1.3.1.tar.gz
Algorithm Hash digest
SHA256 775a6d8664b313cd796755498202615e75085f627662bedd70889dad0e3497aa
MD5 9a45dcff5cf97a9d81f96eaed8552b13
BLAKE2b-256 899203dd51ceb1749f379436d7e9f4cb9e2d6015b10325eb92e11493a53bb2d7

See more details on using hashes here.

Supported by

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