Skip to content

Commit

Permalink
Remove entity pet in the middle of the filename as this was done in t…
Browse files Browse the repository at this point in the history
…he pipeline some time ago
  • Loading branch information
NicolasGensollen committed Dec 4, 2024
1 parent d046d10 commit 0492f90
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions clinica/utils/input_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def pet_linear_nii(
information = {
"pattern": Path("pet_linear")
/ _clean_pattern(
f"*{tracer_filter}_pet{space_filer}{description}{resolution_filter}{region_filter}_pet.nii.gz"
f"*{tracer_filter}{space_filer}{description}{resolution_filter}{region_filter}_pet.nii.gz"
),
"description": (
f"{'Cropped ' if space == 'mni' and not uncropped_image else ''}PET nifti image{resolution_description}"
Expand All @@ -741,7 +741,7 @@ def pet_linear_transformation_matrix(tracer: Union[str, Tracer]) -> dict:
tracer = Tracer(tracer)

return {
"pattern": Path("pet_linear") / f"*_trc-{tracer.value}_pet_space-T1w_rigid.mat",
"pattern": Path("pet_linear") / f"*_trc-{tracer.value}_space-T1w_rigid.mat",
"description": "Rigid transformation matrix between the PET and T1w images estimated with ANTs.",
"needed_pipeline": "pet-linear",
}
Expand Down
6 changes: 3 additions & 3 deletions clinica/utils/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ def _build_pet_linear(directory: Path, sub: str, ses: str, config: dict) -> None
/ sub
/ ses
/ "pet_linear"
/ f"{sub}_{ses}_trc-{tracer.value}_pet_space-T1w_pet.nii.gz"
/ f"{sub}_{ses}_trc-{tracer.value}_space-T1w_pet.nii.gz"
).touch()
for filename in (
f"{sub}_{ses}_trc-{tracer.value}_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-{suvr.value}_pet.nii.gz",
f"{sub}_{ses}_trc-{tracer.value}_pet_space-T1w_rigid.mat",
f"{sub}_{ses}_trc-{tracer.value}_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-{suvr.value}_pet.nii.gz",
f"{sub}_{ses}_trc-{tracer.value}_space-T1w_rigid.mat",
):
(directory / "subjects" / sub / ses / "pet_linear" / filename).touch()

Expand Down
26 changes: 13 additions & 13 deletions test/unittests/pipelines/pet/test_pet_linear_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,24 @@ def test_pet_linear_get_processed_visits(tmp_path, mocker):
├── sub-01
│ ├── ses-M000
│ │ └── pet_linear
│ │ ├── sub-01_ses-M000_trc-18FAV45_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
│ │ └── sub-01_ses-M000_trc-18FAV45_pet_space-T1w_rigid.mat
│ │ ├── sub-01_ses-M000_trc-18FAV45_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
│ │ └── sub-01_ses-M000_trc-18FAV45_space-T1w_rigid.mat
│ └── ses-M006
│ └── pet_linear
│ ├── sub-01_ses-M006_trc-18FAV45_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
│ ├── sub-01_ses-M006_trc-18FAV45_pet_space-T1w_rigid.mat
│ ├── sub-01_ses-M006_trc-18FFDG_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons_pet.nii.gz
│ └── sub-01_ses-M006_trc-18FFDG_pet_space-T1w_rigid.mat
│ ├── sub-01_ses-M006_trc-18FAV45_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
│ ├── sub-01_ses-M006_trc-18FAV45_space-T1w_rigid.mat
│ ├── sub-01_ses-M006_trc-18FFDG_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons_pet.nii.gz
│ └── sub-01_ses-M006_trc-18FFDG_space-T1w_rigid.mat
└── sub-02
├── ses-M000
│ └── pet_linear
│ ├── sub-02_ses-M000_trc-18FFDG_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons_pet.nii.gz
│ ├── sub-02_ses-M000_trc-18FFDG_pet_space-T1w_pet.nii.gz
│ └── sub-02_ses-M000_trc-18FFDG_pet_space-T1w_rigid.mat
│ ├── sub-02_ses-M000_trc-18FFDG_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons_pet.nii.gz
│ ├── sub-02_ses-M000_trc-18FFDG_space-T1w_pet.nii.gz
│ └── sub-02_ses-M000_trc-18FFDG_space-T1w_rigid.mat
└── ses-M006
└── pet_linear
├── sub-02_ses-M006_trc-18FAV45_pet_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
└── sub-02_ses-M006_trc-18FAV45_pet_space-T1w_rigid.mat
├── sub-02_ses-M006_trc-18FAV45_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_suvr-pons2_pet.nii.gz
└── sub-02_ses-M006_trc-18FAV45_space-T1w_rigid.mat
And make sure that a PETLinear pipeline with tracer 18FFDG et pons SUVR will only consider
(sub-01, ses-M006) and (sub-02, ses-M000) as already processed. The other folders contain
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_pet_linear_get_processed_visits(tmp_path, mocker):
/ "sub-01"
/ "ses-M006"
/ "pet_linear"
/ "sub-01_ses-M006_trc-18FFDG_pet_space-T1w_pet.nii.gz"
/ "sub-01_ses-M006_trc-18FFDG_space-T1w_pet.nii.gz"
).unlink()
pipeline = PETLinear(
bids_directory=str(bids),
Expand Down Expand Up @@ -186,7 +186,7 @@ def test_pet_linear_get_processed_visits(tmp_path, mocker):
/ "sub-01"
/ "ses-M006"
/ "pet_linear"
/ "sub-01_ses-M006_trc-18FFDG_pet_space-T1w_rigid.mat"
/ "sub-01_ses-M006_trc-18FFDG_space-T1w_rigid.mat"
).unlink()

# The corresponding visit is not considered as "processed" anymore because the transformation is
Expand Down
10 changes: 5 additions & 5 deletions test/unittests/utils/test_input_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_dwi_dti_query_error():
"Cropped PET nifti image affinely registered to the MNI152NLin2009cSym "
"template resulting from the pet-linear pipeline"
),
"pet_linear/*_pet_space-MNI152NLin2009cSym_desc-Crop*_pet.nii.gz",
"pet_linear/*_space-MNI152NLin2009cSym_desc-Crop*_pet.nii.gz",
),
(
{
Expand All @@ -108,7 +108,7 @@ def test_dwi_dti_query_error():
"Cropped PET nifti image obtained with tracer 18FFDG affinely registered to the "
"MNI152NLin2009cSym template resulting from the pet-linear pipeline"
),
"pet_linear/*_trc-18FFDG_pet_space-MNI152NLin2009cSym_desc-Crop*_pet.nii.gz",
"pet_linear/*_trc-18FFDG_space-MNI152NLin2009cSym_desc-Crop*_pet.nii.gz",
),
(
{
Expand All @@ -121,7 +121,7 @@ def test_dwi_dti_query_error():
"PET nifti image of resolution 2x2x2 obtained with tracer 18FAV45 for SUVR region "
"pons affinely registered to the MNI152NLin2009cSym template resulting from the pet-linear pipeline"
),
"pet_linear/*_trc-18FAV45_pet_space-MNI152NLin2009cSym*_res-2x2x2_suvr-pons_pet.nii.gz",
"pet_linear/*_trc-18FAV45_space-MNI152NLin2009cSym*_res-2x2x2_suvr-pons_pet.nii.gz",
),
(
{
Expand All @@ -133,7 +133,7 @@ def test_dwi_dti_query_error():
"PET nifti image of resolution 2x2x2 for SUVR region pons2 affinely "
"registered to the associated T1w image resulting from the pet-linear pipeline"
),
"pet_linear/*_pet_space-T1w*_res-2x2x2_suvr-pons2_pet.nii.gz",
"pet_linear/*_space-T1w*_res-2x2x2_suvr-pons2_pet.nii.gz",
),
(
{
Expand All @@ -144,7 +144,7 @@ def test_dwi_dti_query_error():
"PET nifti image obtained with tracer 18FFDG affinely registered to the "
"associated T1w image resulting from the pet-linear pipeline"
),
"pet_linear/*_trc-18FFDG_pet_space-T1w*_pet.nii.gz",
"pet_linear/*_trc-18FFDG_space-T1w*_pet.nii.gz",
),
],
)
Expand Down

0 comments on commit 0492f90

Please sign in to comment.