:param target_shape_constraint: target voxels :return: constrained x
(ground_truth, mask, eps, num_steps=1)
| 359 | return betas |
| 360 | |
| 361 | def get_constrain_function(ground_truth, mask, eps, num_steps=1): |
| 362 | ''' |
| 363 | |
| 364 | :param target_shape_constraint: target voxels |
| 365 | :return: constrained x |
| 366 | ''' |
| 367 | # eps_all = list(reversed(np.linspace(0,np.float_power(eps, 1/2), 500)**2)) |
| 368 | eps_all = list(reversed(np.linspace(0, np.sqrt(eps), 1000)**2 )) |
| 369 | def constrain_fn(x, t): |
| 370 | eps_ = eps_all[t] if (t<1000) else 0 |
| 371 | for _ in range(num_steps): |
| 372 | x = x - eps_ * ((x - ground_truth) * mask) |
| 373 | |
| 374 | |
| 375 | return x |
| 376 | return constrain_fn |
| 377 | |
| 378 | |
| 379 | ############################################################################# |
nothing calls this directly
no outgoing calls
no test coverage detected