Skip to content

Preprocess

Compute Credits

This tool uses 2.0 compute credits per hour.

The preprocessing algorithm allows you to remove artifacts and reduce the size of Inscopix microscope movies.

This should be the first algorithm that you apply to your microscope movies. Preprocessing should be used unless you have already downsampled and cropped the movies at acquisition or in another software application and have already de-interleaved planes from any multiplane or multicolor movie.

Inputs

Parameter Required? Default Description
Input Movie Files True N/A paths to the input movie files
Temporal Downsample Factor True 1 Factor by which the movie is to be temporally downsampled
Spatial Downsample Factor True 1 Factor by which the movie is to be spatially downsampled
Reference Image False N/A path to the reference image
Cropping Vertices False N/A A list of 4 values representing the coordinates of the top-left corner, width, and height of the area to crop: [top_left_x, top_left_y, width, height].
Fix Defective Pixels True True If True, check for defective pixels and correct them
Trim Early Frames True True If True, remove early frames that are usually dark or dim
Keep Deinterleaved Raw Movies False False If True, keep the movies created when input multicolor and multiplane movies are deinterleaved. Only required when the input consists of multicolor or multiplane movies.

File Inputs

Source Parameter File Type File Format
Input Movie Files miniscope_movie isxd
Reference Image miniscope_image isxd

Description

Preprocessing is used to remove defects and reduce the data footprint before moving on to further processing and analysis. It allows cropping the movie to a specified pixel region and downsampling it in space and time. In addition, some automated artifact removal tools are provided to reduce the influence of artificially bright or dark pixels that likely represent small defects in the sensor.

Formally, temporal downsampling works by averaging n adjacent frames, where n is the temporal downsample factor. The moving average stride is equal to the temporal downsample factor, which results in non-overlapping groups of frames to be averaged. This is equal to binning the frame data in time (in bins defined by the temporal downsample factor) and the subsequent averaging of each bin. The resulting number of frames equals the original number of frames divided by the temporal downsample factor, rounded down. Spatial downsampling works similarly, except that the spatial bins are non-overlapping sub-images of the original frames.

When this panel is enabled, the user may choose to enter the specific coordinates of the desired cropping region or use the cropping rectangle on the movie visualizer to make a selection.

Early Frames

Inscopix Data Acquisition Software (IDAS) may acquire a few "early" frames and write them to the beginning of a movie. These are typically noticed because they are usually dark or dim.

  • The frames are considered early because their exposure started before the recording's start time.
  • They are written because IDAS is continuously capturing and buffering frames to prevent dropped frames due to slow I/O. Once the recording starts, all frames still in the buffer are written - including early ones.
  • They are dark or dim if the EX-LED was not on before the recording starts.
  • The number of early frames may vary, but is usually between 1 and 3.

These early frames are problematic and should be removed.

  • When the early frames are dark or dim, they may confound the Inscopix standard processing pipeline.
  • They cause a timing error when aligning movies to GPIO data and other data sources.

From version 1.2.1 of Inscopix Data Processing Software (IDPS), the Trim early frames option was added to automatically remove these frames. This option will only be visible for unprocessed movies acquired with versions 1.2.1 and newer of IDAS. If the option is not visible, the same fix can be performed manually using the trimMovie operation with the Keep Start Time option checked. As this alternative approach requires manually defining which frames to trim, it can only be used to remove early frames when they are dark or dim.

Removing early frames will not remove any GPIO sync pulses or edit any other files.

De-Interleaving

Multiplexed movies including multiplane and multicolor movies are automatically de-interleaved in preprocessing.

For multiplane movies, this operation will generate an .isxd movie for each plane that was recorded during acquisition. Depending on the number of planes acquired in the movie, the sampling rate of each de-interleaved movie will be approximately 1/n of the sampling rate of the input multiplane movie, where n represents the number of planes in the multiplane movie.

For multicolor movies, this operation will generate an .isxd movie for each color channel that was recorded during acquisition. If the multicolor movie was recorded using 1:1 multiplexing, then each de-interleaved movie will have a sampling rate equal to approximately half the sampling rate of the input multicolor movie. If the multicolor movie was recorded using 1:4 multiplexing where one frame is captured from the green channel followed by four frames from the red channel, then the green channel movie will have a sampling rate equal to approximately one fifth of the sampling of the input multicolor movie. The red channel movie will have the same sampling rate as the input multicolor movie, and every fifth frame of the movie will be a blank frame, representing the green channel frame that occurred at that particular time during the recording. Inserting these blank frames is necessary in order to represent the red channel movie with a constant sampling rate.

Frame Timestamps

.isxd movies can encode the timestamp of each frame in a movie. Movies acquired from IDAS encode this metadata in the file, however once files are processed in IDPS, generally that metadata is not propagated to the output processed movie files. However, in preprocessing, if no temporal downsampling is applied on a movie, and the input movie has frame timestamps, then the frame timestamps are propagated to the output processed movie file. This enables users to easily export frame timestamps from de-interleaved multiplane and multicolor movies.

Next Steps

After preprocessing, movies are typically downsampled using the Downsample tool.