本文整理汇总了Python中tomopy.util.dtype.as_c_void_p函数的典型用法代码示例。如果您正苦于以下问题:Python as_c_void_p函数的具体用法?Python as_c_void_p怎么用?Python as_c_void_p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了as_c_void_p函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: c_project3
def c_project3(objx, objy, objz, center, tomo, theta, axis):
# TODO: we should fix this elsewhere...
# TOMO object must be contiguous for c function to work
contiguous_tomo = np.require(tomo, requirements="AC")
if len(objx.shape) == 2:
# no y-axis (only one slice)
oy = 1
ox, oz = objx.shape
else:
oy, ox, oz = objx.shape
if len(tomo.shape) == 2:
# no y-axis (only one slice)
dy = 1
dt, dx = tomo.shape
else:
dy, dt, dx = tomo.shape
LIB_TOMOPY.project3.restype = dtype.as_c_void_p()
LIB_TOMOPY.project3(
dtype.as_c_float_p(objx),
dtype.as_c_float_p(objy),
dtype.as_c_float_p(objz),
dtype.as_c_int(oy),
dtype.as_c_int(ox),
dtype.as_c_int(oz),
dtype.as_c_float_p(contiguous_tomo),
dtype.as_c_int(dy),
dtype.as_c_int(dt),
dtype.as_c_int(dx),
dtype.as_c_float_p(center),
dtype.as_c_float_p(theta),
dtype.as_c_int(axis))
tomo[:] = contiguous_tomo[:]
示例2: c_sirt
def c_sirt(tomo, center, recon, theta, **kwargs):
if len(tomo.shape) == 2:
# no y-axis (only one slice)
dy = 1
dt, dx = tomo.shape
else:
dy, dt, dx = tomo.shape
use_accel = 1 if kwargs['accelerated'] else 0
LIB_TOMOPY.sirt.restype = dtype.as_c_void_p()
return LIB_TOMOPY.sirt(
dtype.as_c_float_p(tomo),
dtype.as_c_int(dy),
dtype.as_c_int(dt),
dtype.as_c_int(dx),
dtype.as_c_float_p(center),
dtype.as_c_float_p(theta),
dtype.as_c_float_p(recon),
dtype.as_c_int(kwargs['num_gridx']),
dtype.as_c_int(kwargs['num_gridy']),
dtype.as_c_int(kwargs['num_iter']),
dtype.as_c_int(use_accel),
dtype.as_c_int(kwargs['pool_size']),
dtype.as_c_char_p(kwargs['interpolation']),
dtype.as_c_char_p(kwargs['device']),
dtype.as_c_int_p(kwargs['grid_size']),
dtype.as_c_int_p(kwargs['block_size']))
示例3: c_project
def c_project(obj, center, tomo, theta):
if len(obj.shape) == 2:
# no y-axis (only one slice)
oy = 1
ox, oz = obj.shape
else:
oy, ox, oz = obj.shape
if len(tomo.shape) == 2:
# no y-axis (only one slice)
dy = 1
dt, dx = tomo.shape
else:
dy, dt, dx = tomo.shape
LIB_TOMOPY.project.restype = dtype.as_c_void_p()
LIB_TOMOPY.project(
dtype.as_c_float_p(obj),
dtype.as_c_int(oy),
dtype.as_c_int(ox),
dtype.as_c_int(oz),
dtype.as_c_float_p(tomo),
dtype.as_c_int(dy),
dtype.as_c_int(dt),
dtype.as_c_int(dx),
dtype.as_c_float_p(center),
dtype.as_c_float_p(theta))
示例4: c_vector3
def c_vector3(tomo1, tomo2, tomo3, center1, center2, center3, recon1, recon2, recon3, theta1, theta2, theta3, axis1, axis2, axis3, **kwargs):
if len(tomo1.shape) == 2:
# no y-axis (only one slice)
dy = 1
dt, dx = tomo1.shape
else:
dy, dt, dx = tomo1.shape
LIB_TOMOPY.vector3.restype = dtype.as_c_void_p()
return LIB_TOMOPY.vector3(
dtype.as_c_float_p(tomo1),
dtype.as_c_float_p(tomo2),
dtype.as_c_float_p(tomo3),
dtype.as_c_int(dy),
dtype.as_c_int(dt),
dtype.as_c_int(dx),
dtype.as_c_float_p(center1),
dtype.as_c_float_p(center2),
dtype.as_c_float_p(center3),
dtype.as_c_float_p(theta1),
dtype.as_c_float_p(theta2),
dtype.as_c_float_p(theta3),
dtype.as_c_float_p(recon1),
dtype.as_c_float_p(recon2),
dtype.as_c_float_p(recon3),
dtype.as_c_int(kwargs['num_gridx']),
dtype.as_c_int(kwargs['num_gridy']),
dtype.as_c_int(kwargs['num_iter']),
dtype.as_c_int(axis1),
dtype.as_c_int(axis2),
dtype.as_c_int(axis3))
示例5: c_normalize_bg
def c_normalize_bg(tomo, air):
dt, dy, dx = tomo.shape
LIB_TOMOPY.normalize_bg.restype = dtype.as_c_void_p()
LIB_TOMOPY.normalize_bg(
dtype.as_c_float_p(tomo),
dtype.as_c_int(dt),
dtype.as_c_int(dy),
dtype.as_c_int(dx),
dtype.as_c_int(air))
示例6: c_normalize_bg
def c_normalize_bg(dx, dy, dz, air, istart, iend):
tomo = mproc.SHARED_ARRAY
LIB_TOMOPY.normalize_bg.restype = dtype.as_c_void_p()
LIB_TOMOPY.normalize_bg(
dtype.as_c_float_p(tomo),
dtype.as_c_int(dx),
dtype.as_c_int(dy),
dtype.as_c_int(dz),
dtype.as_c_int(air),
dtype.as_c_int(istart),
dtype.as_c_int(iend))
示例7: c_remove_stripe_sf
def c_remove_stripe_sf(dx, dy, dz, size, istart, iend):
tomo = mproc.SHARED_ARRAY
LIB_TOMOPY.remove_stripe_sf.restype = dtype.as_c_void_p()
LIB_TOMOPY.remove_stripe_sf(
dtype.as_c_float_p(tomo),
dtype.as_c_int(dx),
dtype.as_c_int(dy),
dtype.as_c_int(dz),
dtype.as_c_int(size),
dtype.as_c_int(istart),
dtype.as_c_int(iend))
示例8: c_sample
def c_sample(mode, arr, dx, dy, dz, level, axis, out):
LIB_TOMOPY.sample.restype = dtype.as_c_void_p()
LIB_TOMOPY.sample(
dtype.as_c_int(mode),
dtype.as_c_float_p(arr),
dtype.as_c_int(dx),
dtype.as_c_int(dy),
dtype.as_c_int(dz),
dtype.as_c_int(level),
dtype.as_c_int(axis),
dtype.as_c_float_p(out))
return out
示例9: c_remove_stripe_sf
def c_remove_stripe_sf(tomo, size):
# TODO: we should fix this elsewhere...
# TOMO object must be contiguous for c function to work
contiguous_tomo = np.require(tomo, requirements="AC")
dx, dy, dz = tomo.shape
istart = 0
iend = dy
LIB_TOMOPY.remove_stripe_sf.restype = dtype.as_c_void_p()
LIB_TOMOPY.remove_stripe_sf(
dtype.as_c_float_p(contiguous_tomo),
dtype.as_c_int(dx),
dtype.as_c_int(dy),
dtype.as_c_int(dz),
dtype.as_c_int(size),
dtype.as_c_int(istart),
dtype.as_c_int(iend))
tomo[:] = contiguous_tomo[:]
示例10: c_remove_ring
def c_remove_ring(rec, *args):
istart = 0
iend = rec.shape[0]
LIB_TOMOPY.remove_ring.restype = dtype.as_c_void_p()
return LIB_TOMOPY.remove_ring(
dtype.as_c_float_p(rec),
dtype.as_c_float(args[0]), # center_x
dtype.as_c_float(args[1]), # center_y
dtype.as_c_int(args[2]), # dx
dtype.as_c_int(args[3]), # dy
dtype.as_c_int(args[4]), # dz
dtype.as_c_float(args[5]), # thresh_max
dtype.as_c_float(args[6]), # thresh_min
dtype.as_c_float(args[7]), # thresh
dtype.as_c_int(args[8]), # theta_min
dtype.as_c_int(args[9]), # rwidth
dtype.as_c_int(istart), # istart
dtype.as_c_int(iend)) # iend
示例11: c_project
def c_project(ox, oy, oz, theta, center, dx, dy, dz, istart, iend):
obj = mproc.SHARED_OBJ
tomo = mproc.SHARED_ARRAY
LIB_TOMOPY.project.restype = dtype.as_c_void_p()
LIB_TOMOPY.project(
dtype.as_c_float_p(obj),
dtype.as_c_int(ox),
dtype.as_c_int(oy),
dtype.as_c_int(oz),
dtype.as_c_float_p(tomo),
dtype.as_c_int(dx),
dtype.as_c_int(dy),
dtype.as_c_int(dz),
dtype.as_c_float_p(center),
dtype.as_c_float_p(theta),
dtype.as_c_int(istart),
dtype.as_c_int(iend))
示例12: c_remove_ring
def c_remove_ring(*args):
data = mproc.SHARED_ARRAY
LIB_TOMOPY.remove_ring.restype = dtype.as_c_void_p()
LIB_TOMOPY.remove_ring(
dtype.as_c_float_p(data),
dtype.as_c_float(args[0]), # center_x
dtype.as_c_float(args[1]), # center_y
dtype.as_c_int(args[2]), # dx
dtype.as_c_int(args[3]), # dy
dtype.as_c_int(args[4]), # dz
dtype.as_c_float(args[5]), # thresh_max
dtype.as_c_float(args[6]), # thresh_min
dtype.as_c_float(args[7]), # thresh
dtype.as_c_int(args[8]), # theta_min
dtype.as_c_int(args[9]), # rwidth
dtype.as_c_int(args[10]), # istart
dtype.as_c_int(args[11])) # iend
示例13: c_sirt
def c_sirt(*args):
tomo = mproc.SHARED_TOMO
recon = mproc.SHARED_ARRAY
LIB_TOMOPY.sirt.restype = dtype.as_c_void_p()
LIB_TOMOPY.sirt(
dtype.as_c_float_p(tomo),
dtype.as_c_int(args[0]), # dx
dtype.as_c_int(args[1]), # dy
dtype.as_c_int(args[2]), # dz
dtype.as_c_float_p(args[3]), # center
dtype.as_c_float_p(args[4]), # theta
dtype.as_c_float_p(recon),
dtype.as_c_int(args[5]['num_gridx']),
dtype.as_c_int(args[5]['num_gridy']),
dtype.as_c_int(args[5]['num_iter']),
dtype.as_c_int(args[6]), # istart
dtype.as_c_int(args[7])) # iend
示例14: c_mlem
def c_mlem(*args):
tomo = mproc.SHARED_TOMO
recon = mproc.SHARED_ARRAY
LIB_TOMOPY.mlem.restype = dtype.as_c_void_p()
LIB_TOMOPY.mlem(
dtype.as_c_float_p(tomo),
dtype.as_c_int(args[0]), # dx
dtype.as_c_int(args[1]), # dy
dtype.as_c_int(args[2]), # dz
dtype.as_c_float_p(args[3]), # center
dtype.as_c_float_p(args[4]), # theta
dtype.as_c_float_p(recon),
dtype.as_c_int(args[5]["num_gridx"]),
dtype.as_c_int(args[5]["num_gridy"]),
dtype.as_c_int(args[5]["num_iter"]),
dtype.as_c_int(args[6]), # istart
dtype.as_c_int(args[7]),
) # iend
示例15: c_gridrec
def c_gridrec(*args):
tomo = mproc.SHARED_TOMO
recon = mproc.SHARED_ARRAY
LIB_TOMOPY.gridrec.restype = dtype.as_c_void_p()
LIB_TOMOPY.gridrec(
dtype.as_c_float_p(tomo),
dtype.as_c_int(args[0]), # dx
dtype.as_c_int(args[1]), # dy
dtype.as_c_int(args[2]), # dz
dtype.as_c_float_p(args[3]), # center
dtype.as_c_float_p(args[4]), # theta
dtype.as_c_float_p(recon),
dtype.as_c_int(args[5]["num_gridx"]),
dtype.as_c_int(args[5]["num_gridy"]),
dtype.as_c_char_p(args[5]["filter_name"]),
dtype.as_c_float_p(args[5]["filter_par"]), # filter_par
dtype.as_c_int(args[6]), # istart
dtype.as_c_int(args[7]),
) # iend