Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FMAP conversion capability for ADNI #1119

Merged
merged 16 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion clinica/iotools/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,11 +888,15 @@ def run_dcm2niix(
completed_process = subprocess.run(command, capture_output=True)

if completed_process.returncode != 0:
if completed_process.stdout is not None:
output_message = completed_process.stdout.decode("utf-8")
else:
output_message = ""
cprint(
msg=(
"DICOM to BIDS conversion with dcm2niix failed:\n"
f"command: {' '.join(command)}\n"
f"{completed_process.stdout.decode('utf-8')}"
f"{output_message}"
),
lvl="warning",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _convert_adni_fdg_pet(

if subjects is None:
adni_merge = load_clinical_csv(csv_dir, "ADNIMERGE")

subjects = list(adni_merge.PTID.unique())
cprint(
"Calculating paths of FDG PET images. "
Expand All @@ -103,6 +102,7 @@ def _convert_adni_fdg_pet(
images = _compute_fdg_pet_paths(
source_dir, csv_dir, subjects, conversion_dir, preprocessing_step
)

cprint("Paths of FDG PET images found. Exporting images into BIDS ...")
modality = _get_modality_from_adni_preprocessing_step(preprocessing_step)
paths_to_bids(
Expand Down Expand Up @@ -172,6 +172,7 @@ def _compute_fdg_pet_paths(
from clinica.utils.pet import Tracer

pet_fdg_df = _get_pet_fdg_df(Path(csv_dir), subjects, preprocessing_step)

images = find_image_path(pet_fdg_df, source_dir, "FDG", "I", "Image_ID")
images.to_csv(
Path(conversion_dir) / f"{Tracer.FDG.value}_pet_paths.tsv",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ def compute_flair_paths(source_dir, csv_dir, subjs_list, conversion_dir):
# Loading needed .csv files
adni_merge = load_clinical_csv(csv_dir, "ADNIMERGE")
mayo_mri_qc = load_clinical_csv(csv_dir, "MAYOADIRL_MRI_IMAGEQC_12_08_15")
mayo_mri_qc = mayo_mri_qc[mayo_mri_qc.series_type == "AFL"]
mri_list = load_clinical_csv(csv_dir, "MRILIST")

mayo_mri_qc = mayo_mri_qc[mayo_mri_qc.series_type == "AFL"]

# Selecting FLAIR DTI images that are not MPR
mri_list = mri_list[mri_list.SEQUENCE.str.contains("flair", case=False, na=False)]
unwanted_sequences = ["_MPR_"]
Expand Down
Loading
Loading