예제 #1
0
def _get_algorithm_kwargs(shape):
    dy, dt, dx = shape
    return {
        'num_gridx': dx,
        'num_gridy': dx,
        'filter_name': 'shepp',
        'filter_par': np.array([0.5, 8], dtype='float32'),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block':
        np.arange(0, dt, dtype=np.float32),  # TODO: I think this should be int
        'options': {},
        'accelerated': False,
        'pool_size':
        0,  # if zero, calculate based on threads started at Python level
        'interpolation':
        'NN',  # interpolation method (NN = nearest-neighbor, LINEAR, CUBIC)
        'device': 'gpu',
        'grid_size': np.array(
            [0, 0, 0],
            dtype='int32'),  # CUDA grid size. If zero, dynamically computed
        'block_size': np.array([32, 32, 1],
                               dtype='int32'),  # CUDA threads per block
    }
예제 #2
0
파일: algorithm.py 프로젝트: AaronBM/tomopy
def _get_algorithm_kwargs(shape):
    dx, dy, dz = shape
    return {
        'num_gridx': dz,
        'num_gridy': dz,
        'filter_name': np.array('shepp', dtype=(str, 16)),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block': np.arange(0, dx, dtype='float32'),
    }
예제 #3
0
def _get_algorithm_kwargs(shape):
    dx, dy, dz = shape
    return {
        'num_gridx': dz,
        'num_gridy': dz,
        'filter_name': np.array('shepp', dtype=(str, 16)),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block': np.arange(0, dx, dtype='float32'),
        'options': {},
    }
예제 #4
0
파일: algorithm.py 프로젝트: MrQ007/tomopy
def _get_algorithm_kwargs(shape):
    dy, dt, dx = shape
    return {
        'num_gridx': dx,
        'num_gridy': dx,
        'filter_name': np.array('shepp', dtype=(str, 16)),
        'filter_par': np.array([0.5, 8], dtype='float32'),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block': np.arange(0, dt, dtype=np.float32), #TODO: I think this should be int
        'options': {},
    }
예제 #5
0
파일: algorithm.py 프로젝트: lbluque/tomopy
def _get_algorithm_kwargs(shape):
    dy, dt, dx = shape
    return {
        "num_gridx": dx,
        "num_gridy": dx,
        "filter_name": "shepp",
        "filter_par": np.array([0.5, 8], dtype="float32"),
        "num_iter": dtype.as_int32(1),
        "reg_par": np.ones(10, dtype="float32"),
        "num_block": dtype.as_int32(1),
        "ind_block": np.arange(0, dt, dtype=np.float32),  # TODO: I think this should be int
        "options": {},
    }
예제 #6
0
def _get_algorithm_kwargs(shape):
    dy, dt, dx = shape
    return {
        'num_gridx': dx,
        'num_gridy': dx,
        'filter_name': 'shepp',
        'filter_par': np.array([0.5, 8], dtype='float32'),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block': np.arange(0, dt, dtype=np.float32), #TODO: I think this should be int
        'options': {},
    }
예제 #7
0
파일: normalize.py 프로젝트: jul571/tomopy
def normalize_bg(tomo, air=1, ncore=None, nchunk=None):
    """
    Normalize 3D tomgraphy data based on background intensity.

    Weight sinogram such that the left and right image boundaries
    (i.e., typically the air region around the object) are set to one
    and all intermediate values are scaled linearly.

    Parameters
    ----------
    tomo : ndarray
        3D tomographic data.
    air : int, optional
        Number of pixels at each boundary to calculate the scaling factor.
    ncore : int, optional
        Number of cores that will be assigned to jobs.
    nchunk : int, optional
        Chunk size for each core.

    Returns
    -------
    ndarray
        Corrected 3D tomographic data.
    """
    tomo = dtype.as_float32(tomo)
    air = dtype.as_int32(air)

    arr = mproc.distribute_jobs(
        tomo,
        func=extern.c_normalize_bg,
        args=(air,),
        axis=0,
        ncore=ncore,
        nchunk=nchunk)
    return arr
예제 #8
0
def normalize_bg(tomo, air=1, ncore=None, nchunk=None):
    """
    Normalize 3D tomgraphy data based on background intensity.

    Weight sinogram such that the left and right image boundaries
    (i.e., typically the air region around the object) are set to one
    and all intermediate values are scaled linearly.

    Parameters
    ----------
    tomo : ndarray
        3D tomographic data.
    air : int, optional
        Number of pixels at each boundary to calculate the scaling factor.
    ncore : int, optional
        Number of cores that will be assigned to jobs.
    nchunk : int, optional
        Chunk size for each core.

    Returns
    -------
    ndarray
        Corrected 3D tomographic data.
    """
    tomo = dtype.as_float32(tomo)
    air = dtype.as_int32(air)
    dx, dy, dz = tomo.shape

    arr = mproc.distribute_jobs(tomo,
                                func=extern.c_normalize_bg,
                                args=(dx, dy, dz, air),
                                axis=0,
                                ncore=ncore,
                                nchunk=nchunk)
    return arr
예제 #9
0
파일: algorithm.py 프로젝트: tomopy/tomopy
def _get_algorithm_kwargs(shape):
    dy, dt, dx = shape
    return {
        'num_gridx': dx,
        'num_gridy': dx,
        'filter_name': 'shepp',
        'filter_par': np.array([0.5, 8], dtype='float32'),
        'num_iter': dtype.as_int32(1),
        'reg_par': np.ones(10, dtype='float32'),
        'num_block': dtype.as_int32(1),
        'ind_block': np.arange(0, dt, dtype=np.float32),  # TODO: I think this should be int
        'options': {},
        'accelerated': False,
        'pool_size': 0, # if zero, calculate based on threads started at Python level
        'interpolation': 'NN', # interpolation method (NN = nearest-neighbor, LINEAR, CUBIC)
        'device': 'gpu',
        'grid_size': np.array([0, 0, 0], dtype='int32'), # CUDA grid size. If zero, dynamically computed
        'block_size': np.array([32, 32, 1], dtype='int32'), # CUDA threads per block
    }