GithubHelp home page GithubHelp logo

mpinb / gauss-em Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 25.54 MB

Example that demonstrates computationally solving the order of unordered serial slices

License: GNU General Public License v3.0

Python 34.61% Shell 2.63% Jupyter Notebook 62.76%

gauss-em's Introduction

GAUSS-EM: Guided accumulation of ultrathin serial sections with a static magnetic field for volume electron microscopy

Example for computationally solving the order of unordered serial slices. This overall approach is presented in the manuscript:

xxx - manuscript citation (at least with title / authors)

This example can be run either via command line or via the included jupyter notebook. It orders 20 example sequential slice images that are downsampled to a resolution of 256 nm and are originally only sorted by the order in which they were imaged. In the GAUSS-EM method the imaged order does not correspond to the order in which the slices were cut from the tissue block. Although the example will work without a gpu, it will take several hours of runtime. With a gpu (only tested with nVidia) it should run in 5-10 minutes. Scaling up to larger number of slices requires parallelization on a cluster.

In general the algorithm is O(n2) where n is the number of slices. This is because it computes a full distance (slice dissimilarity) matrix between all pairs of slice images. The most compute-intensive portion performs KNN searches between SIFT descriptors to find matching keypoints between images. The runtime and memory usage for these searches scales with the number of SIFT descriptors / keypoints per image, which in turn typically scales with higher resolution of the utilized slice images. Options for reducing run time include:

  • computation of upper or lower triangular only portion of the distance matrix
  • limiting the maxiumum number of SIFT features
  • using an approximate KNN search library instead of exact KNN searches

The choice of solver for the resulting Traveling Salesman Problem (TSP) could also theoretically effect runtime. Generally the distance matrix tends to be rather sparse in the sense that the similarity between images drops off very quickly for further neighbors of each slice in the original ordering. This has the tendency of greatly reducing the runtime of the TSP solver. This example contains images where the similarity falls off quickly, is relatively uniform between the images and the direct neighbors always have the highest similarity. For this reason a greedy-algorithm approximation for solving the TSP can be utilized. These conditions are not in general the case, so an optimal TSP-solver is recommended for production usage.

Install with Dependencies

Install miniconda or mambaforge base environment.

Recommended: conda create environment from yaml

Create an environment with all necessary dependencies:

conda env create -f gaussem-environment.yaml

Alternative: shell install script

Only tested with bash and using mambaforge or miniconda (need to modify some variables in script for miniconda):

bash install-with-mambaforge.sh

Usage

Either load the python notebook that works through the example, or use the command line interface, for example:

python SliceOrderSolver.py --ngpus 1

gauss-em's People

Contributors

elhuhdron avatar

Watchers

 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.