zea.data.convert.echonetlvh.precompute_crop

Script to precompute cone parameters for the EchoNet-LVH dataset. This script should be run separately before the main conversion process.

Functions

find_avi_file(source_dir, hashed_filename[, ...])

Find AVI file in the specified batch directory or any batch if not specified.

load_first_frame(avi_file)

Load only the first frame of a video file.

load_splits(source_dir)

Load splits from MeasurementsList.csv and return avi filenames

precompute_cone_parameters(args)

Precompute and save cone parameters for all AVI files.

zea.data.convert.echonetlvh.precompute_crop.find_avi_file(source_dir, hashed_filename, batch=None)[source]

Find AVI file in the specified batch directory or any batch if not specified.

Parameters:
  • source_dir – Source directory containing BatchX subdirectories

  • hashed_filename – Hashed filename (with or without .avi extension)

  • batch – Specific batch directory to search in (e.g., “Batch2”), or None to search all batches

Returns:

Path to the AVI file if found, else None

zea.data.convert.echonetlvh.precompute_crop.load_first_frame(avi_file)[source]

Load only the first frame of a video file.

Parameters:

avi_file – Path to the video file

Returns:

First frame as numpy array of shape (H, W) and dtype np.uint8 (grayscale)

zea.data.convert.echonetlvh.precompute_crop.load_splits(source_dir)[source]

Load splits from MeasurementsList.csv and return avi filenames

Parameters:

source_dir – Source directory containing MeasurementsList.csv

Returns:

Dictionary with keys ‘train’, ‘val’, ‘test’, ‘rejected’ and values as lists of avi filenames

zea.data.convert.echonetlvh.precompute_crop.precompute_cone_parameters(args)[source]

Precompute and save cone parameters for all AVI files.

This function loads the first frame from each AVI file, applies fit_scan_cone to determine cropping parameters, and saves these parameters to a CSV file for later use during the actual data conversion.

Parameters:

args – Argument parser namespace with the following attributes: src: Source directory containing EchoNet-LVH data dst: Destination directory to save cone parameters batch: Specific batch to process (e.g., “Batch2”) or None for all max_files: Maximum number of files to process (or None for all) force: Whether to recompute parameters if they already exist

Returns:

Path to the CSV file containing cone parameters