Пример #1
0
 def load_dataset(self, corrected=True):
     self.stack = [
         np.array(axitom.read_image(image, flat_corrected=corrected))
         for image in self.dataset
     ]
     if self.debug:
         print(self.stack)
     return self.stack
Пример #2
0
def reconstruct_tomogram():
    config = axitom.config_from_xtekct("./example_data/radiogram.xtekct")

    radiogram = axitom.read_image(r"./example_data/radiogram.tif", flat_corrected=True)
    # Remove some edges that are in field of view
    radiogram[:250, :] = 0.95
    radiogram[1800:, :] = 0.95

    radiogram = median_filter(radiogram, size=20)

    _, center_offset = axitom.object_center_of_rotation(radiogram, config, background_internsity=0.9)
    config.center_of_rot_y = center_offset
    config.update()

    tomogram = axitom.fdk(radiogram, config)

    return tomogram
Пример #3
0
def run_reconstruction():
    dir_path = os.path.dirname(os.path.realpath(__file__))
    config = axitom.config_from_xtekct(dir_path +
                                       "/example_data/settings.xtekct")
    radiogram = axitom.read_image(dir_path + "/example_data/radiogram.tif",
                                  flat_corrected=True)

    # Remove some edges that are in field of view
    radiogram[:250, :] = 0.95
    radiogram[1800:, :] = 0.95

    radiogram = median_filter(radiogram, size=20)

    _, center_offset = axitom.object_center_of_rotation(
        radiogram, config, background_internsity=0.9)
    config.center_of_rot_y = center_offset

    config.update()

    reconstruction = axitom.fdk(radiogram, config)

    return reconstruction
Пример #4
0
    def test_compare_to_external_software(self):
        """
        Compare the results obtained by using only a single radiogram from a full dataset to the results
        obtained by using the whole dataset and external reconstruction software. The reconstruction by
        the external software is done in advance and only the result is used here.
        """
        dir_path = os.path.dirname(os.path.realpath(__file__))

        self.tol = 2e-2
        recon = run_reconstruction()
        recon_crop = recon.transpose()[:, ::-1][1:, :400]
        recon_crop_norm = normalize_grey_scales(recon_crop)

        correct = axitom.read_image(
            dir_path + "/example_data/recon_by_external_software.tif")
        correct_norm = normalize_grey_scales(correct.transpose())

        error_field = np.abs(recon_crop_norm[::-1, :] - correct_norm)

        if np.average(error_field) > self.tol:
            self.fail(
                "The reconstruction did not match the reconstruction performed by another software and the error was: %f"
                % np.average(error_field))
Пример #5
0
    radiogram[1800:, :] = 0.95

    radiogram = median_filter(radiogram, size=20)

    _, center_offset = axitom.object_center_of_rotation(radiogram, config, background_internsity=0.9)
    config.center_of_rot_y = center_offset
    config.update()

    tomogram = axitom.fdk(radiogram, config)

    return tomogram


recon_tomo = reconstruct_tomogram()

correct = axitom.read_image(r"./example_data/recon_by_external_software.tif")
correct_norm = normalize_grey_scales(correct.transpose())

Reconimg_crop = recon_tomo.transpose()[:, ::-1][1:, :400]
Reconimg_crop_norm = normalize_grey_scales(Reconimg_crop)

plt.figure()
plt.subplot(1, 3, 1)
plt.title("Nikon CT-PRO")
plt.imshow(correct_norm, cmap=plt.cm.magma)
plt.axis('off')
plt.clim(vmin=0.5, vmax=1.0)
plt.colorbar()

plt.subplot(1, 3, 2)
plt.title("AXITOM")
Пример #6
0
    radiogram = median_filter(radiogram, size=20)

    _, center_offset = axitom.object_center_of_rotation(
        radiogram, config, background_internsity=0.9)
    config.center_of_rot_y = center_offset
    config.update()

    tomogram = axitom.fdk(radiogram, config)

    return tomogram


recon_tomo = reconstruct_tomogram()

correct = axitom.read_image(
    join(path_to_data, "recon_by_external_software.tif"))
correct_norm = normalize_grey_scales(correct.transpose())

Reconimg_crop = recon_tomo.transpose()[:, ::-1][1:, :400]
Reconimg_crop_norm = normalize_grey_scales(Reconimg_crop)

plt.figure()
plt.subplot(1, 3, 1)
plt.title("Nikon CT-PRO")
plt.imshow(correct_norm, cmap=plt.cm.magma)
plt.axis('off')
plt.clim(vmin=0.5, vmax=1.0)
plt.colorbar()

plt.subplot(1, 3, 2)
plt.title("AXITOM")