fl4health.datasets.skin_cancer.preprocess_skin module

The following code is adapted from the preprocess_skin.py script from the medical_federated GitHub repository by Seongjun Yang et al.

Paper: https://arxiv.org/abs/2207.03075 Code: https://github.com/wns823/medical_federated.git - medical_federated/skin_cancer_federated/preprocess_skin.py

derm7pt_image_path_func(row)[source]

Constructs the image path for the Derm7pt dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The constructed image path.

derm7pt_label_map_func(row)[source]

Maps the original label to the new label for the Derm7pt dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The mapped label.

ham_image_path_func(row)[source]

Constructs the image path for the HAM10000 dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The constructed image path.

ham_label_map_func(row)[source]

Maps the original label to the new label for the HAM10000 dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The mapped label.

pad_image_path_func(row)[source]

Constructs the image path for the PAD-UFES-20 dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The constructed image path.

pad_label_map_func(row)[source]

Maps the original label to the new label for the PAD-UFES-20 dataset.

Parameters:

row (Series) – A row from the dataframe.

Return type:

str

Returns:

The mapped label.

preprocess_derm7pt(data_path, official_columns)[source]

Preprocesses the Derm7pt dataset.

Parameters:
  • data_path (str) – The base path to the dataset.

  • official_columns (list[str]) – The list of official columns for the dataset.

Return type:

None

preprocess_ham10000(data_path, official_columns)[source]

Preprocesses the HAM10000 dataset.

Parameters:
  • data_path (str) – The base path to the dataset.

  • official_columns (list[str]) – The list of official columns for the dataset.

Return type:

None

preprocess_isic_2019(data_path, official_columns)[source]

Preprocesses the ISIC 2019 dataset.

Parameters:
  • data_path (str) – The base path to the dataset.

  • official_columns (list[str]) – The list of official columns for the dataset.

Return type:

None

preprocess_pad_ufes_20(data_path, official_columns)[source]

Preprocesses the PAD-UFES-20 dataset.

Parameters:
  • data_path (str) – The base path to the dataset.

  • official_columns (list[str]) – The list of official columns for the dataset.

Return type:

None

process_client_data(dataframe, client_name, data_path, image_path_func, label_map_func, original_columns, official_columns)[source]

Processes and saves the client-specific dataset.

Parameters:
  • dataframe (DataFrame) – The dataframe containing the client data.

  • client_name (str) – The name of the client.

  • data_path (str) – The base path to the dataset.

  • image_path_func (Callable[[Series], str]) – A function that constructs the image path from a dataframe row.

  • label_map_func (Callable[[Series], str]) – A function that maps the original label to the new label.

  • original_columns (list[str]) – The list of original columns for the dataset.

  • official_columns (list[str]) – The list of official columns for the dataset.

Return type:

None

save_to_json(data, path)[source]

Saves a dictionary to a JSON file.

Parameters:
  • data (dict[str, Any]) – A dictionary to save.

  • path (str) – The file path to save the JSON data.

Return type:

None