Exemplo n.º 1
0
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description=
        "The MSD provides data as 4D Niftis with the modality being the first"
        " dimension. We think this may be cumbersome for some users and "
        "therefore expect 3D niftixs instead, with one file per modality. "
        "This utility will convert 4D MSD data into the format nnU-Net "
        "expects")
    parser.add_argument(
        "-i",
        help=
        "Input folder. Must point to a TaskXX_TASKNAME folder as downloaded from the MSD "
        "website",
        default=
        "C:/Research/IMA_on_segmentation/nnUnet/nnUNet/rawData/nnUNet_raw_data/Task05_Prostate"
    )
    parser.add_argument(
        "-p",
        required=False,
        default=default_num_threads,
        type=int,
        help=
        "Use this to specify how many processes are used to run the script. "
        "Default is %d" % default_num_threads)
    parser.add_argument(
        "-output_task_id",
        required=False,
        default=None,
        type=int,
        help=
        "If specified, this will overwrite the task id in the output folder. If unspecified, the "
        "task id of the input folder will be used.")
    args = parser.parse_args()

    crawl_and_remove_hidden_from_decathlon(args.i)

    split_4d(args.i, args.p, args.output_task_id)
Exemplo n.º 2
0
        raise ValueError("only 0 or 1 allowed for override")

    if no_preprocessing == 0:
        no_preprocessing = False
    elif no_preprocessing == 1:
        no_preprocessing = True
    else:
        raise ValueError("only 0 or 1 allowed for override")

    if use_splitted == 0:
        use_splitted = False
    elif use_splitted == 1:
        use_splitted = True
    else:
        raise ValueError("only 0 or 1 allowed for use_splitted")

    if task == "all":
        all_tasks = subdirs(nnUNet_raw_data, prefix="Task", join=False)
        for t in all_tasks:
            crop(t, override=override, num_threads=processes_lowres)
            analyze_dataset(t, override=override, collect_intensityproperties=True, num_processes=processes_lowres)
            plan_and_preprocess(t, processes_lowres, processes_fullres, no_preprocessing)
    else:
        if not use_splitted or not isdir(join(nnUNet_raw_data, task)):
            print("splitting task ", task)
            split_4d(task)

        crop(task, override=override, num_threads=processes_lowres)
        analyze_dataset(task, override, collect_intensityproperties=True, num_processes=processes_lowres)
        plan_and_preprocess(task, processes_lowres, processes_fullres, no_preprocessing)