def main(): args = download_parser().parse_args() if not args.no_models: model_path = models.main(args.model, args.install_path) if not args.no_amend_config: amend_cfg(new_model_path=model_path)
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
def main(): args = download_parser().parse_args() if not args.no_atlas: atlas_dir = args.install_path / "atlas" atlas_download.atlas_download(args.atlas, atlas_dir, args.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)
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)
def prep_models(args): ## if no model or weights, set default weights if args.trained_model is None and args.model_weights is None: logging.debug("No model or weights supplied, so using the default") config_file = source_files.source_custom_config() if not Path(config_file).exists(): logging.debug("Custom config does not exist, downloading models") model_path = model_download.main(args.model, args.install_path) amend_cfg(new_model_path=model_path) model_weights = get_model_weights(config_file) if model_weights is not "" and Path(model_weights).exists(): args.model_weights = model_weights else: logging.debug("Model weights do not exist, downloading") model_path = model_download.main(args.model, args.install_path) amend_cfg(new_model_path=model_path) model_weights = get_model_weights(config_file) args.model_weights = model_weights return args