Skip to main content

Function Usage Guide

This guide provides instructions on how to use two sets of image processing functions in Python. The first set focuses on cell segmentation, while the second set includes functions for denoising images and converting them to grayscale.

Cell Segmentation Functions

Required Libraries

  • os
  • numpy
  • skimage
  • sklearn
  • matplotlib

Functions:

  1. cell_segment(image_path, num_clusters=4): Segments cells in an image using K-means clustering.

    • image_path: Path to the input image file.
    • num_clusters: Number of clusters for K-means clustering (default is 4).
    • Returns: Segmented image array.
  2. img_save(segmented_image, save_path, image_path): Saves the segmented image to a specified location.

    • segmented_image: Segmented image array.
    • save_path: Path to the folder where the segmented image will be saved.
    • image_path: Path to the original image file.
  3. plot_img(segmented_image): Plots the segmented image.

    • segmented_image: Segmented image array.
  4. cell_folder(input_folder, output_folder, num_clusters=4): Segments cells in all images within a folder and saves the results.

    • input_folder: Path to the folder containing input images.
    • output_folder: Path to the folder where segmented images will be saved.
    • num_clusters: Number of clusters for K-means clustering (default is 4).

Image Denoising and Grayscale Conversion Functions

Required Libraries

  • numpy
  • matplotlib
  • skimage
  • PIL
  • os

Functions:

  1. denoise_images(input_folder, result_folder=None): Denoises images in a folder using Non-local Means Denoising.

    • input_folder: Path to the folder containing input images.
    • result_folder: Path to the folder where denoised images will be saved (optional).
  2. img_to_gray(input_folder, result_folder=None): Converts images to grayscale.

    • input_folder: Path to the folder containing input images.
    • result_folder: Path to the folder where grayscale images will be saved (optional).

Example Usage:

from cellmean import cell_segment, img_save, plot_img, cell_folder, denoise_images, img_to_gray

# Cell Segmentation
segmented_image = cell_segment('input_image.jpg')
plot_img(segmented_image)
img_save(segmented_image, 'output_folder', 'input_image.jpg')
cell_folder('input_images_folder', 'output_images_folder', num_clusters=5)

# Image Denoising and Grayscale Conversion
denoise_images('input_images_folder', result_folder='denoised_images')
img_to_gray('input_images_folder', result_folder='gray_images')

Release files for cellmean 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cellmean 1.2.2
File Size Uploaded
cellmean-1.2.2.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cellmean 1.2.2
File Interpreter ABI Platform
cellmean-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / cellmean-1.2.2.tar.gz

Download URL cellmean-1.2.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ff450ed0b8ddf9dba71bdeff12f2dfa70f0a97ad46ad20a5d861a065eb6d29a4
BLAKE2b-256 checksum
How to use checksums
dbe796115925fdb5efdd0617e1d9a44b83c413cede6e0d611bd0e0b1e6951a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / cellmean-1.2.2-py3-none-any.whl

Download URL cellmean-1.2.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96bf092cb63b46a2d5d7444430f3923985ab1ae2583fd573894bce3aed50971f
BLAKE2b-256 checksum
How to use checksums
51ea70928cdbc40b11921eb6057957744254f939ab76aa15f24742cb113d46e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page