示例#1
0
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']))
示例#2
0
def c_accel_sirt(tomo, center, recon, theta, **kwargs):

    if LIB_TOMOPY_ACCEL is None:
        return MissingLibrary("SIRT ACCEL")

    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_ACCEL.cxx_sirt.restype = dtype.as_c_void_p()
    return LIB_TOMOPY_ACCEL.cxx_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(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
0
def c_gridrec(tomo, center, recon, theta, **kwargs):

    if LIB_TOMOPY_GRIDREC is None:
        return MissingLibrary("gridrec")

    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_GRIDREC.gridrec.restype = dtype.as_c_void_p()
    return LIB_TOMOPY_GRIDREC.gridrec(
        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']))
示例#4
0
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()
    return (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
示例#5
0
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_int(args[6]),  # istart
        dtype.as_c_int(args[7]))  # iend
示例#6
0
文件: extern.py 项目: AaronBM/tomopy
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_int(args[6]),  # istart
        dtype.as_c_int(args[7]))  # iend
示例#7
0
def c_fbp(*args):
    tomo = mproc.SHARED_TOMO
    recon = mproc.SHARED_ARRAY

    LIB_TOMOPY.fbp.restype = dtype.as_c_void_p()
    LIB_TOMOPY.fbp(
        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
示例#8
0
文件: extern.py 项目: tomopy/tomopy
def c_gridrec(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.gridrec.restype = dtype.as_c_void_p()
    return LIB_TOMOPY.gridrec(
            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']))