ufo-kit / syris

X-ray imaging simulation
GNU Lesser General Public License v3.0
32 stars 19 forks source link

imageprocessing.decimate shifts image #5

Closed MathiasHurst closed 6 years ago

MathiasHurst commented 6 years ago

The decimate function returns creates a shift in the image.

Minimal example:

import syris from syris.imageprocessing import decimate import numpy as np import matplotlib.pyplot as plt

syris.init()

intensity_image = np.zeros((1024,1024)) intensity_image[0:1024,500:524] = 1

plt.figure() plt.imshow(intensity_image)

new_shape = (800,800)

photons = decimate(intensity_image, new_shape).get()

plt.figure() plt.imshow(photons) plt.show()

tfarago commented 6 years ago

Thanks for the ticket! Decimate calls bin_image, which means the new shape must divide the original shape. To make it clearer, I forbid doing the non-divisor binning by raising an exception b1a0840f3821e66411006ac82694ddafd98ace15

If you need arbitrary shape rescaling, use imageprocessing.rescale.