From 358891a5fe62d075ac9393b1897a5875dfe9dbba Mon Sep 17 00:00:00 2001 From: neuronflow Date: Sat, 23 Dec 2023 00:57:35 +0100 Subject: [PATCH] clean coreg Signed-off-by: neuronflow --- brainles_preprocessing/preprocessor.py | 34 +++++++++----------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/brainles_preprocessing/preprocessor.py b/brainles_preprocessing/preprocessor.py index f11fb8a..c581a2e 100644 --- a/brainles_preprocessing/preprocessor.py +++ b/brainles_preprocessing/preprocessor.py @@ -82,9 +82,17 @@ def run( registration_dir=coregistration_dir, moving_image_name=file_name, ) - self._save_coregistration( - coregistration_dir=coregistration_dir, - save_dir_coregistration=save_dir_coregistration, + + shutil.copyfile( + src=self.center_modality.input_path, + dst=os.path.join( + coregistration_dir, + f"native__{self.center_modality.modality_name}.nii.gz", + ) + + self._save_output( + src=coregistration_dir, + save_dir=save_dir_coregistration, ) # Register center modality to atlas @@ -195,27 +203,7 @@ def _save_output( dirs_exist_ok=True, ) - def _save_coregistration( - self, - coregistration_dir: str, - save_dir_coregistration: Optional[str], - ): - if save_dir_coregistration: - save_dir_coregistration = turbopath(save_dir_coregistration) - native_cm = os.path.join( - coregistration_dir, - f"native__{self.center_modality.modality_name}.nii.gz", - ) - shutil.copyfile( - src=self.center_modality.input_path, - dst=native_cm, - ) - shutil.copytree( - src=coregistration_dir, - dst=save_dir_coregistration, - dirs_exist_ok=True, - ) class PreprocessorGPU(Preprocessor):