Giter VIP home page Giter VIP logo

cell-tracking's Introduction

Cell Tracking

Python scripts for tracking cells in fluorescent microscopy, for Ed Munro's group.

Prerequisites

  • Python 3.6
  • Python scientific stack (numpy, scipy, matplotlib)
  • scikit-image
  • pykalman
  • ffmpeg or avconv command line tools for creating movies

Everything is pure python except for the function write_movie in BKlib.py, which uses ffmpeg/avconv. One of these will probably be installed on Linux machines; it can be installed on Mac using the binaries here. The scripts should work on Windows, except for the function write_movie, which depends on avconv.

Scripts

All of the scripts take a tiff movie as input. You can see help instructions by typing the script name without any arguments. I've included a sample movie, cell_membranes.tiff.

track_cell.py must be run first. It takes a tiff file as input, does a simple watershed-based segmentation, and presents a GUI to the user to select a region of interest (i.e., a single segmented cell). This region is then tracked across subsequent frames using an active contour/snakes model. Finally, the control points from the contours are saved to an npy file for futher analysis. This output npy file is the main output; take note of its name, since it is a required argument for the other scripts.

visualize_tracking.py shows the movie with the tracking results overlaid. Use the -o flag to specify an output avi filename in order to save the visualization as a movie.

create_cell_movie.py extracts a small window around the cell of interest and saves it to a movie, so that the motion of the cell is "frozen". Note that the tiff can be a different channel from that used for cell tracking, i.e., you can use a channel that displays cell boundaries in track_cell.py, but another channel with this script.

plot_cell_trajectory.py computes the centroids of the cell boundaries, smooths the trajectory with a Kalman filter, and creates a few plots to quantify motion.

cell-tracking's People

Contributors

brikeats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cell-tracking's Issues

Tracking with interval signals

Hi
Is there a way to make use of flourecent signals only imaged at set time intervals e.g. nuclear stain every 2hrs (0, 2, 4, 5), to aid with the tracking?

Many thanks,

Dean

avconv stdout

The write_movie function dumps a lot of unnecessary shit to the screen

numpy warnings

track_cell gives warnings.warn("Warning: converting a masked element to nan.") from numpy; and RuntimeWarning: invalid value encountered in less from matplotlib.

create_cell_movie arguments

padding, and amount of kalman smoothing should be selectable via command line. also flags to add velocity vector and/or cell boundary annotations on top of movie.

cell falls off edge

When the cell goes off the edge, the snake may collapse, but with some values of alpha, it raises an exception. The tracking script should detect when the snake points fall outside of the big cell mask.

scipy warning in visualize_tracking.py

I get Warning: Setting x[0][36]=x[0][0] from scipy fitting. I believe there's a missing point in the boundary; need to add a copy of the first point to the end of the array?

visualization

The visualization should have the ability to replay via button press.

track_cell.py arguments

track_cell needs more flexibility via command line. At a minimum, add: alpha, beta, gamma, spacing of boundary points.

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.