diff --git a/clinica/iotools/utils/data_handling/__init__.py b/clinica/iotools/utils/data_handling/__init__.py index cd997b9eb..d61f317e5 100644 --- a/clinica/iotools/utils/data_handling/__init__.py +++ b/clinica/iotools/utils/data_handling/__init__.py @@ -1,8 +1,8 @@ from ._centering import ( + are_images_centered_around_origin_of_world_coordinate_system, center_all_nifti, center_nifti_origin, check_relative_volume_location_in_world_coordinate_system, - check_volume_location_in_world_coordinate_system, ) from ._files import create_subs_sess_list, write_list_of_files from ._merging import create_merge_file @@ -16,6 +16,6 @@ "compute_missing_processing", "create_subs_sess_list", "write_list_of_files", - "check_volume_location_in_world_coordinate_system", + "are_images_centered_around_origin_of_world_coordinate_system", "check_relative_volume_location_in_world_coordinate_system", ] diff --git a/clinica/iotools/utils/data_handling/_centering.py b/clinica/iotools/utils/data_handling/_centering.py index c41311fdd..bb6035614 100644 --- a/clinica/iotools/utils/data_handling/_centering.py +++ b/clinica/iotools/utils/data_handling/_centering.py @@ -8,7 +8,7 @@ __all__ = [ "center_nifti_origin", - "check_volume_location_in_world_coordinate_system", + "are_images_centered_around_origin_of_world_coordinate_system", "check_relative_volume_location_in_world_coordinate_system", "center_all_nifti", ] @@ -60,36 +60,32 @@ def _compute_qform(header: nib.Nifti1Header) -> np.ndarray: return qform -def check_volume_location_in_world_coordinate_system( - nifti_list: List[PathLike], - bids_dir: PathLike, +def are_images_centered_around_origin_of_world_coordinate_system( + images: Iterable[Path], + bids_dir: Path, modality: str = "t1w", - skip_question: bool = False, ) -> bool: """Check if images are centered around the origin of the world coordinate. Parameters ---------- - nifti_list : list of PathLike - List of path to nifti files. + images : Iterable of Path + The paths to nifti files. - bids_dir : PathLike - Path to bids directory associated with this check. + bids_dir : Path + The path to bids directory associated with this check. modality : str, optional The modality of the image. Default='t1w'. - skip_question : bool, optional - If True, assume answer is yes. Default=False. - Returns ------- bool : - True if they are centered, False otherwise + True if all images are centered, False otherwise. Warns ------ - If volume is not centered on origin of the world coordinate system + If at least one volume is not centered on origin of the world coordinate system. Notes ----- @@ -98,40 +94,25 @@ def check_volume_location_in_world_coordinate_system( When not centered, we warn the user of the problem propose to exit clinica to run clinica iotools center-nifti or to continue with the execution of the pipeline. """ - import click import numpy as np - bids_dir = Path(bids_dir) - list_non_centered_files = [ - Path(file) for file in nifti_list if not _is_centered(Path(file)) - ] - if len(list_non_centered_files) == 0: + from clinica.utils.stream import cprint + + non_centered_images = [image for image in images if not _is_centered(image)] + if len(non_centered_images) == 0: return True - centers = [ - _get_world_coordinate_of_center(file) for file in list_non_centered_files - ] + centers = [_get_world_coordinate_of_center(image) for image in non_centered_images] l2_norm = [np.linalg.norm(center, ord=2) for center in centers] - click.echo( + cprint( _build_warning_message( - list_non_centered_files, centers, l2_norm, bids_dir, modality - ) + non_centered_images, centers, l2_norm, bids_dir, modality + ), + lvl="warning", ) - if not skip_question: - _ask_for_confirmation() return False -def _ask_for_confirmation() -> None: - import sys - - import click - - if not click.confirm("Do you still want to launch the pipeline?"): - click.echo("Clinica will now exit...") - sys.exit(0) - - def _build_warning_message( non_centered_files: List[Path], centers: List[np.array], @@ -170,12 +151,11 @@ def _build_warning_message( def check_relative_volume_location_in_world_coordinate_system( label_1: str, - nifti_list1: List[PathLike], + nifti_list1: list[PathLike], label_2: str, - nifti_list2: List[PathLike], + nifti_list2: list[PathLike], bids_dir: PathLike, modality: str, - skip_question: bool = False, ): """Check if the NIfTI file list `nifti_list1` and `nifti_list2` provided in argument are not too far apart, otherwise coreg in SPM may fail. Norm between center of volumes of 2 files must be less than 80 mm. @@ -201,21 +181,15 @@ def check_relative_volume_location_in_world_coordinate_system( String that must be used in argument of: clinica iotools bids --modality (used in potential warning message). - - skip_question : bool, optional - Disable prompts for user input (default is False) """ - import warnings + from clinica.utils.stream import log_and_warn - from clinica.utils.stream import cprint - - warning_message = _build_warning_message_relative_volume_location( - label_1, nifti_list1, label_2, nifti_list2, bids_dir, modality - ) - cprint(msg=warning_message, lvl="warning") - warnings.warn(warning_message) - if not skip_question: - _ask_for_confirmation() + if ( + msg := _build_warning_message_relative_volume_location( + label_1, nifti_list1, label_2, nifti_list2, bids_dir, modality + ) + ) is not None: + log_and_warn(msg, UserWarning) def _build_warning_message_relative_volume_location( @@ -225,7 +199,7 @@ def _build_warning_message_relative_volume_location( nifti_list2: List[PathLike], bids_dir: PathLike, modality: str, -) -> str: +) -> Optional[str]: bids_dir = Path(bids_dir) file_couples = [(Path(f1), Path(f2)) for f1, f2 in zip(nifti_list1, nifti_list2)] df = pd.DataFrame( @@ -233,7 +207,7 @@ def _build_warning_message_relative_volume_location( columns=[label_1, label_2, "Relative distance"], ) if len(df) == 0: - return + return None warning_message = ( f"It appears that {len(df)} pairs of files have an important relative offset. " "SPM co-registration has a high probability to fail on these files:\n\n" @@ -391,8 +365,7 @@ def _is_centered(nii_volume: Path, threshold_l2: int = 50) -> bool: the volume did not exceed 100 mm. Above this distance, either the volume is either not segmented (SPM error), or the produced segmentation is wrong (not the shape of a brain anymore) """ - center = _get_world_coordinate_of_center(nii_volume) - if center is None: + if (center := _get_world_coordinate_of_center(nii_volume)) is None: raise ValueError( f"Unable to compute the world coordinates of center for image {nii_volume}." "Please verify the image data and header." diff --git a/clinica/pipelines/anatomical/freesurfer/t1/cli.py b/clinica/pipelines/anatomical/freesurfer/t1/cli.py index 37b22c5e9..bb85ef79e 100644 --- a/clinica/pipelines/anatomical/freesurfer/t1/cli.py +++ b/clinica/pipelines/anatomical/freesurfer/t1/cli.py @@ -29,7 +29,6 @@ @cli_param.option.subjects_sessions_tsv @cli_param.option.working_directory @cli_param.option.overwrite_outputs -@cli_param.option.yes @cli_param.option.atlas_path @option.global_option_group @option.n_procs @@ -44,7 +43,6 @@ def cli( subjects_sessions_tsv: Optional[str] = None, n_procs: Optional[int] = None, overwrite_outputs: bool = False, - yes: bool = False, atlas_path: Optional[str] = None, caps_name: Optional[str] = None, ) -> None: @@ -64,10 +62,7 @@ def cli( caps_directory=caps_directory, tsv_file=subjects_sessions_tsv, base_dir=working_directory, - parameters={ - "recon_all_args": recon_all_args, - "skip_question": yes, - }, + parameters={"recon_all_args": recon_all_args}, name=pipeline_name, overwrite_caps=overwrite_outputs, caps_name=caps_name, diff --git a/clinica/pipelines/anatomical/freesurfer/t1/pipeline.py b/clinica/pipelines/anatomical/freesurfer/t1/pipeline.py index f69d529d1..df42f330c 100644 --- a/clinica/pipelines/anatomical/freesurfer/t1/pipeline.py +++ b/clinica/pipelines/anatomical/freesurfer/t1/pipeline.py @@ -89,7 +89,7 @@ def _build_input_node(self): import nipype.pipeline.engine as npe from clinica.iotools.utils.data_handling import ( - check_volume_location_in_world_coordinate_system, + are_images_centered_around_origin_of_world_coordinate_system, ) from clinica.utils.exceptions import ClinicaException from clinica.utils.filemanip import ( @@ -155,10 +155,9 @@ def _build_input_node(self): synchronize=True, interface=nutil.IdentityInterface(fields=self.get_input_fields()), ) - check_volume_location_in_world_coordinate_system( - t1w_files, + are_images_centered_around_origin_of_world_coordinate_system( + [Path(f) for f in t1w_files], self.bids_directory, - skip_question=self.parameters["skip_question"], ) self.connect( diff --git a/clinica/pipelines/pet/volume/cli.py b/clinica/pipelines/pet/volume/cli.py index 78566eea3..b9b345977 100644 --- a/clinica/pipelines/pet/volume/cli.py +++ b/clinica/pipelines/pet/volume/cli.py @@ -23,7 +23,6 @@ @cli_param.option.reconstruction_method @cli_param.option.subjects_sessions_tsv @cli_param.option.working_directory -@cli_param.option.yes @option.global_option_group @option.n_procs @cli_param.option_group.advanced_pipeline_options @@ -74,7 +73,6 @@ def cli( subjects_sessions_tsv: Optional[str] = None, working_directory: Optional[str] = None, n_procs: Optional[int] = None, - yes: bool = False, ) -> None: """SPM-based pre-processing of PET images. @@ -106,7 +104,6 @@ def cli( "mask_threshold": mask_threshold, "pvc_mask_tissues": pvc_mask_tissues, "smooth": smooth, - "skip_question": yes, } pipeline = PETVolume( diff --git a/clinica/pipelines/pet/volume/pipeline.py b/clinica/pipelines/pet/volume/pipeline.py index bceb8ae2e..ec40930f4 100644 --- a/clinica/pipelines/pet/volume/pipeline.py +++ b/clinica/pipelines/pet/volume/pipeline.py @@ -232,7 +232,6 @@ def _build_input_node(self): pet_bids, self.bids_directory, self.parameters["acq_label"], - skip_question=self.parameters["skip_question"], ) # Save subjects to process in //participants.tsv diff --git a/clinica/pipelines/pet_surface/pet_surface_cli.py b/clinica/pipelines/pet_surface/pet_surface_cli.py index 76949b315..99e9e47fc 100644 --- a/clinica/pipelines/pet_surface/pet_surface_cli.py +++ b/clinica/pipelines/pet_surface/pet_surface_cli.py @@ -20,7 +20,6 @@ @cli_param.option.reconstruction_method @cli_param.option.subjects_sessions_tsv @cli_param.option.working_directory -@cli_param.option.yes @option.global_option_group @option.n_procs def cli( @@ -33,7 +32,6 @@ def cli( subjects_sessions_tsv: Optional[str] = None, working_directory: Optional[str] = None, n_procs: Optional[int] = None, - yes: bool = False, ) -> None: """Surface-based processing of PET images. @@ -61,7 +59,6 @@ def cli( "reconstruction_method": reconstruction_method, "pvc_psf_tsv": pvc_psf_tsv, "longitudinal": False, - "skip_question": yes, } pipeline = PetSurface( diff --git a/clinica/pipelines/pet_surface/pet_surface_longitudinal_cli.py b/clinica/pipelines/pet_surface/pet_surface_longitudinal_cli.py index 8bc24019e..fd2d8e358 100644 --- a/clinica/pipelines/pet_surface/pet_surface_longitudinal_cli.py +++ b/clinica/pipelines/pet_surface/pet_surface_longitudinal_cli.py @@ -19,7 +19,6 @@ @cli_param.option_group.common_pipelines_options @cli_param.option.subjects_sessions_tsv @cli_param.option.working_directory -@cli_param.option.yes @option.global_option_group @option.n_procs def cli( @@ -31,7 +30,6 @@ def cli( subjects_sessions_tsv: Optional[str] = None, working_directory: Optional[str] = None, n_procs: Optional[int] = None, - yes: bool = False, ) -> None: """Longitudinal surface-based processing of PET images. @@ -58,7 +56,6 @@ def cli( "suvr_reference_region": suvr_reference_region, "pvc_psf_tsv": pvc_psf_tsv, "longitudinal": True, - "skip_question": yes, } pipeline = PetSurface( diff --git a/clinica/pipelines/pet_surface/pet_surface_pipeline.py b/clinica/pipelines/pet_surface/pet_surface_pipeline.py index 54046a037..803c54a8c 100644 --- a/clinica/pipelines/pet_surface/pet_surface_pipeline.py +++ b/clinica/pipelines/pet_surface/pet_surface_pipeline.py @@ -142,7 +142,6 @@ def _build_input_node_longitudinal(self): read_parameters_node.inputs.pet, self.bids_directory, self.parameters["acq_label"], - skip_question=self.parameters["skip_question"], ) # fmt: off @@ -232,7 +231,6 @@ def _build_input_node_cross_sectional(self): read_parameters_node.inputs.pet, self.bids_directory, self.parameters["acq_label"], - skip_question=self.parameters["skip_question"], ) # fmt: off diff --git a/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py b/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py index 7fba06b85..f1aa00e3f 100644 --- a/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py +++ b/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py @@ -16,7 +16,6 @@ @cli_param.option_group.common_pipelines_options @cli_param.option.subjects_sessions_tsv @cli_param.option.working_directory -@cli_param.option.yes @option.global_option_group @option.n_procs @cli_param.option_group.advanced_pipeline_options @@ -37,7 +36,6 @@ def cli( subjects_sessions_tsv: Optional[str] = None, working_directory: Optional[str] = None, n_procs: Optional[int] = None, - yes: bool = False, caps_name: Optional[str] = None, ) -> None: """Tissue segmentation, bias correction and spatial normalization to MNI space of T1w images with SPM. @@ -56,7 +54,6 @@ def cli( "tissue_probability_maps": tissue_probability_maps, "save_warped_unmodulated": not dont_save_warped_unmodulated, "save_warped_modulated": save_warped_modulated, - "skip_question": yes, } pipeline = T1VolumeTissueSegmentation( diff --git a/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_pipeline.py b/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_pipeline.py index 46f9f1c1c..ec4156919 100644 --- a/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_pipeline.py +++ b/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_pipeline.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import List from nipype import config @@ -73,7 +74,7 @@ def _build_input_node(self): import nipype.pipeline.engine as npe from clinica.iotools.utils.data_handling import ( - check_volume_location_in_world_coordinate_system, + are_images_centered_around_origin_of_world_coordinate_system, ) from clinica.utils.exceptions import ClinicaBIDSError, ClinicaException from clinica.utils.input_files import T1W_NII @@ -90,12 +91,10 @@ def _build_input_node(self): self.subjects = subjects self.sessions = sessions - check_volume_location_in_world_coordinate_system( - t1w_files, + are_images_centered_around_origin_of_world_coordinate_system( + [Path(f) for f in t1w_files], self.bids_directory, - skip_question=self.parameters["skip_question"], ) - if len(self.subjects): print_images_to_process(self.subjects, self.sessions) cprint("The pipeline will last approximately 10 minutes per image.") diff --git a/clinica/pydra/t1_volume/tasks.py b/clinica/pydra/t1_volume/tasks.py index 9f78d3bcc..7082af01b 100644 --- a/clinica/pydra/t1_volume/tasks.py +++ b/clinica/pydra/t1_volume/tasks.py @@ -6,10 +6,9 @@ @task @annotate({"return": {"out_status": None}}) def task_volume_location_in_world_coordinate_system( - nifti_input: PathLike, - bids_dir: PathLike, + nifti_input: str, + bids_dir: str, modality: str = "t1w", - skip_question: bool = False, ) -> bool: """Check if images are centered around the origin of the world coordinate @@ -24,9 +23,6 @@ def task_volume_location_in_world_coordinate_system( modality: str, optional the modality of the image. Default="t1w". - skip_question: bool, optional - if True, assume answer is yes. Default=False. - Returns ------- bool @@ -36,14 +32,16 @@ def task_volume_location_in_world_coordinate_system( ------ If volume is not centered on origin of the world coordinate system """ + from pathlib import Path + from clinica.iotools.utils.data_handling import ( - check_volume_location_in_world_coordinate_system, + are_images_centered_around_origin_of_world_coordinate_system, ) - nifti_list = [str(nifti_input)] + nifti_list = [Path(nifti_input)] - return check_volume_location_in_world_coordinate_system( - nifti_list, bids_dir, modality, skip_question + return are_images_centered_around_origin_of_world_coordinate_system( + nifti_list, Path(bids_dir), modality ) diff --git a/docs/Pipelines/PET_Surface.md b/docs/Pipelines/PET_Surface.md index 49c7d8397..fdfaa8322 100644 --- a/docs/Pipelines/PET_Surface.md +++ b/docs/Pipelines/PET_Surface.md @@ -13,8 +13,8 @@ This pipeline performs several processing steps for the analysis of PET data on This pipeline relies mainly on tools from **[FreeSurfer](https://surfer.nmr.mgh.harvard.edu/)** and **[PETPVC](https://github.com/UCL/PETPVC)** [[Thomas et al., 2016](https://doi.org/10.1088/0031-9155/61/22/7975)]. !!! note "Clinica & BIDS specifications for PET modality" - Since Clinica `v0.6`, PET data following the official specifications in BIDS version 1.6.0 are now compatible with Clinica. - See [BIDS](../../BIDS) page for more information. + Since Clinica `v0.6`, PET data following the official specifications in BIDS version `1.6.0` are now compatible with Clinica. + See [BIDS](../BIDS.md) page for more information. ## Prerequisite @@ -40,10 +40,15 @@ where: - `BIDS_DIRECTORY` is the input folder containing the dataset in a [BIDS](../BIDS.md) hierarchy. - `CAPS_DIRECTORY` acts both as an input folder (where the results of the `t1-freesurfer` pipeline are stored) and as the output folder containing the results in a [CAPS](../CAPS/Introduction.md) hierarchy. - `ACQ_LABEL` is the label given to the PET acquisition, specifying the tracer used (`trc-`). -- The reference region is used to perform intensity normalization (i.e. dividing each voxel of the image by the average uptake in this region) resulting in a standardized uptake value ratio (SUVR) map. - It can be `cerebellumPons` or `cerebellumPons2` (used for amyloid tracers) or `pons` or `pons2` (used for FDG). +- The reference region is used to perform intensity normalization (i.e. dividing each voxel of the image by the average uptake in this region) resulting in a [standardized uptake value ratio (SUVR)](../glossary.md#suvr) map. It can be `cerebellumPons` or `cerebellumPons2` (used for amyloid tracers) or `pons` or `pons2` (used for FDG). - `PVC_PSF_TSV` is the TSV file containing the `psf_x`, `psf_y` and `psf_z` of the PSF for each PET image. It is expected to be generated by the user. More explanation is given in [PET Introduction](./PET_Introduction.md) page. +!!! warning "Centering BIDS nifti" + The intra-subject registration of the PET image into the space of the subject’s T1-weighted MR image is very likely to fail if the images have important relative offsets. + In this situation, Clinica will give a warning displaying a command that should be run in order to generate a new BIDS directory with all images centered. + This relies on the IOTool [center-nifti](../IO.md#center-nifti---center-nifti-files-of-a-bids-directory). + It is highly recommended to follow this recommendation but Clinica won't force you to do so. + !!! info Since the release of Clinica v0.3.8, the handling of PSF information has changed. In previous versions of Clinica, each BIDS-PET image had to contain a JSON file with the `EffectiveResolutionInPlane` and `EffectiveResolutionAxial` fields corresponding to the PSF in mm. diff --git a/docs/Pipelines/PET_Volume.md b/docs/Pipelines/PET_Volume.md index 5ab680266..af84caf19 100644 --- a/docs/Pipelines/PET_Volume.md +++ b/docs/Pipelines/PET_Volume.md @@ -11,7 +11,7 @@ This pipeline performs several processing steps on [PET](../glossary.md#pet) dat The list of available atlases can be found [here](../Atlases.md). !!! note "Clinica & BIDS specifications for PET modality" - Since Clinica `v0.6`, PET data following the official specifications in BIDS version 1.6.0 are now compatible with Clinica. + Since Clinica `v0.6`, PET data following the official specifications in BIDS version `1.6.0` are now compatible with Clinica. See [BIDS](../BIDS.md) page for more information. ## Prerequisite @@ -54,6 +54,12 @@ Pipeline options: When running the `pet-volume` pipeline, clinica will raise an error if more than one image matches the criteria provided through the command line. To avoid that, it is important to specify values for these options such that a single image is selected per subject and session. +!!! warning "Centering BIDS nifti" + The intra-subject registration of the PET image into the space of the subject’s T1-weighted MR image is very likely to fail if the images have important relative offsets. + In this situation, Clinica will give a warning displaying a command that should be run in order to generate a new BIDS directory with all images centered. + This relies on the IOTool [center-nifti](../IO.md#center-nifti---center-nifti-files-of-a-bids-directory). + It is highly recommended to follow this recommendation but Clinica won't force you to do so. + !!! info Since the release of Clinica v0.3.8, the handling of PSF information in the TSV file has changed: `fwhm_x`, `fwhm_y`, `fwhm_z` columns have been replaced by `psf_x`, `psf_y`, `psf_z` and the `acq_label` column has been added. Additionally, the [SUVR](../glossary.md#suvr) reference region is now a compulsory argument: it will be easier for you to modify Clinica if you want to add a custom reference region ([PET Introduction](../PET_Introduction) page). diff --git a/docs/Pipelines/T1_FreeSurfer.md b/docs/Pipelines/T1_FreeSurfer.md index e056c8840..3675f9437 100644 --- a/docs/Pipelines/T1_FreeSurfer.md +++ b/docs/Pipelines/T1_FreeSurfer.md @@ -18,8 +18,8 @@ clinica run t1-freesurfer [OPTIONS] BIDS_DIRECTORY CAPS_DIRECTORY where: -- `BIDS_DIRECTORY` is the input folder containing the dataset in a [BIDS](../../BIDS) hierarchy. -- `CAPS_DIRECTORY` is the output folder containing the results in a [CAPS](../../CAPS/Introduction) hierarchy. +- `BIDS_DIRECTORY` is the input folder containing the dataset in a [BIDS](../BIDS.md) hierarchy. +- `CAPS_DIRECTORY` is the output folder containing the results in a [CAPS](../CAPS/Introduction.md) hierarchy. If you want to run the pipeline on a subset of your BIDS dataset, you can use the `-tsv` flag to specify in a TSV file the participants belonging to your subset. @@ -39,11 +39,15 @@ This can be achieved with the `--caps-name` option. The provided name will appea !!! note If you wish to obtain your results with another atlas, you can specify the option -ap/--atlas_path with the path to the atlas folder. Your atlas will need to be in FreeSurfer `gcs` format (e.g `hemisphere.atlasname_6p0.gcs`). The results will be stored in the same folder as the original results (additional files in `labels`, `stats` and `regional measures`). +!!! warning "Centering BIDS nifti" + If the images from the `BIDS_DIRECTORY` are not centered, Clinica will give a warning because this can be an issue **if** later processing steps involve SPM (for instance if you are planning to run [pet-surface](./PET_Surface.md) afterwards). + The warning message will contain a suggestion of a command to be run on your `BIDS_DIRECTORY` in order to generate a new BIDS dataset with images centered. This relies on the IOTool [center-nifti](../IO.md#center-nifti---center-nifti-files-of-a-bids-directory). + It is highly recommended to follow this recommendation but Clinica won't force you to do so. + ## Outputs -Results are stored in the following folder of the -[CAPS hierarchy](../../CAPS/Specifications/#t1-freesurfer-freesurfer-based-processing-of-t1-weighted-mr-images): -`subjects///t1/freesurfer_cross_sectional`. +Results are stored in the following folder of the [CAPS hierarchy](../CAPS/Specifications.md/#t1-freesurfer---freesurfer-based-processing-of-t1-weighted-mr-images): `subjects///t1/freesurfer_cross_sectional`. + This folder contains the standard output structure of the `recon-all` command, i.e. folders such as `label/`, `mri/`, `surf/`, etc. Among the files generated by FreeSurfer, you may be interested in the following outputs: @@ -52,8 +56,7 @@ Among the files generated by FreeSurfer, you may be interested in the following - `*/mri/wm.mgz`: white matter mask - `*/mri/brainmask.mgz`: skull-stripped volume - `*/surf/{l|r}h.white`: white surface between white matter and gray matter -- `*/surf/{l|r}h.pial`: pial surface between gray matter and CSF - (where `*` stands for `_`) +- `*/surf/{l|r}h.pial`: pial surface between gray matter and CSF (where `*` stands for `_`) More details regarding the `recon-all` output files can be found on the [FreeSurfer website](https://surfer.nmr.mgh.harvard.edu/fswiki/ReconAllOutputFiles). diff --git a/docs/Pipelines/T1_Volume.md b/docs/Pipelines/T1_Volume.md index 810d2b28c..8fa6ade18 100644 --- a/docs/Pipelines/T1_Volume.md +++ b/docs/Pipelines/T1_Volume.md @@ -35,18 +35,23 @@ clinica run t1-volume [OPTIONS] BIDS_DIRECTORY CAPS_DIRECTORY GROUP_LABEL where: -- `BIDS_DIRECTORY` is the input folder containing the dataset in a [BIDS](../../BIDS) hierarchy. -- `CAPS_DIRECTORY` is the output folder containing the results in a [CAPS](../../CAPS/Introduction) hierarchy. +- `BIDS_DIRECTORY` is the input folder containing the dataset in a [BIDS](../BIDS.md) hierarchy. +- `CAPS_DIRECTORY` is the output folder containing the results in a [CAPS](../CAPS/Introduction.md) hierarchy. - `GROUP_LABEL` is the user-defined identifier for the provided group of subjects. Pipeline options: -- `--smooth`: a list of integers specifying the different isomorphic full width at half maximum (FWHM) in millimeters used to smooth the images. Default value is: `8`. +- `--smooth`: a list of integers specifying the different isomorphic [full width at half maximum (FWHM)](../glossary.md#fwhm) in millimeters used to smooth the images. Default value is: `8`. - `--tissue_classes`: a list of integers (possible values range from 1 to 6) that indicates the tissue classes to save after segmentation (in order: gray matter (GM), white matter (WM), cerebrospinal fluid (CSF), bone, soft-tissue, air/background). Default value is: `1, 2, 3` (GM, WM and CSF are saved). - `--dartel_tissues`: a list of integers (possible values range from 1 to 6) that indicates the tissue classes to use for the Dartel template calculation (in order: GM, WM, CSF, bone, soft-tissue, air/background). Default value is: `1, 2, 3` (GM, WM and CSF are used). - `--modulate / --no-modulate`: a flag. If enabled, output images are modulated and volumes are preserved. If disabled, they are not modulated and concentrations are preserved. Default value: `--modulate`. - `--caps-name` : Specify the name of the CAPS dataset that will be created to store the outputs of the pipeline. This works if this CAPS dataset does not exist yet, otherwise the existing name will be kept. The provided name will appear in the `dataset_description.json` file, at the root of the CAPS folder (see [CAPS Specifications](../CAPS/Specifications.md#the-dataset_descriptionjson-file) for more details). +!!! warning "Centering BIDS nifti" + If the images from the `BIDS_DIRECTORY` are not centered, Clinica will give a warning because this can be an issue **if** later processing steps involve SPM (for instance if you are planning to run [pet-volume](./PET_Volume.md) afterwards). + The warning message will contain a suggestion of a command to be run on your `BIDS_DIRECTORY` in order to generate a new BIDS dataset with images centered. This relies on the IOTool [center-nifti](../IO.md#center-nifti---center-nifti-files-of-a-bids-directory). + It is highly recommended to follow this recommendation but Clinica won't force you to do so. + !!! note - The arguments common to all Clinica pipelines are described in [Interacting with clinica](../../InteractingWithClinica). - The creation of a new Dartel template, performed in the `t1-volume` pipeline, requires at least two images. diff --git a/test/unittests/iotools/utils/test_data_handling.py b/test/unittests/iotools/utils/test_data_handling.py index 6f4534a4e..1c00bc2d9 100644 --- a/test/unittests/iotools/utils/test_data_handling.py +++ b/test/unittests/iotools/utils/test_data_handling.py @@ -68,7 +68,6 @@ def test_check_relative_volume_location_in_world_coordinate_system(tmp_path, moc ], tmp_path / "bids", "T1W", - skip_question=True, )