def __call__(self, **data_dict): for b in range(len(data_dict[self.data_key])): if np.random.uniform() < self.p_per_sample: data_dict[self.data_key][b] = augment_rician_noise( data_dict[self.data_key][b], noise_variance=self.noise_variance) return data_dict
def rician_noise_generator(generator, noise_variance=(0, 0.1)): ''' Adds rician noise with the given variance. The Noise of MRI data tends to have a rician distribution: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2254141/ ''' for data_dict in generator: assert "data" in list( data_dict.keys()), "your data generator needs to return a python dictionary with at least a 'data' key value pair" data_dict["data"] = augment_rician_noise(data_dict['data'], noise_variance=noise_variance) yield data_dict
def rician_noise_generator(generator, noise_variance=(0, 0.1)): ''' Adds rician noise with the given variance. The Noise of MRI data tends to have a rician distribution: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2254141/ ''' for data_dict in generator: assert "data" in list( data_dict.keys() ), "your data generator needs to return a python dictionary with at least a 'data' key value pair" data_dict["data"] = augment_rician_noise(data_dict['data'], noise_variance=noise_variance) yield data_dict
def __call__(self, **data_dict): data_dict["data"] = augment_rician_noise( data_dict['data'], noise_variance=self.noise_variance) return data_dict
def __call__(self, **data_dict): data_dict[self.data_key] = augment_rician_noise( data_dict[self.data_key], noise_variance=self.noise_variance) return data_dict