teamtomo / libtilt

Image processing for cryo-electron microscopy in PyTorch
Other
14 stars 5 forks source link

fix padding in rescaling to use reflect correctly #71

Closed McHaillet closed 8 months ago

McHaillet commented 8 months ago

The imaged I attached in #63 showed a strong edge artifact, which I first though came from shifting. Turns out it originates from rescaling. Apparently the padding with zeros during rescaling created lines in my tilt-series, as visible in the top left corner of this image:

rescale_edges_from_zero_padding

I made a small fix in _pad_to_best_fft_shape_2d as it was not correctly switching to 'reflect' mode. Also a suggested change to pad images with the image mean as the constant value for too much padding to still somewhat reduce edges. Now rescaling looks like this:

rescale_edges_with_reflection

And it edges after shifting are indeed reduced:

reduced_edge_artifact_after_shift

alisterburt commented 8 months ago

Having trouble merging this from mobile, not sure what's up - will sort when back at a PC unless you want to rebase yourself?

Edit: ignore above