Exemple #1
0
    imageAs2DArray = np.zeros((height, width), dtype=np.uint16)

    starttime = time.clock()
    darkImagesDataset = exchangeGrp.create_dataset('data_dark',
                                                   (ndrk, height, width),
                                                   'uint16')  # Create dataset
    darkThetaDataset = exchangeGrp.create_dataset('theta_dark', (ndrk, ),
                                                  'float')  # Create dataset
    for darkImageCounter in range(0, ndrk):
        print "Dark " + str(darkImageCounter)
        darkThetaDataset[darkImageCounter] = rotmin
        darkImageName = samplename + str(darkImageCounter +
                                         1).zfill(4) + "." + "tif"
        darkImageFullPath = tifdir + "/" + darkImageName
        with tifffile(darkImageFullPath) as tif:
            imageAs2DArray = tif.asarray()  # image is a np.ndarray
            darkImagesDataset[
                darkImageCounter, :, :] = imageAs2DArray  # Fill dataset

    flatImagesDataset = exchangeGrp.create_dataset(
        'data_white', (2 * nflt * grid_steps, height, width), 'uint16')
    flatThetaDataset = exchangeGrp.create_dataset('theta_flat',
                                                  (2 * nflt * grid_steps, ),
                                                  'float')  # Create dataset
    for flatImageCounter in range(0, 2 * nflt * grid_steps):
        print "Flat " + str(flatImageCounter)
        if flatImageCounter < nflt * grid_steps:
            offset = ndrk
            flatThetaDataset[flatImageCounter] = rotmin
        else: