Global -> SetUp Handlers

Dataset organizers

tardis_em.utils.dataset.move_train_dataset(dir_: str, coord_format: tuple, with_img: bool, img_format: tuple | None = None)

Detect and copy all date to new train directory.

Train dataset builder. Detected files of specific format and moved to: - dir/train/masks - dir/train/imgs [optional]

Parameters:
  • dir (str) – Directory where the file should be output.

  • coord_format (tuple) – Format of the coordinate files.

  • with_img (bool) – If True, expect corresponding image files.

  • img_format (tuple, optional) – Allowed format that can be used.

tardis_em.utils.dataset.build_test_dataset(dataset_dir: str, dataset_no: int, stanford=False)

Standard builder for test datasets.

This module building a test dataset from training subset, by moving random files from train to test directory. Number of files is specified in %.

Files are saved in dir/test/imgs and dir/test/masks.

Parameters:
  • dataset_dir (str) – Directory with train test folders.

  • dataset_no (int) – Number of datasets to iterate throw.

  • stanford (bool) – Marker for stanford S3DIS dataset

Environment setup

tardis_em.utils.setup_envir.build_new_dir(dir_: str)

Standard set-up for creating new directory for storing all data.

Parameters:

dir (str) – Directory where folder will be build.

tardis_em.utils.setup_envir.build_temp_dir(dir_: str)

Standard set-up for creating new temp dir for cnn prediction.

Parameters:

dir (str) – Directory where folder will be build.

tardis_em.utils.setup_envir.clean_up(dir_: str)

Clean-up all temp files.

Parameters:

dir (str) – Main directory where temp dir is located.

tardis_em.utils.setup_envir.check_dir(dir_: str, train_img: str, train_mask: str, test_img: str, test_mask: str, with_img: bool, img_format: tuple | str, mask_format: tuple | str | None) bool

Check list used to evaluate if directory containing dataset for CNN.

Parameters:
  • dir (str) – Main directory with all files.

  • train_img (str) – Directory name with images for training.

  • train_mask (str) – Directory name with mask images for training.

  • img_format (tuple, str) – Allowed image format.

  • test_img (str) – Directory name with images for validation.

  • test_mask (str) – Directory name with mask images for validation.

  • mask_format (tuple, str) – Allowed mask image format.

  • with_img (bool) – GraphFormer bool value for training with/without images.

Returns:

Bool value indicating detection of the correct structure dataset

Return type:

bool