cabouman / mbircone

BSD 3-Clause "New" or "Revised" License
11 stars 9 forks source link

qGGMRF Denoiser #122

Closed dyang37 closed 1 year ago

dyang37 commented 1 year ago

This PR contains necessary changes for the qGGMRF denoiser function, along with a demo script.

The implementation is done such that none of the existing python/C functions are changed. Therefore no existing features/functionalities of the code base will be affected by this PR.

To test, run demo_denoise3d.py

See below for a more thorough discussion regarding the interface design, code structure, and unit tests: Denoiser_interface.pptx

cabouman commented 1 year ago

Diyu, this is very good. But I think you need to do one more thing. You need to add an option for giving an initial condition. This will be needed if you use it in a MACE loop. You can use the same input as init_image for recon.

If you do this, I can check it over, and I will accept the PR.

dyang37 commented 1 year ago

Diyu, this is very good. But I think you need to do one more thing. You need to add an option for giving an initial condition. This will be needed if you use it in a MACE loop. You can use the same input as init_image for recon.

If you do this, I can check it over, and I will accept the PR.

Done. Here's the docstring of the new input "init_image":

init_image (float, ndarray, optional): [Default=0.0] Initial value of denoised image, specified by either a scalar value or a 3D numpy array with shape (num_img_slices, num_img_rows, num_img_cols). If None, img_noisy will be used as the initial value.

Also tested by performing denoising with the solution as the init_image:

print("Denoising ...")
denoised_image = mbircone.cone3D.denoise(noisy_image, sharpness=sharpness)

print("Denoising with the solution as init_image. The algorithm should converge within one iteration.")
denoised_image = mbircone.cone3D.denoise(noisy_image, sharpness=sharpness, init_image=denoised_image)

The second denoising operation converges within one ICD iteration, which is as expected.