Back to ObjectJ Examples

Stabilize Movie in Chunks

Download Stabilize in Chunks

Norbert Vischer
vischer(at)science.uva.nl

version 7 21-oct-2016

If a movie is "shaky", this macro possibly can stabilize it. You need a fiducial point (thresholdable particle) in the image that does not change position during a certain time window (chunk) of the movie.

The time window is defined by two rectangular rois, one at the beginning and one at the end of the desired time window. These rois have same postition and size.

Create a rectangular roi within th The user can limit space and time within which a particle can serve as fiducial point. Within the chosen roi and time window, the particle analyser detects the current x-y position of the largest particle found and identifies it as fiducial object. It records its x-y position that is later used for compensating any undesired movement.

Hyperstacks:
If used for hyperstacks, fiducial objects must be in channel 1, and all other channels will undergo the same translation. Note that the hyperstack must not be 5D (i.e. either nChannels or nFrames must be 1).
Use Image>Color>Arrange Channels if necessary.

Installation:
Open StabilizeChunks-5.txt in ImageJ

Usage:

Fig 1: Unstable movie: slice 37 was used as start point and slice 85 as endpoint.
Red (thresholded) particle inside the roi has travveled from left to right in slice 85.

Fig 2: Before translating slices 38 .. 250, the particle’s trajectory during slice 37 .. 85 is shown as segmented line, asking for confirmation (OK or Esc).