Skip to main content

CSI-Cancer image data structure and basic processing.

Project description

csi_images

This package contains classes and functions for interacting with images and image data. 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

Structure

This package contains these helpful 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.
  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 metadata data. Imports csi_scans.py.
      • get_tiles(): gets the tile of a scan at a particular coordinate.
      • get_all_tiles(): gets all of the tiles of a scan.
      • get_tiles_by_row_col(): gets the tiles in particular rows and columns.
      • get_tiles_by_xy_bounds(): gets the tiles within particular x and y bounds.
  3. csi_frames.py: a module for interacting with frames, which are individual images from the scan. Each frame in a tile has a different channel, or light spectrum. Imports csi_scans.py and csi_tiles.py.
    • Frame: a class for containing a frame's metadata.
      • get_image(): gets the image of the frame.
      • get_frames(): gets the frames of a tile.
      • get_all_frames(): gets all of the frames of a scan.
      • make_rgb_image(): creates an RGB image from the frames.
  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 an event's metadata and feature data. Key metadata (scan, tile, x, y) is required; the others are optional and flexible.
      • get_scan_position(): gets the x, y position of the event in the scan coordinate system.
      • get_slide_position(): gets the x, y position of the event in the slide coordinate system.
      • extract_event_images(): extracts the images of the event from the scan, reading from the scan images to do so. Convenient for getting a few events.
      • crop_images_to_event(): crops the images of the event from the scan, using the passed-in images. More efficient when getting many events.
    • extract_all_event_images(): efficiently extracts the images of a list of events.
    • get_features_as_dataframe(): combines the features from a list of events into a DataFrame.
    • get_metadata_as_dataframe(): combines the metadata from a list of events into a DataFrame.
    • save_to_hdf5(): loads a list of events from a CSV file. Not implemented yet.
    • load_from_hdf5(): montages a list of events. Not implemented yet.
    • save_to_csv(): loads a list of events from a CSV file. Not implemented yet.
    • load_from_csv(): montages a list of events. Not implemented yet.

Planned Features

  • csi_events.py: a module for interacting with individual events. Imports csi_scans.py, csi_tiles.py, and csi_frames.py.
    • montage_events(): Combines crops for an event into side-by-side montages.

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 and then run:

make_docs_csi_images

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 ./csi_images

Alternatively, you can "editable" install the package, which will allow you to make changes to the package and have them reflected in your environment without reinstalling:

pip install -e ./csi_images

This will add symbolic links to your site-packages directory instead of copying the package files over.

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

csi_images-1.1.2.tar.gz (407.5 kB view details)

Uploaded Source

Built Distribution

csi_images-1.1.2-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file csi_images-1.1.2.tar.gz.

File metadata

  • Download URL: csi_images-1.1.2.tar.gz
  • Upload date:
  • Size: 407.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for csi_images-1.1.2.tar.gz
Algorithm Hash digest
SHA256 b810db3aa4e2d121107dbc9158c79ebe60a29d56953a2154db20443a3f18000a
MD5 7ed65c1ae93eeac45ac2cc6463c1c322
BLAKE2b-256 a525ab3c462b6320139ee50761d8374eb82612b631ddf64b4d45205f6651c29e

See more details on using hashes here.

File details

Details for the file csi_images-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: csi_images-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for csi_images-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c92c8fd199a5a592f4bb669b0dc143962ef0ece2d1d96ee61e39af2092f396b
MD5 a1eff55cebac2fc54840d277dc751c18
BLAKE2b-256 a60a7faffc78415480fe5a2e48acef43bbd3248179ed0f8b08901bf9817ed2e0

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