Timelapses

Time-lapses are images taken at regular intervals over time. They are a very powerful method to illustrate biological processes such as cell division, bacterial growth... They are almost exclusively done on live samples kept in appropriate conditions. 

The key variables for microscope timelapses are reviewed here

  • Sample preparation – How the sample is mounted, labeled, or stained

  • Temperature & environment – For live samples, conditions like temperature, humidity, and CO₂ levels affect biological processes

  • Time interval and duration – How often images are captured and the total length of imaging to capture the full process of interest

  • Imaging settings (magnification, illumination, detection) – Determines the level of detail visible (resolution vs field of view, illumination intensity, exposure time, photo-toxicity...)

  • Focus & stability – The sample must be and stay in focus for the full duration.

  • Processing data - Processing timelapse data can be challenging





Sample preparation

To come



Temperature & Environment

To come



Time Interval and Duration

How often should you capture images?

The time interval (or acquisition frequency) between images depends on the event you want to observe. According to the Nyquist-Shannon theorem, to capture a process without losing information, you must sample at least twice as fast as the highest frequency of the event.

Example: Imagine observing a bicycle wheel rotating at 1 turn per second:

  • If you look once per second, the valve always appears in the same position—you wouldn’t even notice the wheel is turning.

  • If you look twice per second, you see the valve in its original position and on the opposite side. You know the wheel is turning, but not the direction.

  • If you look more than twice per second, you can accurately determine both the wheel’s speed and direction.

Going back to timelapse microscopy for example with bacterial division (e.g., E. coli), which occurs roughly every 20 minutes, you should image at least once every 10 minutes. To be cautious and ensure nothing is missed, a 5-minute interval is often preferable.

Experiment Duration

The duration of your timelapse should be long enough to capture the entire process you want to study, including what happens before and after it occurs.

  • Before the event: Recording for a short period before the process starts allows the system to settle and ensures that any initial fluctuations or instability are captured.
  • After the event: Continuing to record after the process is complete shows how the system returns to a resting state or reveals any secondary effects.
In short, your experiment should cover the full timeline of interest—from baseline, through the main event, to post-event behavior—so that the story of the process is fully captured. 

Imaging should be done more than 2 times faster than the faster event you want to detect.



Imaging settings

To come

Phototoxicity is the most critical factor to control during a time-lapse experiment. While it is negligible in brightfield imaging, it becomes a major concern when fluorescence microscopy is used.

Be sure to consult the comprehensive blog post dedicated to.


Focus & Stability

After proper sample care (environmental control and minimizing phototoxicity), focus stability is likely the greatest challenge in time-lapse imaging. Most microscopes gradually lose focus over time. This phenomenon, known as drift, occurs naturally due to gravity, thermal fluctuations, and mechanical relaxation. Drift can be particularly pronounced shortly after the instrument is switched on. For important time-lapse experiments, it is strongly recommended to turn on the microscope at least 2-3hours in advance to allow the system to warm up and reach thermal equilibrium before starting your time-lapse experiment.

To address this issue, many microscopes incorporate laser-based focus stabilization systems that continuously measure the distance between the objective and the sample. These measurements are used to automatically compensate for axial drift during acquisition. Although the underlying principle is similar, manufacturers use different names for this technology:

  • Perfect Focus (Nikon)

  • TrueFocus (Evident / Olympus Corporation)

  • Definite Focus (Zeiss)

  • Adaptive Focus Control (Leica Microsystems)

  • PureFocus (Prior Scientific)

  • fCRISP Autofocus System (Applied Scientific Instrumentation)

Regardless of the name, these systems rely on periodic measurements of the objective–sample distance to compensate for naturally occurring drift and maintain consistent focus throughout long acquisitions. Any timelapse experiment should use a hardware-based autofocus or focus stabilization system whenever available to maintain a constant objective–sample distance and ensure stable focus throughout long-term imaging.


  • Turn on the microscope in advance (1 to 3 h)

  • Use hardware based drift compensation system


Processing timelapse data

We strongly recommend to save raw acquisition files during acquisition using the proprietary format from the acquisition software. You can then use FIJI to open and process it.  While scientific analysis must be performed on raw data, timelapses are also used to illustrate a process. For that purposes, timelapse can be processed to improve portability, compress size, better interoperability etc... We will provide some clues here to that purposes. 

Not sure what is FIJI?

Feel free to check our Microscopy software list to learn more. You will likely need ImageJ/FIJI, VLC media player and Handbrake.

Raw data file
1024 x 1022 16-bit 9601 frames -> 19.6 GB !

Reducing bit-depth

In an image each pixel is storing an information relative to brightness (for greyscale images). This information is usually an integer between 0 and X. The higher X, the higher number of possible values can be address to that pixel and thus the higher storage space is required to store this number. This is called bit-depth. A 8-bit image can store 255 value for each pixel. a 16-bit image can store 65000 values for each pixel etc... unfortunately human eyes are not able to appreciate more than few dozen of grey level. So reducing bit-depth is a easiest way to reduce the size of your data with actually changing how the images look.

In FIJI:

  • Drop the raw image file into the FIJI bar to import it

  • Select Image>Adjust>Brightness and contrast to open the Brightness and Contrast windows (Crtl+Shift+C)

  • Click Reset or adjust the brightness and contrast how you like it

  • Select Image>Type>8-bit to convert your image into 8-bit format (for multicolor images you should use RGB instead)

How many shades of grey can you identify?

Please test yourself here by selecting ALL the squares that do not match the background. You need to submit your answers 8 times to get your result. My best was 42...

 

1024 x 1022 8-bit 9601 frames -> 9.8 GB

Cropping

Cropping your image to your region of interest will effectively reduce the file size without affecting your resolution.

In FIJI:

  • Click on the rectangle selection tool

  • Click and drag while maintaining the shift key (this key will lock the aspect ratio 1:1 : square) around your region of interest

  • Select Image>Crop to crop your image (Crtl+X)

Cropped to 900 x 900 8-bit 9601 frames -> 7.6 GB

Downsizing

Another option consist in resizing (downsizing) your image.  This means converting a number of pixel to a smaller number which effectively reduce the file storage size but also the resolution.

In FIJI:

  • Image>Adjust>Size...

  • Check the following settings:

    • Constrain aspect ratio

    • Average when downsizing

    • Interpolation: Bicubic

  • Enter the number of pixel for the height

    • 500 for web usage

    • 720 for presentation

    • 1080 for full HD

  • Click OK

900 x 900 downsized to 500 x 500 8-bit 9601 frames -> 2.3 GB

Stabilizing images (registration)

To come


Normalizing intensity (flickering correction)

Sometimes the brightness of the images can vary over time. This can be due to the sample itself (bleaching, etc...), but also from the detector (camera), yet most of the time it comes from the light source.

To assess if you need to correct for flickering:

 In FIJI:

  • Click on the rectangle selection tool

  • For brightfield images, draw a rectangle in a region that does not contain your sample (only the background)

  • Image>Stacks>Plot Z-axis profile

  • Look for variations

In my case I have a drop after 190 seconds...

Let's correct for that. I haven't find a tool that do this task natively but a short script can help. This script convert the image to 32-bit then for each slice it calculates the mean intensity of the whole image. It then calculates a factor required to adjust the overall intensity to match the desired target. Finally it multiply the current frame by this factor.

Normalize Birghtness
// ------------------------------------------------------------
// Brightness normalization of each slice in a stack
// Target = rounded mean of ORIGINAL stack (Z-projection)
// Preserves original bit depth
// ------------------------------------------------------------

// Store original image ID
origID = getImageID();

// Detect original bit depth
origBitDepth = bitDepth();

if (origBitDepth == 8)  maxValue = 255;
if (origBitDepth == 16) maxValue = 65535;
if (origBitDepth == 24) maxValue = 255;   // RGB
if (origBitDepth == 32) maxValue = 1e30;  // effectively no clipping

// ---- Compute target from ORIGINAL stack ----
run("Z Project...", "projection=[Average Intensity]");
getStatistics(area, mean, min, max, std);
target = floor(mean + 0.5);
close();

// ---- Optional override dialog ----
Dialog.create("Normalization Target");
Dialog.addNumber("Target mean intensity:", target);
Dialog.show();
target = Dialog.getNumber();


// Reactivate original stack
selectImage(origID);

// Convert to 32-bit for safe math
run("32-bit");

n = nSlices;

for (i = 1; i <= n; i++) {

    setSlice(i);
    getStatistics(area, mean, min, max, std);

    if (mean == 0) {
        print("Warning: Slice " + i + " mean=0. Skipped.");
        continue;
    }

    factor = target / mean;

    // Improved clipping protection
    if (max * factor > maxValue) {
        safeFactor = maxValue / max;
        print("Slice " + i + 
              " would clip. Adjusting factor.");
        factor = safeFactor;
    }

    run("Multiply...", "value=" + factor);
}

// Convert back to original bit depth
if (origBitDepth == 8)  run("8-bit");
if (origBitDepth == 16) run("16-bit");

print("Target (rounded) = " + target);
print("Normalization complete.");

print("Target (rounded) = " + target);
print("Normalization complete.");



Macro_Normalize Timelapse Brightness.ijm


Make sure to run this macro on FIJI on the original image not adjusted for brightness and contrast.. See the improvement.


Timestamps

Timestamps are critical information because they indicate what is the real speed of the event that are being displayed. Without it, the observer has no idea if it is a fast process that is slowed down or vice-versa. Timestamps are usually stored within the raw file metadata, to read it:

In FIJI:

  • Image>Properties...

  • Look at the frame interval
    (if it is not present you should complain to the company that has provided the acquisition software)

In the example the frame interval is 3 seconds.

In FIJI:

  • Image>Stacks>Series Labeler

  • Select the following settings:
    • Stack Type: Time series
    • label Format: Digital
    • Label unit: s
    • Start: 0
    • Interval: 3
    • Every n-th: 1
    • Localization preset: Lower right
    • Select Background
    • Select Preview
    • Click OK

Series Labeler is a very effective tool to write timestamps on the image. However it is writing the information on the image and thus destroying the data underneath... 

An alternative is Time Stamper. Time stamper allows writing as an overlay but does not offer the preview option.

In FIJI:

  • Image>Stacks>Time Stamper

  • Select the following settings:
    • Interval: 3
    • X Location: 0
    • Y Location: 480
    • Font Size 14
    • Suffix: sec
    • Check Anti-aliased
    • Check Overlay

 This will add the timestamps as an overlay (floating layer that is independent of your image). To write the overlay on the images, you may need to flatten the overlay. To do so in Fiji Image>Overlay>Flatten (Crtl+Shift+F)

900 x 900 downsized to 500 x 500 8-bit 9601 frames with timestamps labelled with Series Labeler

Reslicing

Reslicing is a process of reducing the number of frames in your timelapse file. This can be done in two ways:

  • Dropping unused frames at the start or at the end (cropping in time)
  • Reducing the overall number of frames

Cropping in time

In FIJI

  • Image>Stacks>Tools>Make a substack
  • Enter the range of frames you would to keep: 147 - 5147
    It is useful to use a round number or at least a multiple of 30 for better export later on.
  • Click OK

Cropping in time does not affect the interval between frames so it can (and should) be done before adding timestamps labels

Reducing overall number of frames

In FIJI

  • Image>Stacks>Tools>Reduce Size
  • Enter the reduction factor: 2
  • Click OK

It is critical to keep in mind that reducing the overall number of frames increases the interval between frames. To avoid any problem you may use timestamps before reducing the overall number of frames to keep the information on the image itself. 


Video encoding

You can (and should) encode your file in a video format for an easy visualization. Several options are available, my suggestions are:

  1. Handbrake
  2. FFMPEG

Both are free open-source cross-platform video encoders. Handbrake has a user-interface whereas FFmpeg requires command lines.

Encoding with Handbrake

In the meanwhile we need to save our file into a that is compatible with Handbrake. To my knowledge only the AVI format is compatible.

In FIJI

  • Select File>Save As>AVI...
  • Select the following settings:
    • Compression: None
    • Frame rate: The frame is important at this stage because it will define how fast (or slow) and how long will be your final video. Depending on the process you would like to illustrate you may choose 10, 100 or 1000 fps. In my example I have 9601 frames and will choose 1000fps so my final video would be about 10sec long

In Handbrake

  • Drop your AVI file in the user interface

Some preset are already defined but for you might want to use a customized one that better fit your scientist needs:

  • Summary>Format: MP4
  • Dimensions>Resolution and scaling>Resolution Limit: None
  • Filters>Grayscale: Select it if you are exporting a grayscale video
  • Video
    • Video Encoder: H.264 (x264)
    • Framerate (FPS): Between 30 to 60 fps
    • Select: Constant Framerate
    • RF: between 20 and 10 (lower better image but bigger file size
  • At the bottom of the interface choose the name and the path of the output file
  • Click Start Encode
  • Wait and be patient depending on your hardware it can be long

Most if not all video files can be open and read with VideoLAN VLC: a free and open source cross-platform multimedia player.

Encoding with FFmpeg

 To come later





Core Facilities - CI2B               Structural Biology    |    Cytometry    |    Microscopy    |    Histology    |    Instruments & Services

Content published under CC BY-SA 4.0. Sharing allowed under the same license with attribution: "Original content by l'Institut Courtois d'innovation biomédicale, used under CC BY-SA 4.0"