From 2196163e2b3d351bf058f2a1aa3675de04ea1843 Mon Sep 17 00:00:00 2001 From: neuronflow Date: Thu, 4 Apr 2024 22:56:18 +0200 Subject: [PATCH] create logger no matter whether output file exists Signed-off-by: neuronflow --- ereg/registration.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ereg/registration.py b/ereg/registration.py index 5f915b7..a0ba7fa 100644 --- a/ereg/registration.py +++ b/ereg/registration.py @@ -229,15 +229,14 @@ def resample_image( output_image (str): The output image. transform_file (str, optional): The transform file. Defaults to None. """ + if log_file is None: + # TODO this will create trouble for non ".nii.gz" file + log_file = output_image.replace(".nii.gz", ".log") + self._setup_logger(log_file, "resample") # check if output image exists if not os.path.exists(output_image): if transform_file is not None: - if log_file is None: - # TODO this will create trouble for non ".nii.gz" file - log_file = output_image.replace(".nii.gz", ".log") - self._setup_logger(log_file, "resample") - assert os.path.isfile(transform_file), "Transform file does not exist." transform_from_file = None try: