示例#1
0
def main():

    file_name = '/local/dataraid/databank/templates/esrf_ID19/tomo.edf'
    dark_file_name = '/local/dataraid/databank/templates/esrf_ID19/dark.edf'
    white_file_name = '/local/dataraid/databank/templates/esrf_ID19/flat.edf'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/ESRF.h5'

    sample_name = 'edf test'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(file_name,
                                              white_file_name=white_file_name,
                                              dark_file_name=dark_file_name,
                                              data_type='edf',
                                              log='INFO')

    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
示例#2
0
def main():

    file_name = '/local/dataraid/databank/templates/sls_tomcat/sample_name.tif'
    log_file = '/local/dataraid/databank/templates/sls_tomcat/sample_name.log'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/SLS.h5'

    sample_name = 'Hornby_b'

    #Read SLS log file data
    file = open(log_file, 'r')
    for line in file:
        linelist = line.split()
        if len(linelist) > 1:
            if (linelist[0] == "Number" and linelist[2] == "darks"):
                number_of_darks = int(linelist[4])
            elif (linelist[0] == "Number" and linelist[2] == "flats"):
                number_of_flats = int(linelist[4])
            elif (linelist[0] == "Number" and linelist[2] == "projections"):
                number_of_projections = int(linelist[4])
            elif (linelist[0] == "Rot" and linelist[2] == "min"):
                rotation_min = float(linelist[6])
            elif (linelist[0] == "Rot" and linelist[2] == "max"):
                rotation_max = float(linelist[6])
            elif (linelist[0] == "Angular" and linelist[1] == "step"):
                angular_step = float(linelist[4])
    file.close()

    dark_start = 1
    dark_end = number_of_darks + 1
    white_start = dark_end
    white_end = white_start + number_of_flats
    projections_start = white_end
    projections_end = projections_start + number_of_projections
    projections_angle_end = 180 + angular_step

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        projections_angle_end=projections_angle_end,
        projections_digits=4,
        white_start=white_start,
        white_end=white_end,
        dark_start=dark_start,
        dark_end=dark_end,
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
示例#3
0
def main():

    file_name = '/local/dataraid/databank/templates/elettra_SYRMEP/tomo_.tif'
    dark_file_name = '/local/dataraid/databank/templates/elettra_SYRMEP/dark_.tif'
    white_file_name = '/local/dataraid/databank/templates/elettra_SYRMEP/flat_.tif'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/Elettra.h5'

    projections_start = 1
    projections_end = 1441
    white_start = 1
    white_end = 11
    white_step = 1
    dark_start = 1
    dark_end = 11
    dark_step = 1

    sample_name = 'Volcanic_rock'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        projections_digits=4,
        white_file_name=white_file_name,
        white_start=white_start,
        white_end=white_end,
        white_step=white_step,
        dark_file_name=dark_file_name,
        dark_start=dark_start,
        dark_end=dark_end,
        dark_step=dark_step,
        data_type='compressed_tiff',
        projections_zeros=True,
        white_zeros=False,
        dark_zeros=False,
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
def main():

    file_name = '/local/dataraid/databank/templates/australian_micro-tomography/SAMPLE_T_.tif'
    dark_file_name = '/local/dataraid/databank/templates/australian_micro-tomography/DF__BEFORE_.tif'
    white_file_name = '/local/dataraid/databank/templates/australian_micro-tomography/BG__BEFORE_.tif'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/Australian.h5'

    sample_name = 'Teeth'

    projections_start = 0
    projections_end = 1801
    white_start = 0
    white_end = 10
    white_step = 1
    dark_start = 0
    dark_end = 10
    dark_step = 1

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(file_name,
                                                       projections_start = projections_start,
                                                       projections_end = projections_end,
                                                       white_file_name = white_file_name,
                                                       white_start = white_start,
                                                       white_end = white_end,
                                                       white_step = white_step,
                                                       dark_file_name = dark_file_name,
                                                       dark_start = dark_start,
                                                       dark_end = dark_end,
                                                       dark_step = dark_step,
                                                       projections_digits = 4,
                                                       white_digits = 2,
                                                       dark_digits = 2,
                                                       projections_zeros = True,
                                                       log='INFO'
                                                    )    
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data = data,
                          data_white = white,
                          data_dark = dark,
                          theta = theta,
                          hdf5_file_name = hdf5_file_name,
                          sample_name = sample_name,
                          data_exchange_type = 'tomography_raw_projections'
                          )
def main():

    # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19
    file_name = '/local/dataraid/databank/templates/petraIII_P05/sample_name00_0000/scan_0002/ccd/pco01/ccd_.tif'
    dark_file_name = '/local/dataraid/databank/templates/petraIII_P05/sample_name00_0000/scan_0000/ccd/pco01/ccd_.tif'
    white_file_name = '/local/dataraid/databank/templates/petraIII_P05/sample_name00_0000/scan_0001/ccd/pco01/ccd_.tif'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/PetraIII.h5'

    projections_start = 0
    projections_end = 1441
    white_start = 0
    white_end = 20
    white_step = 1
    dark_start = 0
    dark_end = 20
    dark_step = 1

    sample_name = 'oster02_0001'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        white_file_name=white_file_name,
        white_start=white_start,
        white_end=white_end,
        white_step=white_step,
        dark_file_name=dark_file_name,
        dark_start=dark_start,
        dark_end=dark_end,
        dark_step=dark_step,
        projections_digits=4,
        projections_zeros=True,
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
示例#6
0
def main():

    file_name = '/local/dataraid/databank/templates/anka_topo-tomo/radios/image_.tif'
    dark_file_name = '/local/dataraid/databank/templates/anka_topo-tomo/darks/image_.tif'
    white_file_name = '/local/dataraid/databank/templates/anka_topo-tomo/flats/image_.tif'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/Anka.h5'

    projections_start = 0
    projections_end = 3167
    white_start = 0
    white_end = 100
    dark_start = 0
    dark_end = 100

    sample_name = 'insect'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        white_file_name=white_file_name,
        white_start=white_start,
        white_end=white_end,
        dark_file_name=dark_file_name,
        dark_start=dark_start,
        dark_end=dark_end,
        projections_digits=5,
        log='INFO')

    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
示例#7
0
def main():

    file_name = '/local/dataraid/databank/templates/aps_13-BM/SPE/sample_name_.SPE'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/APS_13_BM_spe.h5'

    white_start = 1
    white_end = 8
    white_step = 2
    projections_start = 2
    projections_end = 7
    projections_step = 2

    sample_name = 'run2_soln1_2'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        projections_step=projections_step,
        white_start=white_start,
        white_end=white_end,
        white_step=white_step,
        projections_zeros=False,
        white_zeros=False,
        dark_zeros=False,
        projections_digits=1,
        data_type='spe',
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
def main():

    file_name = '/local/dataraid/databank/templates/diamond_JEEP/tiff/sample_name/im_.tif'
    white_file_name = '/local/dataraid/databank/templates/diamond_JEEP/tiff/sample_name/flat_.tif'

    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/Diamond.h5'

    sample_name = 'waterflow'

    white_start = 0
    white_end = 1
    projections_start = 1000
    projections_end = 2440

    #print "Dark", dark_start, dark_end
    print "White", white_start, white_end
    print "Projection", projections_start, projections_end

    # Read series of images
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        projections_angle_end=360,
        projections_digits=6,
        white_file_name=white_file_name,
        white_start=white_start,
        white_end=white_end,
        log='INFO')
    write = xtomo_exp.Export()
    # Create minimal data exchange hdf5 file
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         sample_name=sample_name,
                         hdf5_file_name=hdf5_file_name,
                         data_exchange_type='tomography_raw_projections')
def main():

    file_name = '/local/dataraid/databank/templates/diamond_JEEP/sample_name_subx.nxs'
    hdf5_file_name = '/local/dataraid/databank/dataExchange/tmp/Diamond.h5'

    # Read raw data
    # set slice_start and slice_end to  full size. 1600-1610 is for testing only
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(file_name,
                                              data_type='nxs',
                                              slices_start=1600,
                                              slices_end=1610,
                                              slices_step=1,
                                              log='INFO')

    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         data_exchange_type='tomography_raw_projections')
示例#10
0
def main():

    file_name = '/local/dataraid/databank/templates/aps_13-BM/NC/sample_name_.nc'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/APS_13_BM_netCDF.h5'

    white_start = 1
    white_end = 4
    white_step = 2
    projections_start = 2
    projections_end = 3
    projections_step = 1

    sample_name = 'Dorthe_F'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(file_name,
                                                       projections_start = projections_start,
                                                       projections_end = projections_end,
                                                       projections_step = projections_step,
                                                       white_start = white_start,
                                                       white_end = white_end,
                                                       white_step = white_step,
                                                       projections_digits = 3,
                                                       data_type='nc',
                                                       log='INFO'
                                                       )
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data = data,
                          data_white = white,
                          data_dark = dark,
                          theta = theta,
                          hdf5_file_name = hdf5_file_name,
                          sample_name = sample_name,
                          data_exchange_type = 'tomography_raw_projections'
                          )
示例#11
0
def main():

    file_name = '/local/dataraid/databank/templates/aps_1-ID/data_.tif'
    log_file = '/local/dataraid/databank/templates/aps_1-ID/TomoStillScan.dat'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/APS_1_ID.h5'

    #Read APS 1-ID log file data
    file = open(log_file, 'r')
    for line in file:
        linelist = line.split()
        if len(linelist) > 1:
            if (linelist[0] == "First" and linelist[1] == "image"):
                projections_start = int(linelist[4])
            elif (linelist[0] == "Last" and linelist[1] == "image"):
                projections_end = int(linelist[4])
            elif (linelist[0] == "Dark" and linelist[1] == "field"):
                dark_start = int(linelist[6])
            elif (linelist[0] == "Number" and linelist[2] == "dark"):
                number_of_dark = int(linelist[5])
            elif (linelist[0] == "White" and linelist[1] == "field"):
                white_start = int(linelist[6])
            elif (linelist[0] == "Number" and linelist[2] == "white"):
                number_of_white = int(linelist[5])
    file.close()

    dark_end = dark_start + number_of_dark
    white_end = white_start + number_of_white

    # to fix a data collection looging bug ?
    white_start = white_start + 1
    dark_start = dark_start + 1
    projections_start = projections_start + 11
    projections_end = projections_end - 9

    ##    # these are correct per Peter discussion
    ##    projections_start = 943
    ##    projections_end = 1853
    ##    white_start = 1844
    ##    white_end = 1853
    ##    dark_start = 1854
    ##    dark_end = 1863

    sample_name = 'CAT4B_2'

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        white_start=white_start,
        white_end=white_end,
        dark_start=dark_start,
        dark_end=dark_end,
        projections_digits=6,
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')
示例#12
0
def main():

    file_name = '/local/dataraid/databank/templates/als_beamline_8.3.2/sample_name_0000_.tif'
    dark_file_name = '/local/dataraid/databank/templates/als_beamline_8.3.2/sample_namedrk_.tif'
    white_file_name = '/local/dataraid/databank/templates/als_beamline_8.3.2/sample_namebak_.tif'
    log_file = '/local/dataraid/databank/templates/als_beamline_8.3.2/sample_name.sct'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/ALS.h5'

    verbose = True

    # Read ALS log file data
    file = open(log_file, 'r')
    for line in file:
        if '-scanner' in line:
            Source = re.sub(r'-scanner ', "", line)
            if verbose: print 'Facility', Source

        if '-object' in line:
            Sample = re.sub(r'-object ', "", line)
            if verbose: print 'Sample', Sample

        if '-senergy' in line:
            Energy = re.findall(r'\d+.\d+', line)
            if verbose: print 'Energy', Energy[0]

        if '-scurrent' in line:
            Current = re.findall(r'\d+.\d+', line)
            if verbose: print 'Current', Current[0]

        if '-nangles' in line:
            Angles = re.findall(r'\d+', line)
            if verbose: print 'Angles', Angles[0]

        if '-num_bright_field' in line:
            WhiteEnd = re.findall(r'\d+', line)

        if '-num_dark_fields' in line:
            DarkEnd = re.findall(r'\d+', line)

    file.close()

    dark_start = 0
    dark_end = int(DarkEnd[0])
    dark_step = 1
    white_start = 0
    white_end = int(WhiteEnd[0])
    white_step = 1
    projections_start = 0
    projections_end = int(Angles[0])
    #projections_end = 18

    print dark_end, white_end, projections_end

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name=file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        white_file_name=white_file_name,
        white_start=white_start,
        white_end=white_end,
        dark_file_name=dark_file_name,
        dark_start=dark_start,
        dark_end=dark_end,
        projections_digits=4,
        #data_type='tiff',
        log='INFO')

    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         sample_name=Sample,
                         data_exchange_type='tomography_raw_projections')
示例#13
0
def main():

    file_name = '/local/dataraid/databank/templates/xradia_dtu/sample_name.txrm'
    hdf5_file_name = '/local/dataraid/databank/templates/dataExchange/tmp/DTU_103.h5'
    sample_name = 'halvmaane_150kV-HE6-20X-60s'

    experimenter_name = "Martin Skovgaard Andersen"
    experimenter_affiliation = "Technical University of Denmark"
    experimenter_email = "*****@*****.**"
    instrument_comment = "Xradia Versa micro CT scanner"

    image_exposure_time = read_meta_txm(file_name, 'ImageInfo/ExpTimes')
    image_datetime = read_meta_txm(file_name, 'ImageInfo/Date')
    image_theta = read_meta_txm(file_name, 'ImageInfo/Angles')
    sample_image_shift_x = read_meta_txm(file_name, 'Alignment/X-Shifts')
    sample_image_shift_y = read_meta_txm(file_name, 'Alignment/Y-Shifts')
    sample_position_x = read_meta_txm(file_name, 'ImageInfo/XPosition')
    sample_position_y = read_meta_txm(file_name, 'ImageInfo/YPosition')
    sample_position_z = read_meta_txm(file_name, 'ImageInfo/ZPosition')

    # Example of SLS multiple scan meta data
    size = image_theta.shape[0]
    scan_index = np.zeros(size)
    image_number = np.arange(0, size)
    time_stamp = np.arange(0, size * 20000000, 20000000)
    image_exposure_time = np.random.random_integers(10000000, 10005000, size)
    image_is_complete = np.ones(size)
    today = datetime.datetime.today()
    today = today.isoformat()
    today = '2014-08-08T16:00:00'
    scan_datetime = range(0, size)
    scan_datetime = [today for i in scan_datetime]

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(file_name,
                                              projections_angle_start=-180,
                                              projections_angle_end=180,
                                              data_type='xradia',
                                              log='INFO')

    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         experimenter_name=experimenter_name,
                         experimenter_affiliation=experimenter_affiliation,
                         experimenter_email=experimenter_email,
                         instrument_comment=instrument_comment,
                         sample_name=sample_name,
                         sample_position_x=sample_position_x,
                         sample_position_y=sample_position_y,
                         sample_position_z=sample_position_z,
                         sample_image_shift_x=sample_image_shift_x,
                         sample_image_shift_y=sample_image_shift_y,
                         image_exposure_time=image_exposure_time,
                         image_datetime=image_datetime,
                         image_theta=image_theta,
                         scan_index=scan_index,
                         scan_datetime=scan_datetime,
                         time_stamp=time_stamp,
                         image_number=image_number,
                         image_is_complete=image_is_complete,
                         data_exchange_type='tomography_raw_projections')
示例#14
0
def main():

    top_dir = '/local/carmen/lorentz/stu/'
    tray = 'tray03'
    sample = 'Sam20'
    sample_name = 'Plesio_hor_2'
    log_file = top_dir + tray + '/exp.log'

    # create an exp.log file as:
    #   Number of projections        : 1500
    #   Number of darks              : 1
    #   Number of flats              : 2
    #   Rot Y min position  [deg]    : 0.000
    #   Rot Y max position  [deg]    : 180.000
    #   Angular step [deg]           : 0.12

    hdf5_file_name = top_dir + tray + '/hdf5/' + sample + '.h5'
    file_name = top_dir + tray + '/' + sample + '/raw/' + sample_name + '_.h5'

    source_name = "Advanced Photon Source"
    source_mode = "top-up"
    beamline = "2-BM"

    experimenter_name = "Stuart R Stock"
    experimenter_affiliation = "Northwestern University Feinberg School of Medicine"
    experimenter_email = "*****@*****.**"
    instrument_comment = "Francesco De Carlo at [email protected]"

    #Read exp log file data
    file = open(log_file, 'r')
    for line in file:
        linelist = line.split()
        if len(linelist) > 1:
            if (linelist[0] == "Number" and linelist[2] == "darks"):
                number_of_darks = int(linelist[4])
            elif (linelist[0] == "Number" and linelist[2] == "flats"):
                number_of_flats = int(linelist[4])
            elif (linelist[0] == "Number" and linelist[2] == "projections"):
                number_of_projections = int(linelist[4])
            elif (linelist[0] == "Rot" and linelist[2] == "min"):
                rotation_min = float(linelist[6])
            elif (linelist[0] == "Rot" and linelist[2] == "max"):
                rotation_max = float(linelist[6])
            elif (linelist[0] == "Angular" and linelist[1] == "step"):
                angular_step = float(linelist[4])
    file.close()

    white_start = 1
    white_end = 2
    projections_start = 2
    projections_end = projections_start + (int)(
        (rotation_max - rotation_min) / angular_step) + 1
    dark_start = projections_end + 1
    dark_end = dark_start + number_of_darks
    projections_angle_end = 180 + angular_step

    print "DARK", dark_start, dark_end
    print "WHITE", white_start, white_end
    print projections_start, projections_end
    print projections_angle_end

    print file_name
    print log_file

    # Read raw data
    read = xtomo_imp.Import()
    data, white, dark, theta = read.xtomo_raw(
        file_name,
        projections_start=projections_start,
        projections_end=projections_end,
        projections_angle_end=projections_angle_end,
        projections_digits=5,
        white_start=white_start,
        white_end=white_end,
        dark_start=dark_start,
        dark_end=dark_end,
        data_type='hdf5',
        log='INFO')
    # Save data as dataExchange
    write = xtomo_exp.Export()
    write.xtomo_exchange(data=data,
                         data_white=white,
                         data_dark=dark,
                         theta=theta,
                         hdf5_file_name=hdf5_file_name,
                         source_name=source_name,
                         source_mode=source_mode,
                         beamline=beamline,
                         experimenter_name=experimenter_name,
                         experimenter_affiliation=experimenter_affiliation,
                         experimenter_email=experimenter_email,
                         instrument_comment=instrument_comment,
                         sample_name=sample_name,
                         data_exchange_type='tomography_raw_projections')