This is a lighter version of Mastodon Reader for Python from Chrisoph Sommer.
Import the spots and links tables, features, tags and meta data from a Mastodon project file.
Ported to Python from: matlab-mastodon-importer
This reader is lighter mainly because it does not depend on pandas
nor on networkx
and it therefore only depends on numpy
.
Read the mastodon file:
from micromastodonreader import MicroMastodonReader
mr = MicroMastodonReader("demo/demo.mastodon")
# show meta data
meta_data = mr.read_metadata()
# read spot and link tables with features and tags columns
spots, links, tag_definition, features = mr.read(tags=True, features=True)
spots
is a numpy.ndarray
where:
spots[int_id]
is the cell with idint_id
spots[int_id, 0]
is thex
coordinate of the cellint_id
spots[int_id, 1]
is they
coordinate of the cellint_id
spots[int_id, 2]
is thez
coordinate of the cellint_id
spots[int_id, 3]
is the time of the cellint_id
spots[int_id, 3:10]
are the values of the elongation matrix representing the cellint_id
spherespots[int_id, 10]
is thebsrs
(??) ofint_id
links
is a numpy.ndarray
where:
links[int_pos]
is an edgelinks[int_pos, 2]
is the id of the edgelinks[int_pos, 0]
is the id of the cell at timet
links[int_pos, 1]
is the id of the cell at timet + 1
tag_definition
and features
are a bit more complicated 🫠
You can also read information separately
# read only spot and link tables
spots, links = mr.read_tables()
# read tag_definition
tag_definition = mr.read_tags()
# read features
mr.read_features()
pip install git+git://github.com/GuignardLab/python-mastodon-importer-light
pip install micro-mastodon-reader
more information on PyPi