ComputationalRadiationPhysics / imresh

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

Converging problem for large pictures #39

Open mxmlnkn opened 8 years ago

mxmlnkn commented 8 years ago

With the createAtomCluster a atom cluster can be generated. The generated pictures smaller ~500x500 do converge fine, but for the version 3000x1500 it doesn't if the macro variable SCALE_EXAMPLE_IMAGE is set to 1.

_Ground Truth (#define SCALE_EXAMPLE_IMAGE 1)_ atomcluster-scaled-object

_Diffraction Intensity (#define SCALE_EXAMPLE_IMAGE 1)_ atomcluster-scaled-diffractionintensity

Reconstructed Image (#define SCALE_EXAMPLE_IMAGE 1) (aborted after 64 iterations) atomcluster-scaled-reconstructed

But if SCALE_EXAMPLE_IMAGE is set to 0 it actually does converge exactly as well as the smaller versions.

_Ground Truth (#define SCALE_EXAMPLE_IMAGE 0)_ atomcluster-extent-object

_Diffraction Intensity (#define SCALE_EXAMPLE_IMAGE 0)_ atomcluster-extent-diffractionintensity

_Reconstruction (#define SCALE_EXAMPLE_IMAGE 0)_ atomcluster-extent-reconstructed Note the cluster is barely visible in the upper and bottom left corners.

I'm not sure why this happens. I hope I do not embarrass myself, but my guess actually is on the algorithm itself. First tests have shown, that it is a problem with the creation of the initial mask. The initial mask uses a a threshold determined by the maximum of the auto-correlation map (Fourier transform of diffraction intensity). For some reason that mask creation is dependent on the image dimensions. For the scaled atom cluster too many pixels will be masked out. The shrink wrap basically is too strong and slips off the object too reconstruct.

_Initial Mask (#define SCALE_EXAMPLE_IMAGE 1)_ atomcluster-scaled-init-mask

_Initial Mask (#define SCALE_EXAMPLE_IMAGE 0)_ atomcluster-extent-init-mask

Basically, after tweaking rIntensityCutOffAutoCorel it should also converge, but somehow this parameter should be chosen automatically, or another parameter should be used, e.g. to select the 50% top pixels to be masked out initially, where 50% is an adjustable parameter. (Note that on 100% and 0% the HIO algorithm may not advance).

The proposed method would need to make a histogram of the pixels though, which could be a quite expensive operation.

Ferruck commented 8 years ago

Where's the point of not setting SCALE_EXAMPLE_IMAGE 0? I mean, why should we scale the image and loose information?