zea.data.convert.camus

Functionality to convert the camus dataset to the zea format. Requires SimpleITK to be installed: pip install SimpleITK.

Functions

convert_camus(source_path, output_path[, ...])

Converts the camus database to the zea format.

get_args()

Parse command line arguments.

get_split(patient_id)

Determine the dataset split for a given patient ID.

sitk_load(filepath)

Loads an image using SimpleITK and returns the image and its metadata.

transform_sc_image_to_polar(image_sc[, ...])

Transform a scan converted input image (cone) into square

zea.data.convert.camus.convert_camus(source_path, output_path, overwrite=False)[source]

Converts the camus database to the zea format.

Parameters:
  • source_path (str, pathlike) – The path to the original camus file.

  • output_path (str, pathlike) – The path to the output file.

  • overwrite (bool, optional) – Set to True to overwrite existing file. Defaults to False.

zea.data.convert.camus.get_args()[source]

Parse command line arguments.

zea.data.convert.camus.get_split(patient_id)[source]

Determine the dataset split for a given patient ID.

Return type:

str

zea.data.convert.camus.sitk_load(filepath)[source]

Loads an image using SimpleITK and returns the image and its metadata.

Parameters:

filepath (str | Path) – Path to the image.

Return type:

Tuple[ndarray, Dict[str, Any]]

Returns:

  • ([N], H, W), Image array.

  • Collection of metadata.

zea.data.convert.camus.transform_sc_image_to_polar(image_sc, output_size=None, fit_outline=True)[source]
Transform a scan converted input image (cone) into square

using radial stretching and downsampling. Note that it assumes the background to be zero! Please verify if your results make sense, especially if the image contains black parts at the edges. This function is not perfect by any means, but it works for most cases.

Parameters:
  • image (numpy.ndarray) – Input image as a 2D numpy array (height, width).

  • output_size (tuple, optional) – Output size of the image as a tuple. Defaults to image_sc.shape.

  • fit_outline (bool, optional) – Whether to fit a polynomial the outline of the image. Defaults to True. If this is set to False, and the ultrasound image contains some black parts at the edges, weird artifacts can occur, because the jagged outline is stretched to the desired width.

Returns:

Squared image as a 2D numpy array (height, width).

Return type:

numpy.ndarray