zea.data.convert.echonet¶
Script to convert the EchoNet database to .npy and zea formats. Will segment the images and convert them to polar coordinates.
Functions
|
Acceptance algorithm that determines whether to reject an image based on left and right corner data. |
|
Function that converts a timeseries of a cartesian cone to a polar representation that is more compatible with CNN's/action selection. |
|
Function that finds the split for a given file in a dictionary. |
|
Parse command line arguments. |
|
Function that rotates the datapoints by a certain degree. |
|
Segments the background of the echonet images by setting it to 0 and creating a hard edge. |
Classes
|
Stores a few variables and paths to allow for hyperthreading. |
- class zea.data.convert.echonet.H5Processor(path_out_h5, path_out=None, num_val=500, num_test=500, range_from=(0, 255), range_to=(-60, 0), splits=None)[source]¶
Bases:
object
Stores a few variables and paths to allow for hyperthreading.
- zea.data.convert.echonet.accept_shape(tensor)[source]¶
Acceptance algorithm that determines whether to reject an image based on left and right corner data.
- Parameters:
tensor (ndarray) – Input image (sc) with 2 dimensions. (112, 112)
- Returns:
Whether or not the tensor should be rejected.
- Return type:
decision (bool)
- zea.data.convert.echonet.cartesian_to_polar_matrix(cartesian_matrix, tip=(61, 7), r_max=107, angle=0.79, interpolation='nearest')[source]¶
Function that converts a timeseries of a cartesian cone to a polar representation that is more compatible with CNN’s/action selection.
- Parameters:
cartesian_matrix (-) – (rows, cols) matrix containing time sequence of image_sc data.
tip (-) – coordinates (in indices) of the tip of the cone. Defaults to (61, 7).
r_max (-) – expected radius of the cone. Defaults to 107.
angle (-) – expected angle of the cone, will be used as (-angle, angle). Defaults to 0.79.
interpolation (-) – can be [nearest, linear, cubic]. Defaults to ‘nearest’.
- Returns:
polar conversion of the input.
- Return type:
polar_matrix (2d array)
- zea.data.convert.echonet.find_split_for_file(file_dict, target_file)[source]¶
Function that finds the split for a given file in a dictionary.
- zea.data.convert.echonet.rotate_coordinates(data_points, degrees)[source]¶
Function that rotates the datapoints by a certain degree.
- Parameters:
data_points (ndarray) – tensor containing [N,2] (x and y) datapoints.
degrees (int) – angle to rotate the datapoints with
- Returns:
the rotated data_points.
- Return type:
rotated_points (ndarray)
- zea.data.convert.echonet.segment(tensor, number_erasing=0, min_clip=0)[source]¶
Segments the background of the echonet images by setting it to 0 and creating a hard edge.
- Parameters:
tensor (ndarray) – Input image (sc) with 3 dimensions. (N, 112, 112)
number_erasing (float, optional) – number to fill the background with.
- Returns:
Segmented matrix of same dimensions as input
- Return type:
tensor (ndarray)