Giter Club home page Giter Club logo

mibilib's Introduction

GitHub last commit (branch) GitHub Release Date

mibilib

Python client for IONpath MIBItracker API, plus utility functions for working with MIBItiff images.

https://ionpath.github.io/mibilib/

mibilib has been updated for compatibility with MIBIscope/mibin-commercial MIBItiff images.
In particular, custom HIMSR tags have been added to the existing ImageDescription TIFF tag:

  • himsr.author: @christianrickert
  • himsr.back: level of background correction (gold slide interference)
  • himsr.bloom: level of bloom correction (horizontal stripes)
  • himsr.creation: timestamp at time of MIBItiff creation
  • himsr.mph: median pulse height for normalization
  • himsr.software: "mibin-commercial, v.0.9.0"
  • himsr.window: mass window for target

Optional tags can be added to the metadata:

  • mibi.norm: normalization factor

Prefix optional tags with mibi. for compatibility with Bio-Formats.

Setup

Install Miniconda

Install the lastest version of Miniconda. Even if your system already has a standalone version of Python installed, it is strongly recommended to use the conda environment manager to install and manage this library's dependencies.

Install mibilib with conda and pip

conda env create -f environment.yml
conda activate mibilib

Usage

It's easy to work with MIBITIFFs using the mibidata module.

from mibidata import tiff

# extract metadata from mibitiff (fast)
metadata = tiff.info("mibi.tif")  # returns a dictionary

# print FoV name from metadata
print(metadata["fov_name"])

# read a mibitiff into a MibiImage class instance (slow)
mibitiff = tiff.read("mibi.tif")

# print channel tuples from mibitiff
print(mibitiff.channels)

# copy MibiImage class into a new instance
newtiff = mibitiff.copy()

# rename a target channel
OLD_TARGET = "dsDNA"
NEW_TARGET = "dsDNA (nuclear marker)"
newtiff.rename_targets({OLD_TARGET: NEW_TARGET})

# normalize pixel data of all channels
NRM = 1.23
newtiff.data *= NRM

# offset data of second channel only
CHANNEL = 1
newtiff.data[:, :, CHANNEL] += 3.0

# add custom tags with a dictionary
TAGS = {"mibi.norm": NRM}
newtiff.add_attr(**TAGS)

# write MibiImage class into a file
tiff.write("new.tiff", newtiff)

To use the MIBItracker API with mibitracker, you will need to use the backend url listed in the About page. This can be accessed after you have logged in from the menu under your username in the upper right of the window.

from mibitracker.request_helpers import MibiRequests

request = MibiRequests(
    'https://[sitename].api.ionpath.com',
    '[email protected]',
    'password1234'
)
image_id = request.image_id('20180927', 'Point3')
image_details = request.get('/images/{}/'.format(image_id))

More examples can be found in the following notebooks:

Full documentation for this library can be found at https://ionpath.github.io/mibilib/.

Sample data

Access to sample data to run the tutorials in the notebooks can be requested by creating an account at the following URL: https://mibi-share.ionpath.com.

mibilib's People

Contributors

avstri avatar chityala-ion avatar chris-brent avatar christianrickert avatar dependabot[bot] avatar emma-munch avatar jaytarolli avatar mapazarr avatar murataksoy avatar noahnewgren avatar rfinck avatar spacepirate avatar stanislaw-ionpath avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.