trim_movie - Crop movie
Crops the beginning and/or the end of all imported disk-backed .dat image time series in a session folder.
Description
Use this function to remove time from the start and/or the end of all imported image time series files in a SaveFolder. The function reads the imported channel list from AcqInfos.mat, trims the corresponding .dat files in RAM-safe mode, overwrites the original .dat files, updates the same-name channel metadata .mat files, and automatically updates events.mat when present. Trimming values are specified in seconds and converted to frames separately for each imported channel.
Important
This function changes all .dat files imported by any of the data import functions, such as run_ImagesClassification, exclusively. Therefore, it is advisable to execute it at the beginning of the pipeline, preferably just after data import.
Input
This function accepts a SaveFolder containing AcqInfos.mat, imported .dat files, and same-name channel metadata .mat files. The imported channels are identified from AcqInfoStream.Illumination<N>.Color.
Output
Cell array file manifest containing the full paths to the imported .dat files discovered from AcqInfos.mat. If no trimming is requested, the function still returns the full imported .dat file list and does not rewrite any files.
Parameters
Time in seconds to remove from the beginning of each imported .dat movie. The number of removed frames is computed separately for each channel using ceil(crop_start_sec * Freq). If set to zero, no time is removed from the start.
Time in seconds to remove from the end of each imported .dat movie. The number of removed frames is computed separately for each channel using ceil(crop_end_sec * Freq). If set to zero, no time is removed from the end.
Important
If an events.mat file exists in the SaveFolder, it is automatically updated to remain synchronized with the trimmed recordings. Events outside the retained interval are removed and retained event timestamps are shifted so that the trimmed recordings start at time zero.