From 1c9d3d5debfc9a08ebcf19dee18323d4050d022d Mon Sep 17 00:00:00 2001 From: NicolasGensollen Date: Mon, 7 Oct 2024 15:25:42 +0200 Subject: [PATCH] couple fxes --- clinica/pipelines/pet/engine.py | 4 +-- .../statistics_volume_pipeline.py | 28 +++++++++++-------- .../statistics_volume_correction_pipeline.py | 9 +++--- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/clinica/pipelines/pet/engine.py b/clinica/pipelines/pet/engine.py index 142f13cf8..1be5834f2 100644 --- a/clinica/pipelines/pet/engine.py +++ b/clinica/pipelines/pet/engine.py @@ -25,8 +25,8 @@ def _check_pipeline_parameters(self) -> None: def _get_pet_scans_query(self) -> QueryPattern: """Return the query to retrieve PET scans.""" - from clinica.utils.input_files import bids_pet_nii + from clinica.utils.input_files import get_pet_nifti - return bids_pet_nii( + return get_pet_nifti( self.parameters["acq_label"], self.parameters["reconstruction_method"] ) diff --git a/clinica/pipelines/statistics_volume/statistics_volume_pipeline.py b/clinica/pipelines/statistics_volume/statistics_volume_pipeline.py index e94d1cdc8..6713396ef 100644 --- a/clinica/pipelines/statistics_volume/statistics_volume_pipeline.py +++ b/clinica/pipelines/statistics_volume/statistics_volume_pipeline.py @@ -1,6 +1,11 @@ from typing import List from clinica.pipelines.engine import Pipeline +from clinica.utils.input_files import ( + QueryPattern, + QueryPatternName, + query_pattern_factory, +) from clinica.utils.pet import SUVRReferenceRegion, Tracer @@ -96,10 +101,6 @@ def _build_input_node(self): import nipype.pipeline.engine as npe from clinica.utils.exceptions import ClinicaException - from clinica.utils.input_files import ( - pet_volume_normalized_suvr_pet, - t1_volume_template_tpm_in_mni, - ) from clinica.utils.inputs import clinica_file_filter from clinica.utils.stream import cprint from clinica.utils.ux import print_begin_image, print_images_to_process @@ -117,8 +118,10 @@ def _build_input_node(self): ) self.parameters["measure_label"] = self.parameters["acq_label"].value - information_dict = pet_volume_normalized_suvr_pet( - acq_label=self.parameters["acq_label"], + pattern = query_pattern_factory( + QueryPatternName.PET_VOLUME_NORMALIZED_SUVR + )( + tracer=self.parameters["acq_label"], group_label=self.parameters["group_label_dartel"], suvr_reference_region=self.parameters["suvr_reference_region"], use_brainmasked_image=True, @@ -127,7 +130,9 @@ def _build_input_node(self): ) elif self.parameters["orig_input_data_volume"] == "t1-volume": self.parameters["measure_label"] = "graymatter" - information_dict = t1_volume_template_tpm_in_mni( + pattern = query_pattern_factory( + QueryPatternName.T1_VOLUME_TEMPLATE_TPM_IN_MNI + )( group_label=self.parameters["group_label_dartel"], tissue_number=1, modulation=True, @@ -141,17 +146,16 @@ def _build_input_node(self): ) # If custom file are grabbed, information of fwhm is irrelevant and should not appear on final filenames self.parameters["full_width_at_half_maximum"] = None - information_dict = { - "pattern": self.parameters["custom_file"], - "description": "custom file provided by user", - } + pattern = QueryPattern( + self.parameters["custom_file"], "custom file provided by user", "" + ) else: raise ValueError( f"Input data {self.parameters['orig_input_data_volume']} unknown." ) input_files, self.subjects, self.sessions = clinica_file_filter( - self.subjects, self.sessions, self.caps_directory, information_dict + self.subjects, self.sessions, self.caps_directory, pattern ) read_parameters_node = npe.Node( diff --git a/clinica/pipelines/statistics_volume_correction/statistics_volume_correction_pipeline.py b/clinica/pipelines/statistics_volume_correction/statistics_volume_correction_pipeline.py index e201ab4fc..379b1c0cd 100644 --- a/clinica/pipelines/statistics_volume_correction/statistics_volume_correction_pipeline.py +++ b/clinica/pipelines/statistics_volume_correction/statistics_volume_correction_pipeline.py @@ -43,15 +43,14 @@ def _build_input_node(self): import nipype.interfaces.utility as nutil import nipype.pipeline.engine as npe + from clinica.utils.input_files import QueryPattern from clinica.utils.inputs import clinica_group_reader t_map = clinica_group_reader( self.caps_directory, - { - "pattern": self.parameters["t_map"] + "*", - "description": "statistics t map", - "needed_pipeline": "statistics-volume", - }, + QueryPattern( + self.parameters["t_map"] + "*", "statistics t map", "statistics-volume" + ), ) read_parameters_node = npe.Node(