Skip to main content

pyimc

Library for accessing imaging mass cytometry (IMC) data stored in .mcd files. Access is provided to all channel data, metadata and optical images stored within the file. Additionally, it is possible to generate slide overview images which can be used in whole slide imaging registration workflows.

Installation

pip install pyimc

Usage

IMC data in *.mcd files are stored in a spectrum-wise manner, in the order acquired on the instrument. This allows fast access to individual pixel information, but requires reading in all data from a single acquisition to generate a single channel image. To provide fast access to image data, an optional means of opening the data is demonstrated below, with the caveat that this generates a temporary binary file in the same location as the .mcd file, the first time this function is called, which can take a few seconds. The temporary binary file is approximately 33% as big as the original .mcd file.

With fast access to images

import pyimc

data = pyimc.Mcd.parse("/path/to/data.mcd")

Without fast access to images

import pyimc

data = pyimc.Mcd.parse("/path/to/data.mcd", False)

Access to channel data

# Get the first slide (there is usually only one)
slide = data.slide(1)

# Get list of all acquisition IDs in the data
acquisition_ids = data.acquisition_ids() 

# Get 3rd acquisition
acquisition = data.acquisition(acquisition_ids[2])

# Get the channel list for the current acquisition
channels = acquisition.channels()

# Select for 10th channel
channel = channels[9]

print(channel.label())
print(channel.name())

# Get the image data for the channel as a numpy array from the chosen acquisition
channel_data = acquisition.channel_data(channel)

Access panorama image

# Get panorama with ID = 3
panorama = data.panorama(3)

# Get optical image associated with the panorama
image = panorama.image()

Generate slide overview image

# Get the first slide (there is usually only one)
slide = data.slide(1)

# Get all channels in the slide
channels = slide.channels()

# Select the 10th channel
channel = channels[9]

# Generate an overview image of the slide with a width of 7500 pixels (height will be 
# automatically scaled), displaying the selected channel image in the relative location
# on the slide where the acquisition was performed, thresholding the intensity at 10
overview_image = slide.overview_image(7500, channel, 10)

Access XML

xml = data.xml()

Metadata

Release files for pyimc 0.1.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 pyimc 0.1.2
File Size Uploaded
pyimc-0.1.2.tar.gz 42.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyimc 0.1.2
File Interpreter ABI Platform
pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.28+ x86-64 Details

Total release size: 1.1 MB

Release files / pyimc-0.1.2.tar.gz

Download URL pyimc-0.1.2.tar.gz
Size 42.4 kB
Tags Source
SHA-256 checksum
How to use checksums
69d7c54fff85f83a178020fd5e8fd7af0f39daecaaaecfb6bb5098da34c155cc
BLAKE2b-256 checksum
How to use checksums
ba175a521fb15422e97e7502a39a1e0851844179da630d578c414997e45df1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.14.3

Release files / pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl

Download URL pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
de9dacab7933dde6c2b38183a9c0c7633a854ec2fa40152061afeceeb6a4752e
BLAKE2b-256 checksum
How to use checksums
95a3aa3cb944f23b8246e4738d6ddc55951d6a81cdfd7caeed037384dc7695d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.14.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

9 release files

0.1.0

7 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