zea.data.convert.echonetlvh¶
Script to convert the EchoNet-LVH database to zea format.
Each video is cropped so that the scan cone is centered without padding, such that it can be converted to polar domain.
Note
This cropping requires first computing scan cone parameters
using zea.data.convert.echonetlvh.precompute_crop, which
are then passed to this script.
For more information about the dataset, resort to the following links:
The original dataset can be found at this link.
Functions
|
Conversion script for the EchoNet-LVH dataset. |
|
Convert measurements CSV file with updated coordinates using cone parameters. |
|
Crop a single frame using predetermined cone parameters. |
|
Apply cropping to a sequence of frames using predetermined parameters. |
|
Find AVI file in the specified batch directory or any batch if not specified. |
|
Load cone parameters from CSV file into a dictionary. |
|
Load splits from MeasurementsList.csv and return avi filenames |
|
Overwrite MeasurementsList.csv splits based on manual_rejections.txt or another txt file specifying which hashes to reject. |
Transform measurement coordinates using cone parameters from fit_scan_cone. |
Classes
|
Modified H5Processor for EchoNet-LVH dataset. |
- class zea.data.convert.echonetlvh.LVHProcessor(*args, cone_params=None, **kwargs)[source]¶
Bases:
H5ProcessorModified H5Processor for EchoNet-LVH dataset.
- zea.data.convert.echonetlvh.convert_echonetlvh(args)[source]¶
Conversion script for the EchoNet-LVH dataset. Unzips, overwrites splits if needed, precomputes cone parameters, and converts images and/or measurements to zea format and saves dataset. Is called with argparse arguments through zea/zea/data/convert/__main__.py
- Parameters:
args (argparse.Namespace) – Command-line arguments
- zea.data.convert.echonetlvh.convert_measurements_csv(source_csv, output_csv, cone_params_csv=None)[source]¶
Convert measurements CSV file with updated coordinates using cone parameters.
- Parameters:
source_csv – Path to source CSV file
output_csv – Path to output CSV file
cone_params_csv – Path to CSV file with cone parameters
- zea.data.convert.echonetlvh.crop_frame_with_params(frame, cone_params)[source]¶
Crop a single frame using predetermined cone parameters.
- Parameters:
frame – Input frame as numpy array
cone_params – Dictionary containing cropping parameters
- Returns:
Cropped and padded frame
- zea.data.convert.echonetlvh.crop_sequence_with_params(sequence, cone_params)[source]¶
Apply cropping to a sequence of frames using predetermined parameters.
- Parameters:
sequence – Input sequence as numpy array of shape (frames, height, width)
cone_params – Dictionary containing cropping parameters
- Returns:
Cropped and padded sequence
- zea.data.convert.echonetlvh.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.load_cone_parameters(csv_path)[source]¶
Load cone parameters from CSV file into a dictionary.
- Parameters:
csv_path – Path to the CSV file containing cone parameters
- Returns:
Dictionary mapping avi_filename to cone parameters
- zea.data.convert.echonetlvh.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.overwrite_splits(source_dir, rejection_path=None)[source]¶
Overwrite MeasurementsList.csv splits based on manual_rejections.txt or another txt file specifying which hashes to reject.
- Parameters:
source_dir – Source directory containing MeasurementsList.csv and manual_rejections.txt
rejection_path – Path to the rejection txt file. If None, defaults to ./manual_rejections.txt
- Returns:
None
- zea.data.convert.echonetlvh.transform_measurement_coordinates_with_cone_params(row, cone_params)[source]¶
Transform measurement coordinates using cone parameters from fit_scan_cone.
- Parameters:
row – A dict containing measurement data with X1,X2,Y1,Y2 coordinates
cone_params – Dictionary containing cone parameters from fit_scan_cone
- Returns:
A new row with transformed coordinates, or None if cone_params is None
Modules
Script to precompute cone parameters for the EchoNet-LVH dataset. |