sommerc / undrift

Corrects local, non-linear drift in tissue by estimating dense optical flow and using it for warping images back to first frame.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undrift

Corrects local, non-linear drift in tissue by estimating dense optical flow and using it for warping images forward and backward from and to a selectable key frame.

It comes as command line tool for Python >= 3.6

1. Stabilization of 3D stack showing breathing artifacts

Undrift can be used to remove breathing deformations in live imaging.

Left (magenta) original z-stack; right (green) undrift result:

undrift_breathe.mp4

This example used the following command

undrift original.tif --smooth_xy 0.7 --smooth_t 0 --winsize 31 --poly_n 5 --poly_sigma 1.1 --levels 1 --key_frame 20 --pre_reg

The input image tif needs to be single or multi-channel z-stack or 2D movie.

2. Removing semi-local drift

Original movie with non-linear, local drift in the tissue

Original

Drift estimation via smooth, dense optical-flow

Drift estimation

Undrifting result

Undrift

Installation

Current master

pip install git+https://git.ista.ac.at/csommer/undrift.git

Develop

  1. Clone repository to <path>

  2. With (Ananconda) command line cd <path>/undrift

  3. Pip install undrift with:

    pip install -e .

Required python packages are installed automatically

Usage

Basic command:

undrift <movie_tif_file> [<more_tif_files>...]

Command line help:

undrift --help

How to apply recursively to many images in folder sturcture on Windows?

to use undrift with spatial smoothing of 50 px for all tif files in a folder recursively on Windows, use

for /r %i in (*.tif) do undrift --smooth_xy 50 "%i"

in the (Anaconda) command prompt

About

Corrects local, non-linear drift in tissue by estimating dense optical flow and using it for warping images back to first frame.

License:GNU Lesser General Public License v3.0


Languages

Language:Python 100.0%