Exemplo n.º 1
0
def read_aps_32id(fname, proj=None, sino=None):
    """
    Read APS 32-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    tomo_grp = os.path.join('exchange', 'data')
    flat_grp = os.path.join('exchange', 'data_white')
    dark_grp = os.path.join('exchange', 'data_dark')
    tomo = tio.read_hdf5(fname, tomo_grp, slc=(proj, sino))
    flat = tio.read_hdf5(fname, flat_grp, slc=(None, sino))
    dark = tio.read_hdf5(fname, dark_grp, slc=(None, sino))
    return tomo, flat, dark
Exemplo n.º 2
0
def read_aps_7bm(fname, proj=None, sino=None):
    """
    Read APS 7-BM standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    array
        Projection angles in radian.
    """
    tomo_grp = '/'.join(['exchange', 'data'])
    theta_grp = '/'.join(['exchange', 'theta'])
    tomo = tio.read_hdf5(fname, tomo_grp, slc=(proj, sino))
    theta = tio.read_hdf5(fname, theta_grp, slc=(proj, ))
    return tomo, theta
Exemplo n.º 3
0
def read_aps_7bm(fname, proj=None, sino=None):
    """
    Read APS 7-BM standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    array
        Projection angles in radian.
    """
    tomo_grp = os.path.join('exchange', 'data')
    theta_grp = os.path.join('exchange', 'theta')
    tomo = tio.read_hdf5(fname, tomo_grp, slc=(proj, sino))
    theta = tio.read_hdf5(fname, theta_grp, slc=(proj, ))
    return tomo, theta
Exemplo n.º 4
0
def read_lnls_imx(folder, proj=None, sino=None):
    """
    Read LNLS IMX standard data format.

    Parameters
    ----------
    folder : str
        Path to sample folder (containing tomo.h5, flat.h5, dark.h5)

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    folder = os.path.abspath(folder)
    tomo_name = os.path.join(folder, 'tomo.h5')
    flat_name = os.path.join(folder, 'tomo_flat_before.h5')
    dark_name = os.path.join(folder, 'tomo_dark_before.h5')
    tomo = tio.read_hdf5(tomo_name, 'images', slc=(proj, sino))
    flat = tio.read_hdf5(flat_name, 'flats', slc=(None, sino))
    dark = tio.read_hdf5(dark_name, 'darks', slc=(None, sino))
    return tomo, flat, dark
Exemplo n.º 5
0
def read_lnls_imx(folder, proj=None, sino=None):
    """
    Read LNLS IMX standard data format.

    Parameters
    ----------
    folder : str
        Path to sample folder (containing tomo.h5, flat.h5, dark.h5)

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    folder = os.path.abspath(folder)
    tomo_name = os.path.join(folder, 'tomo.h5')
    flat_name = os.path.join(folder, 'tomo_flat_before.h5')
    dark_name = os.path.join(folder, 'tomo_dark_before.h5')
    tomo = tio.read_hdf5(tomo_name, 'images', slc=(proj, sino))
    flat = tio.read_hdf5(flat_name, 'flats', slc=(None, sino))
    dark = tio.read_hdf5(dark_name, 'darks', slc=(None, sino))
    return tomo, flat, dark
Exemplo n.º 6
0
def read_aps_32id(fname, exchange_rank=0, proj=None, sino=None, 
                  dtype=None, shared=True):
    """
    Read APS 32-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    exchange_rank : int, optional
        exchange_rank is added to "exchange" to point tomopy to the data
        to recontruct. if rank is not set then the data are raw from the
        detector and are located under exchange = "exchange/...", to process
        data that are the result of some intemedite processing step then
        exchange_rank = 1, 2, ... will direct tomopy to process
        "exchange1/...",

    proj : {sequence, int} or np.slice, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int} or np.slice, optional
        Specify sinograms to read. (start, end, step)

    dtype : numpy datatype, optional
        Convert data to this datatype on read if specified.

    shared : bool, optional
        If True, read proj data into shared memory location.  Defaults to False.

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    if exchange_rank > 0:
        exchange_base = 'exchange{:d}'.format(int(exchange_rank))
    else:
        exchange_base = "exchange"
    
    tomo_grp = '/'.join([exchange_base, 'data'])
    flat_grp = '/'.join([exchange_base, 'data_white'])
    dark_grp = '/'.join([exchange_base, 'data_dark'])
    tomo = tio.read_hdf5(fname, tomo_grp, (proj, sino), dtype, shared)
    flat = tio.read_hdf5(fname, flat_grp, (None, sino), dtype)
    dark = tio.read_hdf5(fname, dark_grp, (None, sino), dtype)
    return tomo, flat, dark
Exemplo n.º 7
0
def read_aps_32id(fname, exchange_rank=0, proj=None, sino=None, 
                  dtype=None, shared=True):
    """
    Read APS 32-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    exchange_rank : int, optional
        exchange_rank is added to "exchange" to point tomopy to the data
        to recontruct. if rank is not set then the data are raw from the
        detector and are located under exchange = "exchange/...", to process
        data that are the result of some intemedite processing step then
        exchange_rank = 1, 2, ... will direct tomopy to process
        "exchange1/...",

    proj : {sequence, int} or np.slice, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int} or np.slice, optional
        Specify sinograms to read. (start, end, step)

    dtype : numpy datatype, optional
        Convert data to this datatype on read if specified.

    shared : bool, optional
        If True, read proj data into shared memory location.  Defaults to False.

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    if exchange_rank > 0:
        exchange_base = 'exchange{:d}'.format(int(exchange_rank))
    else:
        exchange_base = "exchange"
    
    tomo_grp = '/'.join([exchange_base, 'data'])
    flat_grp = '/'.join([exchange_base, 'data_white'])
    dark_grp = '/'.join([exchange_base, 'data_dark'])
    tomo = tio.read_hdf5(fname, tomo_grp, (proj, sino), dtype, shared)
    flat = tio.read_hdf5(fname, flat_grp, (None, sino), dtype)
    dark = tio.read_hdf5(fname, dark_grp, (None, sino), dtype)
    return tomo, flat, dark
Exemplo n.º 8
0
def read_aps_13id(fname, group='/xrfmap/roimap/sum_cor', proj=None, sino=None):
    """
    Read APS 13-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    group : str, optional
        Path to the group inside hdf5 file where data is located.

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.
    """
    tomo = tio.read_hdf5(fname, group, slc=(None, proj, sino))
    tomo = np.swapaxes(tomo, 0, 1)
    tomo = np.swapaxes(tomo, 1, 2).copy()
    return tomo
Exemplo n.º 9
0
def read_aps_13id(
        fname, group='/xrfmap/roimap/sum_cor', proj=None, sino=None):
    """
    Read APS 13-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    group : str, optional
        Path to the group inside hdf5 file where data is located.

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.
    """
    tomo = tio.read_hdf5(fname, group, slc=(None, proj, sino))
    tomo = np.swapaxes(tomo, 0, 1)
    tomo = np.swapaxes(tomo, 1, 2).copy()
    return tomo
Exemplo n.º 10
0
def read_aps_32id(fname, exchange_rank=0, proj=None, sino=None):
    """
    Read APS 32-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    exchange_rank : int, optional
        exchange_rank is added to "exchange" to point tomopy to the data
        to recontruct. if rank is not set then the data are raw from the
        detector and are located under exchange = "exchange/...", to process
        data that are the result of some intemedite processing step then
        exchange_rank = 1, 2, ... will direct tomopy to process
        "exchange1/...",

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    if exchange_rank > 0:
        exchange_base = 'exchange{:d}'.format(int(exchange_rank))
    else:
        exchange_base = "exchange"

    tomo_grp = '/'.join([exchange_base, 'data'])
    flat_grp = '/'.join([exchange_base, 'data_white'])
    dark_grp = '/'.join([exchange_base, 'data_dark'])
    tomo = tio.read_hdf5(fname, tomo_grp, slc=(proj, sino))
    flat = tio.read_hdf5(fname, flat_grp, slc=(None, sino))
    dark = tio.read_hdf5(fname, dark_grp, slc=(None, sino))
    return tomo, flat, dark
Exemplo n.º 11
0
def read_aps_32id(fname, exchange_rank=0, proj=None, sino=None):
    """
    Read APS 32-ID standard data format.

    Parameters
    ----------
    fname : str
        Path to hdf5 file.

    exchange_rank : int, optional
        exchange_rank is added to "exchange" to point tomopy to the data
        to recontruct. if rank is not set then the data are raw from the
        detector and are located under exchange = "exchange/...", to process
        data that are the result of some intemedite processing step then
        exchange_rank = 1, 2, ... will direct tomopy to process
        "exchange1/...",

    proj : {sequence, int}, optional
        Specify projections to read. (start, end, step)

    sino : {sequence, int}, optional
        Specify sinograms to read. (start, end, step)

    Returns
    -------
    ndarray
        3D tomographic data.

    ndarray
        3d flat field data.

    ndarray
        3D dark field data.
    """
    if exchange_rank > 0:
        exchange_base = 'exchange{:d}'.format(int(exchange_rank))
    else:
        exchange_base = "exchange"

    tomo_grp = '/'.join([exchange_base, 'data'])
    flat_grp = '/'.join([exchange_base, 'data_white'])
    dark_grp = '/'.join([exchange_base, 'data_dark'])
    tomo = tio.read_hdf5(fname, tomo_grp, slc=(proj, sino))
    flat = tio.read_hdf5(fname, flat_grp, slc=(None, sino))
    dark = tio.read_hdf5(fname, dark_grp, slc=(None, sino))
    return tomo, flat, dark