ComputationalRadiationPhysics / imresh

Shrink-Wrap Phase Reconstruction Algorithm
MIT License
3 stars 2 forks source link

Problem with input image diffraction layout #34

Open mxmlnkn opened 8 years ago

mxmlnkn commented 8 years ago

The normal input would have the brightness maximum in the middle (so do the test diffraction patterns) ("normally" the center would be masked ...), but the shrink-wrap algorithm or to be more precise: cuFFT (and fftw) anticipates the maximum to be in one of the corners (I think the very first element of the 2D array). Meaning everything needs to be periodically shift by half the height/width. A function for this actually already exists with fftShift.

Normal input images won't be centered perfectly though. Meaning we would have to find the center somehow ... e.g. by finding the maximum, but that won't work if it is masked.

I'm not really sure how this is done in other HIO algorithms which existed for some time. Maybe that fftShift is not even necessary, but I think it at least made problems in the beginning stages, that's why I wrote fftShift.

Ferruck commented 8 years ago

I think we can only solve this issue when we've original images.