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

[FIX] Ignore real and imaginary scans in ADNI #1029

Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 7 additions & 3 deletions clinica/iotools/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,10 @@ def _build_dcm2niix_command(
bids_sidecar: bool = True,
) -> list:
"""Generate the dcm2niix command from user inputs."""
command = ["dcm2niix", "-w", "0", "-f", output_fmt, "-o", output_dir]
command = ["dcm2niix", "-w", "0", "-f", output_fmt, "-o", str(output_dir)]
command += ["-9", "-z", "y"] if compress else ["-z", "n"]
command += ["-b", "y", "-ba", "y"] if bids_sidecar else ["-b", "n"]
command += [input_dir]
command += [str(input_dir)]

return command

Expand Down Expand Up @@ -889,12 +889,16 @@ def run_dcm2niix(
cprint(
msg=(
"DICOM to BIDS conversion with dcm2niix failed:\n"
f"command: {command}\n"
f"command: {' '.join(command)}\n"
f"{completed_process.stdout.decode('utf-8')}"
),
lvl="warning",
)
return False
cprint(
f"DICOM to BIDS conversion with dcm2niix failed:\ncommand: {' '.join(command)}\n",
lvl="debug",
)
return True


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def convert_adni_flair(
If specified, it should be between 1 and the number of available CPUs.
Default=1.
"""
from os import path

import pandas as pd

from clinica.iotools.converters.adni_to_bids.adni_utils import (
load_clinical_csv,
paths_to_bids,
Expand All @@ -55,10 +51,11 @@ def convert_adni_flair(
subjects = list(adni_merge.PTID.unique())

cprint(
f"Calculating paths of FLAIR images. Output will be stored in {conversion_dir}."
f"Calculating paths of FLAIR images. Output will be stored in {conversion_dir}.",
lvl="info",
)
images = compute_flair_paths(source_dir, csv_dir, subjects, conversion_dir)
cprint("Paths of FLAIR images found. Exporting images into BIDS ...")
cprint("Paths of FLAIR images found. Exporting images into BIDS ...", lvl="info")
# flair_paths_to_bids(images, dest_dir)
paths_to_bids(
images, destination_dir, "flair", mod_to_update=mod_to_update, n_procs=n_procs
Expand Down
Loading
Loading