示例#1
0
def prep_registration(args, sample_name="amap"):
    logging.info("Checking whether the atlas exists")
    _, atlas_files_exist = check_atlas_install()
    atlas_dir = os.path.join(args.install_path, "atlas")
    if not atlas_files_exist:
        if args.download_path is None:
            atlas_download_path = os.path.join(temp_dir_path, "atlas.tar.gz")
        else:
            atlas_download_path = os.path.join(args.download_path,
                                               "atlas.tar.gz")
        if not args.no_atlas:
            logging.warning("Atlas does not exist, downloading.")
            atlas_download.main(args.atlas, atlas_dir, atlas_download_path)
        amend_cfg(new_atlas_folder=atlas_dir, atlas=args.atlas)

    if args.registration_config is None:
        args.registration_config = source_files.source_custom_config()
    args.target_brain_path = args.background_planes_path[0]
    args.sample_name = sample_name
    logging.debug("Making registration directory")
    ensure_directory_exists(args.paths.registration_output_folder)

    additional_images_downsample = {}
    for idx, images in enumerate(args.signal_planes_paths):
        channel = args.signal_ch_ids[idx]
        additional_images_downsample[f"channel_{channel}"] = images

    return args, additional_images_downsample
示例#2
0
def prep_registration(args):
    logging.info("Checking whether the atlas exists")
    _, atlas_files_exist = check_atlas_install()
    if not atlas_files_exist:
        logging.warning("Atlas does not exist, downloading.")
        if args.download_path is None:
            args.download_path = os.path.join(temp_dir_path, "atlas.tar.gz")
        atlas_download.main(args.atlas, args.install_path, args.download_path)
        amend_cfg(
            new_atlas_folder=args.install_path, atlas=args.atlas,
        )
    if args.registration_config is None:
        args.registration_config = source_files.source_custom_config()

    logging.debug("Making registration directory")
    ensure_directory_exists(args.registration_output_folder)

    logging.debug("Copying registration config to output directory")
    copy_registration_config(
        args.registration_config, args.registration_output_folder
    )

    additional_images_downsample = {}
    if args.downsample_images:
        for idx, images in enumerate(args.downsample_images):
            name = Path(images).name
            additional_images_downsample[name] = images

    return args, additional_images_downsample
示例#3
0
def main():
    args = download_parser().parse_args()
    if args.download_path is None:
        args.download_path = os.path.join(temp_dir_path, "atlas.tar.gz")
    if not args.no_atlas:
        atlas.main(args.atlas, args.install_path, args.download_path)
    if not args.no_amend_config:
        amend_cfg(
            new_atlas_folder=args.install_path, atlas=args.atlas,
        )
示例#4
0
def main():
    args = download_parser().parse_args()
    if args.download_path is None:
        atlas_download_path = os.path.join(temp_dir_path, "atlas.tar.gz")
    else:
        atlas_download_path = os.path.join(args.download_path, "atlas.tar.gz")
    if not args.no_atlas:
        atlas_dir = os.path.join(args.install_path, "atlas")
        atlas_download.main(args.atlas, atlas_dir, atlas_download_path)
    if not args.no_models:
        model_path = models.main(args.model, args.install_path)

    amend_cfg(new_atlas_folder=atlas_dir,
              atlas=args.atlas,
              new_model_path=model_path)