Skip to main content

csi_images: image and data utilities for CSI-Cancer

PyPI version Coverage Badge Tests Badge

This package is a library for interacting with data, mainly from immunoflourescent microscopy, such as cells and the images thereof. While much of the functionality is specific to the CSI-Cancer organization, some of the functionality and structure may be beneficial for the broader community. Other packages in the CSI-Cancer organization may depend on this package.

Install with:

pip install csi_images

or

pip install csi_images[imageio,rds,dev]

The base version of the package includes only core data structures and manipulations.

Optional dependencies include:

  • imageio: for reading and writing images, include .czi files.
  • rds: for reading and writing RDS files, such as OCULAR outputs.
  • dev: for development dependencies, including documentation, tests, building, etc.

Structure

This package contains these modules:

  1. csi_scans.py: a module for interacting with scan-level files, such as .czi files.
    • Scan: a class that contains all of the scan metadata. for interacting with scan metadata, such as the slide ID, the path to the scan, and scan parameters. Recommend importing via from csi_images.csi_scans import Scan
  2. csi_tiles.py: a module for interacting with tiles, which have a particular (x, y) position in the scan. Tiles have several frames taken at the same position.
    • Tile: a class for containing a tile's positional data. Includes a reference to a Scan. This class unifies multiple scanners' tile positioning to convert between index and (x, y). Recommend importing via from csi_images.csi_tiles import Tile
  3. csi_frames.py: a module for interacting with frames, which are individual images. Imports csi_scans.py and csi_tiles.py. Recommend importing via from csi_images.csi_frames import Frame
    • Frame: a class for containing a frame's metadata. Includes a reference to a Tile. For a list of frames for a tile, use get_frames(tile). For all frames in a scan, use get_all_frames(scan). Each frame in a tile has a different channel, or light spectrum. The frame only contains metadata, but enables gathering of the image data through the get_image() method. For many frames, use [frame.get_image() for frame in frames]. Recommend importing via from csi_images.csi_frames import Frame
  4. csi_events.py: a module for interacting with individual events. Imports csi_scans.py, csi_tiles.py, and csi_frames.py.
    • Event: a class for containing a single event's metadata and feature data. Key metadata (scan, tile, x, y) is required; the others are optional and flexible. Contains functions for determining event position in different coordinate frames and performing crop and montage image manipulations, as well as name conventions for saving crops and images. Recommend importing via from csi_images.csi_events import Event
    • EventArray: a class for containing a list of events, holding their data in Pandas DataFrames. Contains functions converting back and forth from Events and files. Recommend importing via from csi_images.csi_events import EventArray
  5. csi_images.py: a module for image manipulation functions. These functions are developed to be portable and contain all of the image-related dependencies, making it possible to use the other modules without image-related dependencies. Recommend importing via from csi_images import csi_images

Documentation

For more detailed documentation, check the API docs.

Alternatively, once you have cloned the repository, you can open up docs/index.html in your browser.

To regenerate the documentation, ensure that you have installed the package with development dependencies and then run:

docs/make_docs.sh

Development Installation

  1. Activate your conda (conda activate yourenv) or venv (source path/to/your/venv/bin/activate) environment first.
  2. Clone csi_images and install:
cd ~/path/to/your/repositories
git clone git@github.com:CSI-Cancer/csi_images.git
pip install -r requirements.txt

This installs the package in "editable" mode, as well as all dependencies and development dependencies (e.g. pytest, pdoc, etc.).

You may also use the requirements-versioned.txt file to install known good versions.

Metadata

Release files for csi-images 3.0.4

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

Source distribution (sdist)

Source distribution for csi-images 3.0.4
File Size Uploaded Provenance
csi_images-3.0.4.tar.gz 698.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for csi-images 3.0.4
File Interpreter ABI Platform
csi_images-3.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 739.4 kB

Release files / csi_images-3.0.4.tar.gz

Download URL csi_images-3.0.4.tar.gz
Size 698.8 kB
Tags Source
SHA-256 checksum
How to use checksums
059a05446e15555c3bf3bd15cd7aba6ebae0770e6195022191bd0c2c23794c9c
BLAKE2b-256 checksum
How to use checksums
67311f09c26f95d3cb4cc630382903055c5c7e338b037c5708e8d5fcca6251b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / csi_images-3.0.4-py3-none-any.whl

Download URL csi_images-3.0.4-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed5fafc0404ada082191dac4f3a45cf8ef4a6dae428d2dde7765025f39451e29
BLAKE2b-256 checksum
How to use checksums
38d0ce4aae3d9352612ebb58a7d1d824150000e27d3a2ae348eca7172557c442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for csi-images 3.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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