def just_denoise(arr, k=3, level=5, noise_std=None, coefs=None, supp=None, min_nscales=2): if np.iterable(k): level = len(k) if coefs is None: coefs = atrous.decompose(arr, level) if noise_std is None: if arr.ndim > 2: noise_std = atrous.estimate_sigma_mad(coefs[0], True) else: noise_std = atrous.estimate_sigma(arr, coefs) ## calculate support taking only positive coefficients (light sources) if supp is None: supp = atrous.get_support(coefs, np.array(k, _dtype_) * noise_std, modulus=False) structures = get_structures(coefs, supp) g = connectivity_graph(structures, min_nscales) #labels = reduce(lambda a,b:a+b, (n.labels for n in lib.flatten(g))) new_supp = supp_from_connectivity(g, level) return atrous.rec_with_support(coefs, new_supp)
def restore_object( object, coefs, min_level=0, ): supp = supp_from_obj(object, min_level) return atrous.rec_with_support(coefs, supp)