def run_adni2bids(input_dir: PathLike, output_dir: PathLike,
                  ref_dir: PathLike) -> None:
    from clinica.iotools.converters.adni_to_bids.adni_to_bids import AdniToBids

    # Arrange
    clinical_data_directory = input_dir / "clinical_data"
    dataset_directory = input_dir / "unorganized_data"
    subjects_list = input_dir / "subjects.txt"
    modalities = [
        "T1", "PET_FDG", "PET_AMYLOID", "PET_TAU", "DWI", "FLAIR", "fMRI"
    ]
    # Act
    adni_to_bids = AdniToBids()
    adni_to_bids.check_adni_dependencies()
    adni_to_bids.convert_images(
        dataset_directory,
        clinical_data_directory,
        output_dir / "bids",
        subjects_list,
        modalities,
    )
    adni_to_bids.convert_clinical_data(clinical_data_directory,
                                       output_dir / "bids")
    # Assert
    compare_folders(output_dir / "bids", ref_dir / "bids", output_dir)
Beispiel #2
0
def test_run_Adni2Bids(cmdopt):
    from os.path import abspath, dirname, join

    from clinica.iotools.converters.adni_to_bids.adni_to_bids import AdniToBids

    root = join(dirname(abspath(__file__)), pardir, pardir, "data", "Adni2Bids")

    clean_folder(join(root, "out", "bids"), recreate=True)

    adni_to_bids = AdniToBids()
    adni_to_bids.check_adni_dependencies()

    dataset_directory = join(root, "in", "unorganized_data")
    clinical_data_directory = join(root, "in", "clinical_data")
    bids_directory = join(root, "out", "bids")
    subjects_list = join(root, "in", "subjects.txt")
    modalities = ["T1", "PET_FDG", "PET_AMYLOID", "PET_TAU", "DWI", "FLAIR", "fMRI"]
    adni_to_bids.convert_images(
        dataset_directory,
        clinical_data_directory,
        bids_directory,
        subjects_list,
        modalities,
    )
    adni_to_bids.convert_clinical_data(clinical_data_directory, bids_directory)
    # Generate tree of output files
    compare_folders(join(root, "out"), join(root, "ref"), shared_folder_name="bids")
    clean_folder(join(root, "out", "bids"), recreate=True)
def run_habs_to_bids(input_dir: Path, output_dir: Path, ref_dir: Path):
    from click.testing import CliRunner

    from clinica.iotools.converters.habs_to_bids.habs_to_bids_cli import cli

    runner = CliRunner()
    result = runner.invoke(cli, [str(input_dir), str(output_dir)])

    assert result.exit_code == 0
    compare_folders(output_dir, ref_dir, output_dir)
def run_oasis3tobids(input_dir: PathLike, output_dir: PathLike,
                     ref_dir: PathLike) -> None:
    from clinica.iotools.converters.oasis3_to_bids.oasis3_to_bids import convert_images

    # Arrange
    clinical_data_directory = input_dir / "clinical_data"
    # Act
    convert_images(input_dir / "unorganized", output_dir / "bids",
                   clinical_data_directory)
    # Assert
    compare_folders(output_dir / "bids", ref_dir / "bids", output_dir)
def run_aibl2bids(input_dir: PathLike, output_dir: PathLike,
                  ref_dir: PathLike) -> None:
    from clinica.iotools.converters.aibl_to_bids.aibl_to_bids import (
        convert_clinical_data,
        convert_images,
    )

    # Arrange
    clinical_data_directory = input_dir / "Data_extract_3.2.5"
    dataset_directory = input_dir / "unorganized_data"
    # Act
    convert_images(
        dataset_directory,
        clinical_data_directory,
        output_dir / "bids",
    )
    convert_clinical_data(output_dir / "bids", clinical_data_directory)
    # Assert
    compare_folders(output_dir / "bids", ref_dir / "bids", output_dir)
Beispiel #6
0
def test_run_Oasis2Bids(cmdopt):
    from os.path import abspath, dirname, join

    from clinica.iotools.converters.oasis_to_bids.oasis_to_bids import OasisToBids

    root = join(dirname(abspath(__file__)), pardir, pardir, "data", "Oasis2Bids")

    clean_folder(join(root, "out", "bids"), recreate=True)

    # Data location
    dataset_directory = join(root, "in", "unorganized")
    bids_directory = join(root, "out", "bids")
    clinical_data_directory = join(root, "in", "clinical_data")

    oasis_to_bids = OasisToBids()
    oasis_to_bids.convert_images(dataset_directory, bids_directory)
    oasis_to_bids.convert_clinical_data(clinical_data_directory, bids_directory)

    compare_folders(join(root, "out"), join(root, "ref"), shared_folder_name="bids")
    clean_folder(join(root, "out", "bids"), recreate=True)
Beispiel #7
0
def test_run_Aibl2Bids(cmdopt):
    from os.path import abspath, dirname, join

    from clinica.iotools.converters.aibl_to_bids.aibl_to_bids import (
        convert_clinical_data,
        convert_images,
    )

    root = dirname(abspath(join(abspath(__file__), pardir, pardir)))
    root = join(root, "data", "Aibl2Bids")

    dataset_directory = join(root, "in", "unorganized_data")
    clinical_data_directory = join(root, "in", "Data_extract_3.2.5")
    bids_directory = join(root, "out", "bids")

    clean_folder(join(root, "out", "bids"), recreate=True)

    # Perform conversion of dataset
    convert_images(dataset_directory, clinical_data_directory, bids_directory)
    convert_clinical_data(bids_directory, clinical_data_directory)

    # Evaluate difference between ref and out
    compare_folders(join(root, "out"), join(root, "ref"), shared_folder_name="bids")
    clean_folder(join(root, "out", "bids"), recreate=True)