utils module

utils.check_gpu_memory()[source]
utils.configure_logger(rank, log_path=None)[source]
utils.get_latest_run_version_ckpt_epoch_no(lightning_logs_dir='./logs/lightning_logs', run_version=None)[source]

Function to get the latest run version, checkpoint and epoch number

Parameters:
  • lightning_logs_dir (str, optional) – Path for the checkpoints_dir. Defaults to “./logs/lightning_logs”.

  • run_version (int, optional) – Version number. Defaults to None.

Raises:

ValueError – Error, no checkpoint found in checkpoints_dir

Returns:

The latest run version, checkpoint

Return type:

_type_

utils.is_master(args)[source]
utils.sample_stack(stack, rows=8, cols=8, start_with=20, map='gray', title='Visualization', show='False', path_out_images='./results/')[source]
utils.save_configure(args)[source]
utils.save_nifti(in_image, name, path_out_images='./results')[source]

Function to save a nifti image from a torch tensor

Parameters:
  • in_image (torch.Tensor) – Input image as a torch tensor

  • nome (str) – name of the file

  • path_out_images (str, optional) – Path where image going to save. Defaults to ‘./results’.