Esempio n. 1
0
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))
Esempio n. 2
0
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))
Esempio n. 3
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']))
Esempio n. 4
0
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[:]
Esempio n. 5
0
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']))
Esempio n. 6
0
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))
Esempio n. 7
0
def c_osem(*args):
    tomo = mproc.SHARED_TOMO
    recon = mproc.SHARED_ARRAY

    LIB_TOMOPY.osem.restype = dtype.as_c_void_p()
    LIB_TOMOPY.osem(
        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[5]['num_block']),
        dtype.as_c_float_p(args[5]['ind_block']),
        dtype.as_c_int(args[6]),  # istart
        dtype.as_c_int(args[7]))  # iend
Esempio n. 8
0
def c_bart(*args):
    tomo = mproc.SHARED_TOMO
    recon = mproc.SHARED_ARRAY

    LIB_TOMOPY.bart.restype = dtype.as_c_void_p()
    LIB_TOMOPY.bart(
        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[5]["num_block"]),
        dtype.as_c_float_p(args[5]["ind_block"]),
        dtype.as_c_int(args[6]),  # istart
        dtype.as_c_int(args[7]),
    )  # iend
Esempio n. 9
0
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))
Esempio n. 10
0
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))
Esempio n. 11
0
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
Esempio n. 12
0
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))
Esempio n. 13
0
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(args[10]),  # int_mode
            dtype.as_c_int(istart),  # istart
            dtype.as_c_int(iend))  # iend
Esempio n. 14
0
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
Esempio n. 15
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
Esempio n. 16
0
def c_ospml_quad(args):
    data=args[0]
    recon=args[6]
    # Call C function.
    c_float_p = ctypes.POINTER(ctypes.c_float)
    librecon_phi.ospml_quad.restype = ctypes.POINTER(ctypes.c_void_p)
    librecon_phi.ospml_quad(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']),
        dtype.as_c_int(args[7]['num_block']),
        dtype.as_c_float_p(args[7]['ind_block']))
    return recon
Esempio n. 17
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
Esempio n. 18
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

    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']))
Esempio n. 19
0
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))
Esempio n. 20
0
def c_ospml_quad(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_RECON.ospml_quad.restype = dtype.as_c_void_p()
    return LIB_TOMOPY_RECON.ospml_quad(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_float_p(kwargs['reg_par']),
                                       dtype.as_c_int(kwargs['num_block']),
                                       dtype.as_c_int_p(kwargs['ind_block']))
Esempio n. 21
0
def c_ospml_quad(args):
    data = args[0]
    recon = args[6]
    # Call C function.
    c_float_p = ctypes.POINTER(ctypes.c_float)
    librecon_phi.ospml_quad.restype = ctypes.POINTER(ctypes.c_void_p)
    librecon_phi.ospml_quad(
        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']),
        dtype.as_c_int(args[7]['num_block']),
        dtype.as_c_float_p(args[7]['ind_block']))
    return recon
Esempio n. 22
0
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[:]
Esempio n. 23
0
def c_bart(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_RECON.bart.restype = dtype.as_c_void_p()
    return LIB_TOMOPY_RECON.bart(
        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['num_block']),
        dtype.as_c_float_p(kwargs['ind_block']))  # TODO: I think this should be int_p
Esempio n. 24
0
def c_osem(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.osem.restype = dtype.as_c_void_p()
    return LIB_TOMOPY.osem(
            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['num_block']),
            dtype.as_c_float_p(kwargs['ind_block']))  # TODO: should be int?
Esempio n. 25
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

    LIB_TOMOPY.sirt.restype = dtype.as_c_void_p()
    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']))
Esempio n. 26
0
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))
Esempio n. 27
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

    if use_accel:
        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']))
    else:
        LIB_TOMOPY_RECON.sirt.restype = dtype.as_c_void_p()
        return LIB_TOMOPY_RECON.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']))