def get_to_process_with_atlases(caps_directory: str, subjects: list,
                                    sessions: list,
                                    atlas_dir_path: str) -> list:
        import itertools
        import os
        from pathlib import Path

        from clinica.utils.filemanip import extract_image_ids
        from clinica.utils.input_files import T1_FS_DESTRIEUX
        from clinica.utils.inputs import clinica_file_reader

        initial_list_to_process = []
        atlas_list = []
        for path in Path(atlas_dir_path).rglob("*rh*6p0.gcs"):
            atlas_name = path.name.split(".")[1].split("_")[0]
            atlas_list.append(atlas_name)

        if os.path.isdir(caps_directory):
            for atlas in atlas_list:

                atlas_info = dict({
                    "pattern":
                    "t1/freesurfer_cross_sectional/sub-*_ses-*/stats/rh." +
                    atlas + ".stats",
                    "description":
                    atlas + "-based segmentation",
                    "needed_pipeline":
                    "t1-freesurfer",
                })
                t1_freesurfer_output = clinica_file_reader(
                    subjects, sessions, caps_directory, T1_FS_DESTRIEUX, False)
                t1_freesurfer_files = clinica_file_reader(
                    subjects, sessions, caps_directory, atlas_info, False)

                image_ids = extract_image_ids(t1_freesurfer_files)
                image_ids_2 = extract_image_ids(t1_freesurfer_output)
                to_process = list(set(image_ids_2) - set(image_ids))
                initial_list_to_process.append(([atlas], to_process))

        list_to_process = []
        for i in initial_list_to_process:
            if list(itertools.product(i[0], i[1])) != []:
                list_to_process = list_to_process + list(
                    itertools.product(i[0], i[1]))
        return list_to_process
Ejemplo n.º 2
0
 def get_processed_images(caps_directory, subjects, sessions):
     import os
     from clinica.utils.inputs import clinica_file_reader
     from clinica.utils.input_files import T1W_LINEAR_CROPPED
     from clinica.utils.filemanip import extract_image_ids
     image_ids = []
     if os.path.isdir(caps_directory):
         cropped_files = clinica_file_reader(subjects, sessions,
                                             caps_directory,
                                             T1W_LINEAR_CROPPED, False)
         image_ids = extract_image_ids(cropped_files)
     return image_ids
Ejemplo n.º 3
0
 def get_processed_images(caps_directory, subjects, sessions):
     import os
     from clinica.utils.inputs import clinica_file_reader
     from clinica.utils.input_files import T1_FS_DESTRIEUX
     from clinica.utils.filemanip import extract_image_ids
     image_ids = []
     if os.path.isdir(caps_directory):
         t1_freesurfer_files = clinica_file_reader(subjects, sessions,
                                                   caps_directory,
                                                   T1_FS_DESTRIEUX, False)
         image_ids = extract_image_ids(t1_freesurfer_files)
     return image_ids
    def get_processed_images(caps_directory, subjects, sessions):
        import os

        from clinica.utils.filemanip import extract_image_ids
        from clinica.utils.input_files import DWI_PREPROC_NII
        from clinica.utils.inputs import clinica_file_reader

        image_ids = []
        if os.path.isdir(caps_directory):
            preproc_files = clinica_file_reader(subjects, sessions,
                                                caps_directory,
                                                DWI_PREPROC_NII, False)
            image_ids = extract_image_ids(preproc_files)
        return image_ids
Ejemplo n.º 5
0
    def get_processed_images(caps_directory, subjects, sessions):
        import os
        from clinica.utils.filemanip import extract_image_ids
        from clinica.utils.inputs import clinica_file_reader

        information = {
            "pattern":
            os.path.join(
                "t1_extensive",
                "*_*_space-Ixi549Space_desc-SkullStripped_T1w.nii*",
            ),
            "description":
            "Skull-stripped T1w in Ixi549Space space.",
            "needed_pipeline":
            "t1-volume-tissue-segmentation",
        }
        image_ids = []
        if os.path.isdir(caps_directory):
            skull_stripped_files = clinica_file_reader(subjects, sessions,
                                                       caps_directory,
                                                       information, False)
            image_ids = extract_image_ids(skull_stripped_files)
        return image_ids