本文整理汇总了Python中tomopy.util.dtype.as_c_float_p函数的典型用法代码示例。如果您正苦于以下问题:Python as_c_float_p函数的具体用法?Python as_c_float_p怎么用?Python as_c_float_p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了as_c_float_p函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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))
示例2: c_project2
def c_project2(objx, objy, center, tomo, theta):
# 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.project2.restype = dtype.as_c_void_p()
LIB_TOMOPY.project2(
dtype.as_c_float_p(objx),
dtype.as_c_float_p(objy),
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))
tomo[:] = contiguous_tomo[:]
示例3: 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']))
示例4: c_vector2
def c_vector2(tomo1, tomo2, center1, center2, recon1, recon2, recon3, theta1, theta2, axis1, axis2, **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.vector2.restype = dtype.as_c_void_p()
return LIB_TOMOPY.vector2(
dtype.as_c_float_p(tomo1),
dtype.as_c_float_p(tomo2),
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(theta1),
dtype.as_c_float_p(theta2),
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))
示例5: 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
示例6: c_pml_hybrid
def c_pml_hybrid(args):
data=args[0]
recon=args[6]
# Call C function.
c_float_p = ctypes.POINTER(ctypes.c_float)
librecon_phi.pml_hybrid.restype = ctypes.POINTER(ctypes.c_void_p)
librecon_phi.pml_hybrid(data.ctypes.data_as(c_float_p),
dtype.as_c_int(args[1]), # dx
dtype.as_c_int(args[2]), # dy
dtype.as_c_int(args[3]), # dz
dtype.as_c_float_p(args[4]), # center
dtype.as_c_float_p(args[5]), # theta
recon.ctypes.data_as(c_float_p),
dtype.as_c_int(args[7]['num_gridx']),
dtype.as_c_int(args[7]['num_gridy']),
dtype.as_c_int(args[7]['num_iter']),
dtype.as_c_float_p(args[7]['reg_par']))
return recon
示例7: 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
示例8: 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))
示例9: 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
示例10: 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))
示例11: c_art
def c_art(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
LIB_TOMOPY.art.restype = dtype.as_c_void_p()
return LIB_TOMOPY.art(
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']))
示例12: 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
示例13: c_fbp
def c_fbp(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
LIB_TOMOPY.fbp.restype = dtype.as_c_void_p()
LIB_TOMOPY.fbp(
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_char_p(kwargs['filter_name']),
dtype.as_c_float_p(kwargs['filter_par'])) # filter_par
示例14: 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))
示例15: 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))