spateo.external.CAST.CAST_Stack

Classes

Functions

get_range(sp_coords)

prelocate(coords_q, coords_r, cov_anchor_it, bleeding, ...)

Affine_GD(coords_query_it_raw, coords_ref_it, ...[, ...])

BSpline_GD(coords_q, coords_r, cov_anchor_it, ...[, ...])

J_cal(coords_q, coords_r, cov_mat[, bleeding, ...])

alpha_init(alpha_basis, it, dev)

dJ_dt_cal(coords_q, coords_r, diff_step, dev, ...)

dJ_dtheta_cal(xi, yi, dJ_dxy_mat, theta, dev[, ifrigid])

#dxy_da:

theta_renew(theta, dJ_dtheta, alpha[, ifrigid])

affine_trans_t(theta, coords_t)

torch_Bspline(uv, kl)

BSpline_GD_preparation(max_xy, mesh_size, dev, mesh_weight)

BSpline_GD_uv_ij_calculate(coords_query_it, delta, dev)

B_matrix(uv_t, kls_t)

get_dxy_ffd(ij, result_B_t, mesh, dJ_dxy_mat, ...)

BSpline_renew_coords(uv_t, kls_t, ij_t, mesh_trans)

reg_total_t(coords_q, coords_r, params_dist)

FFD_Bspline_apply_t(coords_q, params_dist[, round_t])

rescale_coords(coords_raw, graph_list[, rescale])

mesh_plot(mesh_t, coords_q_t[, mesh_trans_t])

plot_mid(coords_q, coords_r[, output_path, filename, ...])

corr_heat(coords_q, coords_r, corr, output_path[, ...])

prelocate_loss_plot(J_t, output_path[, prefix])

register_result(coords_q, coords_r, cov_anchor_t, ...)

affine_reg_params(it_theta, similarity_score, ...[, ...])

CAST_STACK_rough(coords_raw_list[, ifsquare, ...])

coords_raw_list: list of numpy arrays, each array is the coordinates of a layer

coords_minus_mean(coord_t)

coords_minus_min(coord_t)

max_minus_value(corr)

coords_minus_min_t(coord_t)

max_minus_value_t(corr)

corr_dist(query_np, ref_np[, nan_as])

region_detect(embed_dict_t, coords0[, k])

Module Contents

class spateo.external.CAST.CAST_Stack.reg_params[source]
dataname: str[source]
theta_r1: float = 0[source]
theta_r2: float = 0[source]
d_list: list[float] = [][source]
translation_params: list[float] = None[source]
mirror_t: list[float] = None[source]
alpha_basis: list[float] = [][source]
iterations: int = 500[source]
dist_penalty1: float = 0[source]
attention_params: list[float] = [][source]
mesh_trans_list: list[float] = [][source]
attention_region: list[float] = [][source]
attention_params_bs: list[float] = [][source]
mesh_weight: list[float] = [][source]
iterations_bs: list[float] = [][source]
alpha_basis_bs: list[float] = [][source]
meshsize: list[float] = [][source]
img_size_bs: list[float] = [][source]
dist_penalty2: list[float] = [][source]
PaddingRate_bs: float = 0[source]
bleeding: float = 500[source]
diff_step: float = 5[source]
min_qr2: float = 0[source]
mean_q: float = 0[source]
mean_r: float = 0[source]
gpu: int = 0[source]
device: str[source]
ifrigid: bool = False[source]
__post_init__()[source]
spateo.external.CAST.CAST_Stack.get_range(sp_coords)[source]
spateo.external.CAST.CAST_Stack.prelocate(coords_q, coords_r, cov_anchor_it, bleeding, output_path, d_list=[1, 2, 3], prefix='test', ifplot=True, index_list=None, translation_params=None, mirror_t=None)[source]
spateo.external.CAST.CAST_Stack.Affine_GD(coords_query_it_raw, coords_ref_it, cov_anchor_it, output_path, bleeding=500, dist_penalty=0, diff_step=50, alpha_basis=np.reshape(np.array([0, 0, 1 / 5, 2, 2]), [5, 1]), iterations=50, prefix='test', attention_params=[None, 3, 1, 0], scale_t=1, coords_log=False, index_list=None, mid_visual=False, early_stop_thres=1, ifrigid=False)[source]
spateo.external.CAST.CAST_Stack.BSpline_GD(coords_q, coords_r, cov_anchor_it, iterations, output_path, bleeding, dist_penalty=0, alpha_basis=1000, diff_step=50, mesh_size=5, prefix='test', mesh_weight=None, attention_params=[None, 3, 1, 0], scale_t=1, coords_log=False, index_list=None, mid_visual=False, max_xy=None, renew_mesh_trans=True, restriction_t=0.5)[source]
spateo.external.CAST.CAST_Stack.J_cal(coords_q, coords_r, cov_mat, bleeding=10, dist_penalty=0, attention_params=[None, 3, 1, 0])[source]
spateo.external.CAST.CAST_Stack.alpha_init(alpha_basis, it, dev)[source]
spateo.external.CAST.CAST_Stack.dJ_dt_cal(coords_q, coords_r, diff_step, dev, cov_anchor_it, bleeding, dist_penalty, attention_params)[source]
spateo.external.CAST.CAST_Stack.dJ_dtheta_cal(xi, yi, dJ_dxy_mat, theta, dev, ifrigid=False)[source]

#dxy_da: #{x * cos(rad_phi), x * sin(rad_phi)} #dxy_dd: #{-y * sin(rad_phi), y * cos(rad_phi)} #dxy_dphi: #{-d * y * cos(rad_phi) - a * x * sin(rad_phi), a * x * cos(rad_phi) - d * y * sin(rad_phi)} #dxy_dt1: #{1, 0} #dxy_dt2: #{0, 1}

# when we set d = a (rigid): #dxy_da #{x * cos(rad_phi) - y * sin(rad_phi), y * cos(rad_phi) + x * sin(rad_phi)} #dxy_dd - set as the same value as dxy_da #{x * cos(rad_phi) - y * sin(rad_phi), y * cos(rad_phi) + x * sin(rad_phi)} #dxy_dphi #{-a * y * cos(rad_phi) - a * x * sin(rad_phi), a * x * cos(rad_phi) - a * y * sin(rad_phi)}

spateo.external.CAST.CAST_Stack.theta_renew(theta, dJ_dtheta, alpha, ifrigid=False)[source]
spateo.external.CAST.CAST_Stack.affine_trans_t(theta, coords_t)[source]
spateo.external.CAST.CAST_Stack.torch_Bspline(uv, kl)[source]
spateo.external.CAST.CAST_Stack.BSpline_GD_preparation(max_xy, mesh_size, dev, mesh_weight)[source]
spateo.external.CAST.CAST_Stack.BSpline_GD_uv_ij_calculate(coords_query_it, delta, dev)[source]
spateo.external.CAST.CAST_Stack.B_matrix(uv_t, kls_t)[source]
spateo.external.CAST.CAST_Stack.get_dxy_ffd(ij, result_B_t, mesh, dJ_dxy_mat, mesh_weight, alpha_basis)[source]
spateo.external.CAST.CAST_Stack.BSpline_renew_coords(uv_t, kls_t, ij_t, mesh_trans)[source]
spateo.external.CAST.CAST_Stack.reg_total_t(coords_q, coords_r, params_dist)[source]
spateo.external.CAST.CAST_Stack.FFD_Bspline_apply_t(coords_q, params_dist, round_t=0)[source]
spateo.external.CAST.CAST_Stack.rescale_coords(coords_raw, graph_list, rescale=False)[source]
spateo.external.CAST.CAST_Stack.mesh_plot(mesh_t, coords_q_t, mesh_trans_t=None)[source]
spateo.external.CAST.CAST_Stack.plot_mid(coords_q, coords_r, output_path='', filename=None, title_t=['ref', 'query'], s_t=8, scale_bar_t=None)[source]
spateo.external.CAST.CAST_Stack.corr_heat(coords_q, coords_r, corr, output_path, title_t=['Corr in ref', 'Anchor in query'], filename=None, scale_bar_t=None)[source]
spateo.external.CAST.CAST_Stack.prelocate_loss_plot(J_t, output_path, prefix='test')[source]
spateo.external.CAST.CAST_Stack.register_result(coords_q, coords_r, cov_anchor_t, bleeding, embed_stack, output_path, k=8, prefix='test', scale_t=1, index_list=None)[source]
spateo.external.CAST.CAST_Stack.affine_reg_params(it_theta, similarity_score, iterations, output_path, prefix='test')[source]
spateo.external.CAST.CAST_Stack.CAST_STACK_rough(coords_raw_list, ifsquare=True, if_max_xy=True, percentile=None)[source]

coords_raw_list: list of numpy arrays, each array is the coordinates of a layer ifsquare: if True, the coordinates will be scaled to a square if_max_xy: if True, the coordinates will be scaled to the max value of the max_range_x and max_range_y, respectively (if ifsquare is False), or the max value of [max_range_x,max_range_y] (if ifsquare is True) percentile: if not None, the min and max will be calculated based on the percentile of the coordinates for each slice.

spateo.external.CAST.CAST_Stack.coords_minus_mean(coord_t)[source]
spateo.external.CAST.CAST_Stack.coords_minus_min(coord_t)[source]
spateo.external.CAST.CAST_Stack.max_minus_value(corr)[source]
spateo.external.CAST.CAST_Stack.coords_minus_min_t(coord_t)[source]
spateo.external.CAST.CAST_Stack.max_minus_value_t(corr)[source]
spateo.external.CAST.CAST_Stack.corr_dist(query_np, ref_np, nan_as='min')[source]
spateo.external.CAST.CAST_Stack.region_detect(embed_dict_t, coords0, k=20)[source]