Skip to main content

No project description provided

Project description

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()

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

pyimc-0.1.2.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

Details for the file pyimc-0.1.2.tar.gz.

File metadata

  • Download URL: pyimc-0.1.2.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.14.3

File hashes

Hashes for pyimc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 69d7c54fff85f83a178020fd5e8fd7af0f39daecaaaecfb6bb5098da34c155cc
MD5 97b9bba9f37e3b37a15276bdda922276
BLAKE2b-256 ba175a521fb15422e97e7502a39a1e0851844179da630d578c414997e45df1c4

See more details on using hashes here.

File details

Details for the file pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimc-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de9dacab7933dde6c2b38183a9c0c7633a854ec2fa40152061afeceeb6a4752e
MD5 c83c84e3a5a2fcab477487b0ceff3499
BLAKE2b-256 95a3aa3cb944f23b8246e4738d6ddc55951d6a81cdfd7caeed037384dc7695d4

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