def build_dataset_from_input( transforms, dataset_config, initial_images, initial_kspaces, filenames_filter, data_root, pass_dictionaries, ): pass_h5s = None if initial_images is not None and initial_kspaces is not None: raise ValueError( f"initial_images and initial_kspaces are mutually exclusive. " f"Got {initial_images} and {initial_kspaces}.") if initial_images: pass_h5s = { "initial_image": (dataset_config.input_image_key, initial_images) } if initial_kspaces: pass_h5s = { "initial_kspace": (dataset_config.input_kspace_key, initial_kspaces) } dataset = build_dataset( root=data_root, filenames_filter=filenames_filter, transforms=transforms, pass_h5s=pass_h5s, pass_dictionaries=pass_dictionaries, **remove_keys(dataset_config, ["transforms", "lists"]), ) return dataset
def build_inference_transforms(env, mask_func, dataset_cfg): partial_build_mri_transforms = partial( build_mri_transforms, forward_operator=env.engine.forward_operator, backward_operator=env.engine.backward_operator, mask_func=mask_func, ) transforms = partial_build_mri_transforms( **remove_keys(dataset_cfg.transforms, "masking")) return transforms
def build_transforms_from_environment(env, dataset_config): mri_transforms_func = functools.partial( build_mri_transforms, forward_operator=env.engine.forward_operator, backward_operator=env.engine.backward_operator, mask_func=build_masking_function(**dataset_config.transforms.masking), ) transforms = mri_transforms_func(**remove_keys(dataset_config.transforms, "masking")) return transforms